All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class COM.objectspace.jgl.DList
java.lang.Object
   |
   +----COM.objectspace.jgl.DList
  -  public class DList
  
-  extends Object
  
-  implements Sequence
   
A DList is a doubly-linked list, a sequential container that is optimized for insertion
 and erasure at arbitrary points in its structure.
 
 A DList is useful when the order of items and fast arbitrary insertion/erasure are
 important. DLists are not as efficient as Deques when insertion and erasure only take
 place at the extremities.
 
 A DList is implemented as a doubly-linked list in which every node in the list
 has a pointer to the previous node and a pointer to the next node.
 
 Insertion does not affect iterators or references. Insertion of a single element into
 a DList takes constant time. Insertion of multiple elements into a DList is linear in
 the number of elements inserted.
 
 Removal only invalidates the iterators and references to the removed elements. Removing
 a single element is a constant time operation. Removing a range in a DList is linear
 time in the size of the range.
 
    -  See Also:
    
 -  Sequence, DListExamples
 
  
  -  
	DList()
   -   Construct myself to be an empty DList.
  
 -  
	DList(DList)
   -   Construct myself to be a shallow copy of an existing DList.
  
 -  
	DList(int)
   -   Construct myself to contain a specified number of null elements.
  
 -  
	DList(int, Object)
   -   Construct myself to contain a specified number of elements set to
 a particular object.
 
  
  -  
	add(Object)
   -   Add an object after my last element and return null.
  
 -  
	at(int)
   -   Return the element at the specified index.
  
 -  
	back()
   -   Return my last item.
  
 -  
	begin()
   -   Return an iterator positioned at my first item.
  
 -  
	clear()
   -   Remove all of my elements.
  
 -  
	clone()
   -   Return a shallow copy of myself.
  
 -  
	contains(Object)
   -   Return true if I contain a particular object.
  
 -  
	copy(DList)
   -   Become a shallow copy of an existing DList.
  
 -  
	count(DListIterator, DListIterator, Object)
   -   Return the number of objects within a specified range of that match a
 particular value.
  
 -  
	count(int, int, Object)
   -   Return the number of objects within a specified range of that match a
 particular value.
  
 -  
	count(Object)
   -   Return the number of objects that match a particular value.
  
 -  
	elements()
   -   Return an Enumeration of my components.
  
 -  
	end()
   -   Return an iterator positioned immediately after my last item.
  
 -  
	equals(DList)
   -   Return true if I contain the same items in the same order as
 another DList.
  
 -  
	equals(Object)
   -   Return true if I'm equal to another object.
  
 -  
	find(DListIterator, DListIterator, Object)
   -   Return an iterator positioned at the first object within a specified range that
 matches a particular object, or end() if the object is not found.
  
 -  
	find(Object)
   -   Return an iterator positioned at the first object that matches a particular value, or
 end() if the object is not found.
  
 -  
	finish()
   -   Return an iterator positioned immediately afer my last item.
  
 -  
	front()
   -   Return my first item.
  
 -  
	hashCode()
   -   Return my hash code for support of hashing containers
  
 -  
	indexOf(int, int, Object)
   -   Return an iterator positioned at the first object within a specified range that
 matches a particular object, or -1 if the object is not found.
  
 -  
	indexOf(Object)
   -   Return the index of the first object that matches a particular value, or
 -1 if the object is not found.
  
 -  
	insert(DListIterator, InputIterator, InputIterator)
   -   Insert a sequence of objects at a particular location.
  
 -  
	insert(DListIterator, int, Object)
   -   Insert multiple objects at a particular position.
  
 -  
	insert(DListIterator, Object)
   -   Insert an object at a particular position and return an iterator
 positioned at the new element.
  
 -  
	insert(int, int, Object)
   -   Insert multiple objects at a particular index.
  
 -  
	insert(int, Object)
   -   Insert an object at a particular index.
  
 -  
	isEmpty()
   -   Return true if I contain no entries.
  
 -  
	maxSize()
   -   Return the maximum number of entries that I can contain.
  
 -  
	popBack()
   -   Remove and return my last element.
  
 -  
	popFront()
   -   Remove and return my first element.
  
 -  
	pushBack(Object)
   -   Add an object after my last element.
  
 -  
	pushFront(Object)
   -   Insert an object in front of my first element.
  
 -  
	put(int, Object)
   -   Set the element at the specified index to a particular object.
  
 -  
	remove(Enumeration)
   -   Remove the element at a particular position.
  
 -  
	remove(Enumeration, Enumeration)
   -   Remove the elements in the range [ first..last ).
  
 -  
	remove(Enumeration, Enumeration, Object)
   -   Remove all elements within a specified range that match a particular object
 and return the number of objects that were removed.
  
 -  
	remove(int)
   -   Remove the element at a particular index.
  
 -  
	remove(int, int)
   -   Remove the elements within a range of indices.
  
 -  
	remove(int, int, Object)
   -   Remove all elements within a specified range that match a particular object
 and return the number of objects that were removed.
  
 -  
	remove(Object)
   -   Remove all elements that match a particular object and return the numbers of
 objects that were removed.
  
 -  
	remove(Object, int)
   -   Remove at most a given number of elements that match a particular object and return the number of
 objects that were removed.
  
 -  
	replace(DListIterator, DListIterator, Object, Object)
   -   Replace all elements within a specified range that match a particular object
 with a new value and return the number of objects that were replaced.
  
 -  
	replace(int, int, Object, Object)
   -   Replace all elements within a specified range that match a particular object
 with a new value and return the number of objects that were replaced.
  
 -  
	replace(Object, Object)
   -   Replace all elements that match a particular object with a new value and return
 the number of objects that were replaced.
  
 -  
	reverse()
   -   Reverse the order of my elements.
  
 -  
	size()
   -   Return the number of entries that I contain.
  
 -  
	splice(DListIterator, DList)
   -   Remove all of the elements in a specified DList and insert them at a particular
 position.
  
 -  
	splice(DListIterator, DList, DListIterator)
   -   Remove a specified element from a DList and insert it at a particular position.
  
 -  
	splice(DListIterator, DList, DListIterator, DListIterator)
   -   Splice a range of elements from a DList into a particular position.
  
 -  
	splice(int, DList)
   -   Remove all of the elements in a specified DList and insert them at a particular
 position.
  
 -  
	splice(int, DList, int)
   -   Remove a specified element from a DList and insert it at a particular position.
  
 -  
	splice(int, DList, int, int)
   -   Splice a range of elements from a DList and insert them at a particular position.
  
 -  
	start()
   -   Return an iterator positioned at my first item.
  
 -  
	swap(DList)
   -   Swap my contents with another DList.
  
 -  
	toString()
   -   Return a string that describes me.
  
 -  
	unique()
   -   Replace all repeating sequences of a single element by a single occurrence of
 that element.
 
  
