|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList
danbikel.util.AbstractFixedSizeList
public abstract class AbstractFixedSizeList
Provides a convenient default implementation for most of the methods of
List
and FixedSizeList
.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
protected |
AbstractFixedSizeList()
No-arg constructor, for use only for Serialization of derived, concrete classes. |
protected |
AbstractFixedSizeList(Collection c)
Initializes this new list to contain all elements of the specified collection. |
protected |
AbstractFixedSizeList(int size)
Initializes this new list to have the specified number of elements. |
Method Summary | |
---|---|
boolean |
add(Object obj)
A synonym for FixedSizeList.shift(Object) . |
boolean |
addAll(Collection c)
Sets the first n elements of this list to be the elements of the specified collection, where n is the minimum of the size of the collection and the (fixed) size of this list. |
boolean |
addAll(int index,
Collection c)
Implementors should simply throw an UnsupportedOperationException . |
boolean |
equals(Object o)
Compres this FixedSizeList to the specified object
for equality. |
int |
hashCode()
Generates a hash code for this list. |
protected abstract void |
initialize(int size)
Initializes this list to be of the specified size. |
boolean |
removeAll(Collection c)
Implementors should simply throw an UnsupportedOperationException . |
abstract Object |
set(int index,
Object element)
Sets the specified object to be at the specified index in this fixed-size list. |
abstract boolean |
shift(Object obj)
Shifts the specified object to the beginning of the list, that is, causes the specified object to be the value at index 0, causes the object at index size() - 1 to be removed and causes the index of all other objects to be increased by 1. |
Methods inherited from class java.util.AbstractList |
---|
add, clear, get, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList |
Methods inherited from class java.util.AbstractCollection |
---|
contains, containsAll, isEmpty, remove, retainAll, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface danbikel.util.FixedSizeList |
---|
add, clear, remove, remove, retainAll |
Methods inherited from interface java.util.List |
---|
contains, containsAll, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, size, subList, toArray, toArray |
Constructor Detail |
---|
protected AbstractFixedSizeList()
protected AbstractFixedSizeList(int size)
FixedSizeList
, all elements will
initially be null
.
size
- the number of elements that this fixed-size list will haveprotected AbstractFixedSizeList(Collection c)
c
- a collection whose elements are to become the elements of this
fixed-size listMethod Detail |
---|
protected abstract void initialize(int size)
FixedSizeList
, all elements will initially be
null
. Implementors should take care not to invoke this
method subsequent to construction of a fixed-size list, as such an
invocation would violate the general contract of FixedSizeList
.
size
- the size of this listpublic boolean add(Object obj)
FixedSizeList
FixedSizeList.shift(Object)
.
add
in interface FixedSizeList
add
in interface Collection
add
in interface List
add
in class AbstractList
obj
- the object to be shifted into the first position of this list
Collection.add
method)public boolean addAll(Collection c)
FixedSizeList
addAll
in interface FixedSizeList
addAll
in interface Collection
addAll
in interface List
addAll
in class AbstractCollection
c
- the collection whose elements are to become the elements of
this list
public boolean addAll(int index, Collection c)
FixedSizeList
UnsupportedOperationException
.
addAll
in interface FixedSizeList
addAll
in interface List
addAll
in class AbstractList
public boolean removeAll(Collection c)
FixedSizeList
UnsupportedOperationException
.
removeAll
in interface FixedSizeList
removeAll
in interface Collection
removeAll
in interface List
removeAll
in class AbstractCollection
public abstract Object set(int index, Object element)
set
in interface List
set
in class AbstractList
index
- the index at which to set the specified objectelement
- the object to be set at the specified index
public abstract boolean shift(Object obj)
FixedSizeList
Implementation advice: This method may be implemented to take constant (that is, O(1)) time if the employed data struture is a circular buffer.
shift
in interface FixedSizeList
obj
- the object to be shifted into this list
Collection.add
method)public boolean equals(Object o)
FixedSizeList
to the specified object
for equality. This implementation assumes that the get(int)
and size()
methods take constant time.
equals
in interface Collection
equals
in interface List
equals
in class AbstractList
o
- the object to test for equality with this object
public int hashCode()
get(int)
and size()
methods take constant
time.
hashCode
in interface Collection
hashCode
in interface List
hashCode
in class AbstractList
|
Parsing Engine | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |