|
Side of Software Dated Collections Library 2.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sos.dated.util.AbstractDatedObject<D> sos.dated.util.AbstractDatedCollection<E,D> sos.dated.util.AbstractDatedList<E,D> sos.dated.util.AbstractSequentialDatedList<E,D>
E
- the type of elements maintained by this dated listD
- the type of dates used by this dated listpublic abstract class AbstractSequentialDatedList<E,D>
A partial implementation of a dated list that does not provide random access to its elements at a given date. The purpose of this class is to make it easier to implement a sequential dated list. All of the methods implemented in this class operate on the list iterator, which is defined by a subclass.
To create an unmodifiable list, the programmer can subclass this class and implement listIterator(int). The list iterator returned by this method need only define the query methods: hasNext, hasPrevious, next, nextIndex, previous, and previousIndex. The remaining methods should throw UnsupportedOperationExceptions.
To create a modifiable list, the programmer must implement the above methods that throw UnsupportedOperationExceptions.
Upon subclassing this class, the programmer may wish to override those methods that can be implemented more efficiently with knowledge of the underlying data structure.
This class is not Serializable or Cloneable. Subclasses are free to decide if they wish to implement these interfaces.
AbstractDatedList
,
DatedList
Constructor Summary | |
---|---|
protected |
AbstractSequentialDatedList()
No-argument constructor available only to subclasses. |
Method Summary | |
---|---|
void |
add(int index,
E value,
D from,
D to)
Inserts an element into this dated list for a specified date range (optional operation). |
E |
get(int index,
D date)
Retrieves the element at the specified position on the specified date. |
abstract ListIterator<E,D> |
listIterator(int index,
D date)
Returns a list iterator over the elements of this dated list at the specified date, starting at the specified index. |
DatedValue<E,D> |
remove(int index,
D from,
D to)
Removes from this dated list the element at the specified position for the specified date range (optional operation). |
DatedValue<E,D> |
set(int index,
E value,
D from,
D to)
Replaces the element at the specified position with the specified element for the specified date range. |
Methods inherited from class sos.dated.util.AbstractDatedList |
---|
add, addAll, checkForComodification, clear, clone, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, modCount, removeRange, size, subList, upModCount |
Methods inherited from class sos.dated.util.AbstractDatedCollection |
---|
addAll, contains, containsAll, containsThroughout, dateIterator, excludesThroughout, hasSizeThroughout, isEmpty, isEmptyThroughout, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class sos.dated.util.AbstractDatedObject |
---|
dateIterator, equals, hashCode, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface sos.dated.util.DatedCollection |
---|
addAll, contains, containsAll, containsThroughout, excludesThroughout, hasSizeThroughout, isEmpty, isEmptyThroughout, remove, removeAll, retainAll, toArray, toArray |
Methods inherited from interface sos.dated.util.DatedObject |
---|
dateIterator, dateIterator, equals, hashCode, toString |
Constructor Detail |
---|
protected AbstractSequentialDatedList()
Method Detail |
---|
public void add(int index, E value, D from, D to)
add
method
for each list iterator at a change date between from and to.
add
in interface DatedList<E,D>
add
in class AbstractDatedList<E,D>
index
- position to insert the elementvalue
- element to insertfrom
- starting date (inclusive) at which the element should be insertedto
- ending date (exclusive) at which the element should be inserted
java.lang.ClassCastException
- if the underlying type of value
prevents it from
being added to this dated list
java.lang.IllegalArgumentException
- if from
does not precede to
or if some property of value
prevents it from being added to this dated list
java.lang.IndexOutOfBoundsException
- if index < 0 || index > size( d )
where d
is a date between from
and to
java.lang.NullPointerException
- if from
or to
is null
or if value
is null
and this dated list cannot hold null elements
java.lang.UnsupportedOperationException
- if the list iterator does not support add
public E get(int index, D date)
get
in interface DatedList<E,D>
get
in class AbstractDatedList<E,D>
index
- position to retrieve an elementdate
- date at which this dated list is to be queried
java.lang.IndexOutOfBoundsException
- if index < 0 || index >= size( at )
java.lang.NullPointerException
- if at
is null
public abstract ListIterator<E,D> listIterator(int index, D date)
AbstractDatedList
listIterator
in interface DatedList<E,D>
listIterator
in class AbstractDatedList<E,D>
index
- position at which to start the iterationdate
- date at which to iterate over the elements of this dated list
public DatedValue<E,D> remove(int index, D from, D to)
UnsupportedOperationException
.
This implementation invokes remove
on the list iterator at each
change date between from
and to
.
remove
in interface DatedList<E,D>
remove
in class AbstractDatedList<E,D>
index
- position at which to start the iterationfrom
- starting date (inclusive) at which the element should be removedto
- ending date (exclusive) at which the element should be removed
java.lang.IllegalArgumentException
- if from
does not precede to
java.lang.IndexOutOfBoundsException
- if index < 0 || index >= size( d )
where d
is a date within the specified range
java.lang.NullPointerException
- if from
or to
is null
java.lang.UnsupportedOperationException
- if the list iterator does not support remove
public DatedValue<E,D> set(int index, E value, D from, D to)
set
on the list iterator at each
change date between from
and to
.
set
in interface DatedList<E,D>
set
in class AbstractDatedList<E,D>
index
- position of the element to replacevalue
- element to place in this listfrom
- starting date (inclusive) at which the position should be setto
- ending date (exclusive) at which the position should be set
java.lang.ClassCastException
- if the underlying type of value
prevents it from
being added to this dated list
java.lang.IllegalArgumentException
- if from
does not precede to
or if some property of value
prevents it from being added to this dated list
java.lang.IndexOutOfBoundsException
- if this dated list does not contain index + 1
elements throughout the specified date range
java.lang.NullPointerException
- if from
or to
is null
or if value
is null
and this dated list cannot hold null elements
java.lang.UnsupportedOperationException
- if the list iterator does not support set
|
Side of Software Dated Collections Library 2.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |