org.crosswire.common.util
Class RobustList

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractList
          extended by org.crosswire.common.util.RobustList
All Implemented Interfaces:
Iterable, Collection, List

public class RobustList
extends AbstractList
implements List

This is a version of LinkedList that is not fail-fast.

Distribution Licence:
JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
The copyright to this program is held by it's authors.

Version:
$Id: RobustList.java,v 1.4 2004/09/08 19:54:24 dmsmith Exp $
Author:
Joe Walker [joe at eireneh dot com]
See Also:
Licence

Nested Class Summary
private  class RobustList.Entry
           
private static class RobustList.RobustListEnumeration
           
 
Field Summary
protected  RobustList.Entry foot
           
protected  RobustList.Entry head
           
protected static Logger log
          The log stream
protected  int size
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
RobustList()
           
 
Method Summary
 boolean add(Object o)
          Appends the specified element to the end of this list.
 void clear()
          Removes all of the elements from this list.
 boolean contains(Object o)
          Does this list contains the specified element?
protected  void debug(String title)
          Debug this implementation
 Enumeration elements()
          Returns a list-iterator of the elements in this list
private  RobustList.Entry findEntry(int index)
          Return the indexed entry.
 Object get(int index)
          Returns the element at the specified position in this list.
 int indexOf(Object o)
          Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not contain this element.
 Object remove(int index)
          Removes the element at the specified position in this list.
 boolean remove(Object o)
          Removes the first occurrence of the specified element in this list.
 int size()
          Returns the number of elements in this list.
 
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, addAll, containsAll, equals, hashCode, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeAll, retainAll, set, subList, toArray, toArray
 

Field Detail

head

protected RobustList.Entry head

foot

protected RobustList.Entry foot

size

protected int size

log

protected static final Logger log
The log stream

Constructor Detail

RobustList

public RobustList()
Method Detail

contains

public boolean contains(Object o)
Does this list contains the specified element?

Specified by:
contains in interface Collection
Specified by:
contains in interface List
Overrides:
contains in class AbstractCollection
Parameters:
o - element whose presence in this list is to be tested.
Returns:
true if this list contains the specified element.

size

public int size()
Returns the number of elements in this list.

Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in class AbstractCollection
Returns:
the number of elements in this list.

add

public boolean add(Object o)
Appends the specified element to the end of this list.

Specified by:
add in interface Collection
Specified by:
add in interface List
Overrides:
add in class AbstractList
Parameters:
o - element to be appended to this list.

remove

public Object remove(int index)
Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.

Specified by:
remove in interface List
Overrides:
remove in class AbstractList
Parameters:
index - the index of the element to removed.
Returns:
the element previously at the specified position.

remove

public boolean remove(Object o)
Removes the first occurrence of the specified element in this list. If the list does not contain the element, it is unchanged.

Specified by:
remove in interface Collection
Specified by:
remove in interface List
Overrides:
remove in class AbstractCollection
Parameters:
o - element to be removed from this list, if present.
Returns:
true if the list contained the specified element.

clear

public void clear()
Removes all of the elements from this list.

Specified by:
clear in interface Collection
Specified by:
clear in interface List
Overrides:
clear in class AbstractList

get

public Object get(int index)
Returns the element at the specified position in this list.

Specified by:
get in interface List
Specified by:
get in class AbstractList
Parameters:
index - index of element to return.
Returns:
the element at the specified position in this list.

findEntry

private RobustList.Entry findEntry(int index)
Return the indexed entry.


indexOf

public int indexOf(Object o)
Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not contain this element.

Specified by:
indexOf in interface List
Overrides:
indexOf in class AbstractList
Parameters:
o - element to search for.
Returns:
the index of the first occurrence or -1

elements

public Enumeration elements()
Returns a list-iterator of the elements in this list

Returns:
a ListIterator of the elements in this list

debug

protected void debug(String title)
Debug this implementation


Copyright ? 2003-2004