All Packages Class Hierarchy This Package Previous Next Index
Class COM.objectspace.jgl.SList
java.lang.Object
|
+----COM.objectspace.jgl.SList
- public class SList
- extends Object
- implements Sequence
An SList is a sequential container that is optimized for insertion and erasure at
its extremities.
An SList is useful when the order of items and fast insertion/erasure at extremeties is
important.
An SList is implemented as a singly linked list in which every node in the list
has a pointer to the next node.
Insertion does not affect iterators or references.
Removal only invalidates the iterators and references to the removed elements.
- See Also:
- Sequence, SListExamples
-
SList()
- Construct myself to be an empty SList.
-
SList(int)
- Construct myself to contain a specified number of null elements.
-
SList(int, Object)
- Construct myself to contain a specified number of elements set to
a particular object.
-
SList(SList)
- Construct myself to be a shallow copy of an existing SList.
-
add(Object)
- Add an object after my last element.
-
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(SList)
- Become a shallow copy of an existing SList.
-
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.
-
count(SListIterator, SListIterator, Object)
- Return the number of objects within a specified range of that match a
particular value.
-
elements()
- Return an Enumeration to my components.
-
end()
- Return an iterator positioned immediately after my last item.
-
equals(Object)
- Return true if I'm equal to another object.
-
equals(SList)
- Return true if I contain the same items in the same order as
another SList.
-
find(Object)
- Return an iterator positioned at the first object that matches a particular value, or
end() if the object is not found.
-
find(SListIterator, SListIterator, Object)
- Return an iterator positioned at the first object within a specified range that
match a particular object, 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 the index of the first object within a specified range that
match 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(int, int, Object)
- Insert multiple objects at a particular index.
-
insert(int, Object)
- Insert an object at a particular index.
-
insert(SListIterator, InputIterator, InputIterator)
- Insert a sequence of objects at a particular location.
-
insert(SListIterator, int, Object)
- Insert multiple objects at a particular position.
-
insert(SListIterator, Object)
- Insert an object at a particular position and return an iterator
positioned at the new element.
-
isEmpty()
- Return true if I contain no entries.
-
maxSize()
- Return the maximum number of entries that I can contain.
-
popBack()
- Remove my last element.
-
popFront()
- Remove 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 in the specified range.
-
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(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.
-
replace(SListIterator, SListIterator, 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.
-
size()
- Return the number of entries that I contain.
-
splice(int, SList)
- Remove all of the elements in a specified list and insert them at a particular
index.
-
splice(int, SList, int)
- Remove a specified element from a list and insert it at a particular position.
-
splice(int, SList, int, int)
- Remove a range of elements from a list and insert them at a particular position.
-
splice(SListIterator, SList)
- Remove all of the elements in a specified list and insert them at a particular
position.
-
splice(SListIterator, SList, SListIterator)
- Remove a specified element from a list and insert it at a particular position.
-
splice(SListIterator, SList, SListIterator, SListIterator)
- Remove a range of elements from a list and insert them at a particular position.
-
start()
- Return an iterator positioned at my first item.
-
swap(SList)
- Swap my contents with another SList.
-
toString()
- Return a string that describes me.
SList
public SList()
- Construct myself to be an empty SList.
SList
public SList(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.
SList
public SList(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.
SList
public SList(SList list)
- Construct myself to be a shallow copy of an existing SList.
- Parameters:
- list - The SList 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(SList list)
- Return true if I contain the same items in the same order as
another SList. Use equals() to compare the individual elements.
- Parameters:
- list - The SList 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
begin
public synchronized SListIterator begin()
- Return an iterator positioned at my first item.
end
public synchronized SListIterator end()
- Return an iterator positioned immediately after my last item.
elements
public synchronized Enumeration elements()
- Return an Enumeration to my components.
start
public ForwardIterator start()
- Return an iterator positioned at my first item.
finish
public ForwardIterator finish()
- Return an iterator positioned immediately afer my last item.
copy
public synchronized void copy(SList list)
- Become a shallow copy of an existing SList.
- Parameters:
- list - The SList 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 SListIterator insert(SListIterator 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(SListIterator 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.
- n - The number of objects to insert.
- object - The object to insert.
- Throws: IndexOutOfBoundsException
- If the index is invalid.
insert
public synchronized void insert(SListIterator 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 SList is empty.
front
public synchronized Object front()
- Return my first item.
- Throws: InvalidOperationException
- If the SList is empty.
clear
public synchronized void clear()
- Remove all of my elements.
popBack
public synchronized Object popBack()
- Remove my last element.
- Throws: InvalidOperationException
- If the SList 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 my first element.
- Throws: InvalidOperationException
- If the SList is empty.
add
public synchronized Object add(Object object)
- Add an object after my last element.
This function is a synonym for pushBack().
- Parameters:
- object - The object to add.
pushBack
public void pushBack(Object object)
- Add an object after my last element.
- Parameters:
- The - object to add.
swap
public synchronized void swap(SList list)
- Swap my contents with another SList.
- Parameters:
- list - The SList 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
SListIterator for this SList 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 last object to remove.
- object - The object to remove.
- Throws: IndexOutOfBoundsException
- If either index is invalid.
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(SListIterator first,
SListIterator 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 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(SListIterator first,
SListIterator 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 SListIterator 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 SListIterator find(SListIterator first,
SListIterator last,
Object object)
- Return an iterator positioned at the first object within a specified range that
match 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 the index of the first object within a specified range that
match 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.
remove
public synchronized Object remove(Enumeration pos)
- Remove the element at a particular position.
- Parameters:
- pos - An Enumeration positioned at the element to remove.
- Throws: IllegalArgumentException
- is the Enumeration isn't a
SListIterator for this SList object.
remove
public synchronized Object remove(int index)
- Remove the element at a particular index.
- Parameters:
- index - The index of the element to remove.
- Throws: IndexOutOfBoundsException
- If the 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.
- Throws: IllegalArgumentException
- is the Enumeration isn't a
SListIterator for this SList object.
remove
public synchronized int remove(int first,
int last)
- Remove the elements in the specified range.
- Parameters:
- first - The index of the first element to remove.
- last - The index of the last element to remove.
- Throws: IndexOutOfBoundsException
- If either index is invalid.
splice
public synchronized void splice(SListIterator pos,
SList list)
- Remove all of the elements in a specified list and insert them at a particular
position.
- Parameters:
- pos - The position to insert the elements.
- list - The list to splice the elements from.
splice
public synchronized void splice(int index,
SList list)
- Remove all of the elements in a specified list and insert them at a particular
index.
- Parameters:
- index - The index of the item that the elements should be inserted immediately before.
- list - The list to splice the elements from.
- Throws: IndexOutOfBoundsException
- If the index is invalid.
splice
public synchronized void splice(SListIterator to,
SList list,
SListIterator from)
- Remove a specified element from a list and insert it at a particular position.
- Parameters:
- to - The position to insert the element.
- list - The list to splice the element from.
- from - The position of the element to remove.
splice
public synchronized void splice(int to,
SList list,
int from)
- Remove a specified element from a list and insert it at a particular position.
- Parameters:
- to - The index of the item that the element should be inserted immediately before.
- list - The list to splice the element from.
- from - The index of the element to remove.
- Throws: IndexOutOfBoundsException
- If either index is invalid.
splice
public synchronized void splice(SListIterator pos,
SList list,
SListIterator first,
SListIterator last)
- Remove a range of elements from a list and insert them at 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 remove.
- last - An iterator positioned immediately after the last element to remove.
splice
public synchronized void splice(int pos,
SList list,
int first,
int last)
- Remove a range of elements from a list and insert them at a particular position.
- Parameters:
- pos - The index of the item that the elements should be inserted immediately before.
- list - The list to splice the elements from.
- first - The index of the first element to remove.
- last - The index of the last element to remove.
- Throws: IndexOutOfBoundsException
- If any index is invalid.
All Packages Class Hierarchy This Package Previous Next Index