DList
  public DList()
  -  Construct myself to be an empty DList.
 
DList
  public DList(int size)
  -  Construct myself to contain a specified number of null elements.
  
    -  Parameters:
    
 -  size - The number of elements to contain.
    
 -  Throws: IllegalArgumentException
    
 -  If the specified size is negative.
  
 
 
DList
  public DList(int size,
               Object object)
  -  Construct myself to contain a specified number of elements set to
 a particular object.
  
    -  Parameters:
    
 -  size - The number of elements to contain.
    
-  object - The initial value of each element.
    
  -  Throws: IllegalArgumentException
    
 -  If the specified size is negative.
  
 
 
DList
  public DList(DList list)
  -  Construct myself to be a shallow copy of an existing DList.
  
    -  Parameters:
    
 -  DList - The DList to copy.
  
 
 
  
clone
  public synchronized Object clone()
  -  Return a shallow copy of myself.
  
    -  Overrides:
    
 -  clone in class Object
  
 
 
equals
  public boolean equals(Object object)
  -  Return true if I'm equal to another object.
  
    -  Parameters:
    
 -  object - The object to compare myself against.
    
 -  Overrides:
    
 -  equals in class Object
  
 
 
equals
  public synchronized boolean equals(DList list)
  -  Return true if I contain the same items in the same order as
 another DList. Use equals() to compare the individual elements.
  
    -  Parameters:
    
 -  list - The DList to compare myself against.
  
 
 
hashCode
  public synchronized int hashCode()
  -  Return my hash code for support of hashing containers
  
    -  Overrides:
    
 -  hashCode in class Object
  
 
 
toString
  public synchronized String toString()
  -  Return a string that describes me.
  
    -  Overrides:
    
 -  toString in class Object
  
 
 
copy
  public synchronized void copy(DList list)
  -  Become a shallow copy of an existing DList.
  
    -  Parameters:
    
 -  list - The DList that I shall become a shallow copy of.
  
 
 
isEmpty
  public boolean isEmpty()
  -  Return true if I contain no entries.
 
size
  public int size()
  -  Return the number of entries that I contain.
 
maxSize
  public int maxSize()
  -  Return the maximum number of entries that I can contain.
 
at
  public synchronized Object at(int index)
  -  Return the element at the specified index.
  
    -  Parameters:
    
 -  index - The index.
    
 -  Throws: IndexOutOfBoundsException
    
 -  If the index is not valid.
  
 
 
put
  public synchronized void put(int index,
                               Object object)
  -  Set the element at the specified index to a particular object.
  
    -  Parameters:
    
 -  index - The index.
    
-  object - The object.
    
  -  Throws: IndexOutOfBoundsException
    
 -  If the index is not valid.
  
 
 
insert
  public synchronized DListIterator insert(DListIterator pos,
                                           Object object)
  -  Insert an object at a particular position and return an iterator
 positioned at the new element.
  
    -  Parameters:
    
 -  pos - An iterator positioned at the element that the object will be inserted immediately before.
    
-  object - The object to insert.
  
  
 
insert
  public synchronized void insert(int index,
                                  Object object)
  -  Insert an object at a particular index.
  
    -  Parameters:
    
 -  index - The index of the element that the object will be inserted immediately before.
    
-  object - The object to insert.
    
  -  Throws: IndexOutOfBoundsException
    
 -  If the index is invalid.
  
 
 
insert
  public synchronized void insert(DListIterator pos,
                                  int n,
                                  Object object)
  -  Insert multiple objects at a particular position.
  
    -  Parameters:
    
 -  pos - An iterator positioned at the element that the objects will be inserted immediately before.
    
-  n - The number of objects to insert.
    
-  object - The object to insert.
  
   
 
insert
  public synchronized void insert(int index,
                                  int n,
                                  Object object)
  -  Insert multiple objects at a particular index.
  
    -  Parameters:
    
 -  index - The index of the element that the objects will be inserted immediately before.
    
-  object - The object to insert.
    
  -  Throws: IndexOutOfBoundsException
    
 -  If the index is invalid.
  
 
 
insert
  public synchronized void insert(DListIterator pos,
                                  InputIterator first,
                                  InputIterator last)
  -  Insert a sequence of objects at a particular location.
  
    -  Parameters:
    
 -  pos - The location of the element that the objects will be inserted immediately before.
    
-  first - An iterator positioned at the first element to insert.
    
-  last - An iterator positioned immediately after the last element to insert.
  
   
 
back
  public synchronized Object back()
  -  Return my last item.
  
    -  Throws: InvalidOperationException
    
 -  If the DList is empty.
  
 
 
front
  public synchronized Object front()
  -  Return my first item.
  
    -  Throws: InvalidOperationException
    
 -  If the DList is empty.
  
 
 
clear
  public synchronized void clear()
  -  Remove all of my elements.
 
remove
  public synchronized int remove(int first,
                                 int last)
  -  Remove the elements within a range of indices.
  
    -  Parameters:
    
 -  first - The index of the first element to remove.
    
-  last - The index of the last element to remove.
    
  -  Returns:
    
 -  The number of elements removed.
    
 -  Throws: IndexOutOfBoundsException
    
 -  If either index is invalid.
  
 
 
remove
  public synchronized int remove(Enumeration first,
                                 Enumeration last)
  -  Remove the elements in the range [ first..last ).
  
    -  Parameters:
    
 -  first - An Enumeration positioned at the first object to remove.
    
-  last - An Enumeration positioned immediately after the last object to remove.
    
  -  Returns:
    
 -  The number of elements removed.
    
 -  Throws: IllegalArgumentException
    
 -  is the Enumeration isn't a
 DListIterator for this DList object.
  
 
 
remove
  public synchronized Object remove(int index)
  -  Remove the element at a particular index.
  
    -  Parameters:
    
 -  index - The index of the element to remove.
    
 -  Returns:
    
 -  The object removed.
    
 -  Throws: IndexOutOfBoundsException
    
 -  If the index is invalid.
  
 
 
remove
  public synchronized Object remove(Enumeration pos)
  -  Remove the element at a particular position.
  
    -  Parameters:
    
 -  pos - An Enumeration positioned at the element to remove.
    
 -  Returns:
    
 -  The object removed.
    
 -  Throws: IllegalArgumentException
    
 -  is the Enumeration isn't a
 DListIterator for this DList object.
  
 
 
splice
  public synchronized void splice(int index,
                                  DList list)
  -  Remove all of the elements in a specified DList and insert them at a particular
 position.
  
    -  Parameters:
    
 -  index - The index of the element that the items will be inserted immediately before.
    
-  list - The DList to splice the elements from.
    
  -  Throws: IndexOutOfBoundsException
    
 -  If the index is invalid.
  
 
 
splice
  public synchronized void splice(DListIterator pos,
                                  DList list)
  -  Remove all of the elements in a specified DList and insert them at a particular
 position.
  
    -  Parameters:
    
 -  pos - The position to insert the elements.
    
-  list - The DList to splice the elements from.
  
  
 
splice
  public synchronized void splice(DListIterator to,
                                  DList list,
                                  DListIterator from)
  -  Remove a specified element from a DList and insert it at a particular position.
  
    -  Parameters:
    
 -  to - The position to insert the element.
    
-  list - The DList to splice the element from.
    
-  from - The position of the element to splice.
  
   
 
splice
  public synchronized void splice(int to,
                                  DList list,
                                  int from)
  -  Remove a specified element from a DList and insert it at a particular position.
  
    -  Parameters:
    
 -  to - The index of the element that the item will be inserted immediately before.
    
-  list - The DList to splice the element from.
    
-  from - The index of the element to splice.
    
   -  Throws: IndexOutOfBoundsException
    
 -  If either index is invalid.
  
 
 
splice
  public synchronized void splice(DListIterator pos,
                                  DList list,
                                  DListIterator first,
                                  DListIterator last)
  -  Splice a range of elements from a DList into a particular position.
  
    -  Parameters:
    
 -  pos - The position to insert the elements.
    
-  list - The list to splice the elements from.
    
-  first - An iterator positioned at the first element to splice.
    
-  last - An iterator positioned immediately after the last element to splice.
  
    
 
splice
  public synchronized void splice(int index,
                                  DList list,
                                  int first,
                                  int last)
  -  Splice a range of elements from a DList and insert them at a particular position.
  
    -  Parameters:
    
 -  index - The index of the item that the elements should be inserted immediately before.
    
-  list - The DList to splice the elements from.
    
-  first - The index of the first element to splice.
    
-  last - The index of the last element to splice.
    
    -  Throws: IndexOutOfBoundsException
    
 -  If any index is invalid.
  
 
 
unique
  public synchronized void unique()
  -  Replace all repeating sequences of a single element by a single occurrence of
 that element.
 
popBack
  public synchronized Object popBack()
  -  Remove and return my last element.
  
    -  Throws: InvalidOperationException
    
 -  If the DList is empty.
  
 
 
pushFront
  public synchronized void pushFront(Object object)
  -  Insert an object in front of my first element.
  
    -  Parameters:
    
 -  object - The object to insert.
  
 
 
popFront
  public synchronized Object popFront()
  -  Remove and return my first element.
  
    -  Throws: InvalidOperationException
    
 -  If the DList is empty.
  
 
 
add
  public synchronized Object add(Object object)
  -  Add an object after my last element and return null.
 This function is a synonym for pushBack().
  
    -  Parameters:
    
 -  object - The object to add.
  
 
 
pushBack
  public synchronized void pushBack(Object object)
  -  Add an object after my last element.
  
    -  Parameters:
    
 -  The - object to add.
  
 
 
swap
  public synchronized void swap(DList list)
  -  Swap my contents with another DList.
  
    -  Parameters:
    
 -  list - The DList that I will swap my contents with.
  
 
 
remove
  public synchronized int remove(Object object)
  -  Remove all elements that match a particular object and return the numbers of
 objects that were removed.
  
    -  Parameters:
    
 -  object - The object to remove.
  
 
 
remove
  public synchronized int remove(Object object,
                                 int count)
  -  Remove at most a given number of elements that match a particular object and return the number of
 objects that were removed.
  
    -  Parameters:
    
 -  object - The object to remove.
    
-  count - The maximum number of objects to remove.
  
  
 
remove
  public synchronized int remove(Enumeration first,
                                 Enumeration last,
                                 Object object)
  -  Remove all elements within a specified range that match a particular object
 and return the number of objects that were removed.
  
    -  Parameters:
    
 -  first - An Enumeration positioned at the first object to remove.
    
-  last - An Enumeration positioned immediately after the last object to remove.
    
-  object - The object to remove.
    
   -  Throws: IllegalArgumentException
    
 -  is the Enumeration isn't a
 DListIterator for this DList object.
  
 
 
remove
  public synchronized int remove(int first,
                                 int last,
                                 Object object)
  -  Remove all elements within a specified range that match a particular object
 and return the number of objects that were removed.
  
    -  Parameters:
    
 -  first - The index of the first object to remove.
    
-  last - The index of the last object to remove.
    
-  object - The object to remove.
    
   -  Throws: IndexOutOfBoundsException
    
 -  If either index is invalid.
  
 
 
begin
  public synchronized DListIterator begin()
  -  Return an iterator positioned at my first item.
 
start
  public ForwardIterator start()
  -  Return an iterator positioned at my first item.
 
end
  public synchronized DListIterator end()
  -  Return an iterator positioned immediately after my last item.
 
finish
  public ForwardIterator finish()
  -  Return an iterator positioned immediately afer my last item.
 
elements
  public synchronized Enumeration elements()
  -  Return an Enumeration of my components.
 
replace
  public synchronized int replace(Object oldValue,
                                  Object newValue)
  -  Replace all elements that match a particular object with a new value and return
 the number of objects that were replaced.
  
    -  Parameters:
    
 -  oldValue - The object to be replaced.
    
-  newValue - The value to substitute.
  
  
 
replace
  public synchronized int replace(DListIterator first,
                                  DListIterator last,
                                  Object oldValue,
                                  Object newValue)
  -  Replace all elements within a specified range that match a particular object
 with a new value and return the number of objects that were replaced.
  
    -  Parameters:
    
 -  first - An iterator positioned at the first object to be considered.
    
-  last - An iterator positioned immediately after the last object to be considered.
    
-  oldValue - The object to be replaced.
    
-  newValue - The value to substitute.
  
    
 
replace
  public synchronized int replace(int first,
                                  int last,
                                  Object oldValue,
                                  Object newValue)
  -  Replace all elements within a specified range that match a particular object
 with a new value and return the number of objects that were replaced.
  
    -  Parameters:
    
 -  first - The index of the first object to be considered.
    
-  last - The index of the last object to be considered.
    
-  oldValue - The object to be replaced.
    
-  newValue - The value to substitute.
    
    -  Throws: IndexOutOfBoundsException
    
 -  If either index is invalid.
  
 
 
count
  public synchronized int count(Object object)
  -  Return the number of objects that match a particular value.
  
    -  Parameters:
    
 -  object - The object to count.
  
 
 
count
  public synchronized int count(DListIterator first,
                                DListIterator last,
                                Object object)
  -  Return the number of objects within a specified range of that match a
 particular value.
  
    -  Parameters:
    
 -  first - An iterator positioned at the first object to consider.
    
-  last - An iterator positioned immediately after the last object to consider.
  
  
 
count
  public synchronized int count(int first,
                                int last,
                                Object object)
  -  Return the number of objects within a specified range of that match a
 particular value.
  
    -  Parameters:
    
 -  first - The index of the first object to consider.
    
-  last - The index of the last object to consider.
    
  -  Throws: IndexOutOfBoundsException
    
 -  If either index is invalid.
  
 
 
find
  public synchronized DListIterator find(Object object)
  -  Return an iterator positioned at the first object that matches a particular value, or
 end() if the object is not found.
  
    -  Parameters:
    
 -  object - The object to find.
  
 
 
indexOf
  public synchronized int indexOf(Object object)
  -  Return the index of the first object that matches a particular value, or
 -1 if the object is not found.
  
    -  Parameters:
    
 -  object - The object to find.
  
 
 
find
  public synchronized DListIterator find(DListIterator first,
                                         DListIterator last,
                                         Object object)
  -  Return an iterator positioned at the first object within a specified range that
 matches a particular object, or end() if the object is not found.
  
    -  Parameters:
    
 -  first - An iterator positioned at the first object to consider.
    
-  last - An iterator positioned immediately after the last object to consider.
    
-  object - The object to find.
  
   
 
indexOf
  public synchronized int indexOf(int first,
                                  int last,
                                  Object object)
  -  Return an iterator positioned at the first object within a specified range that
 matches a particular object, or -1 if the object is not found.
  
    -  Parameters:
    
 -  first - The index of the first object to consider.
    
-  last - The index of the last object to consider.
    
-  object - The object to find.
    
   -  Throws: IndexOutOfBoundsException
    
 -  If either index is invalid.
  
 
 
contains
  public synchronized boolean contains(Object object)
  -  Return true if I contain a particular object.
  
    -  Parameters:
    
 -  object - The object in question.
  
 
 
reverse
  public synchronized void reverse()
  -  Reverse the order of my elements.
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index