|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--sos.dated.util.AbstractDatedObject
|
+--sos.dated.util.AbstractDatedCollection
|
+--sos.dated.util.AbstractDatedList
A partial implementation of a dated list. The purpose of this class is
to make it easier to create a concrete DatedList and to
share implementation
common across concrete classes. It provides an implementation of
iterator.
To create an unmodifiable dated list, the
programmer can subclass this class and implement the dateIterator,
get, and size methods.
To create a modifiable version, the programmer must also override the
set, add, and remove methods.
AbstractDatedCollection,
DatedList,
ArrayListByDate,
ArrayListByElement| Field Summary |
| Fields inherited from interface sos.dated.util.DatedObject |
MAX_DATE, MIN_DATE |
| Constructor Summary | |
protected |
AbstractDatedList()
No-argument constructor available only to subclasses. |
| Method Summary | |
void |
add(int index,
java.lang.Object value,
java.util.Date from,
java.util.Date to)
Inserts an element into the list for a specified date range (optional operation). |
Dates |
add(java.lang.Object value,
java.util.Date from,
java.util.Date to)
This implementation invokes add(int,Object,Date,Date) for each static window within the specified range, passing it the size of this list at the start of the window as given by size. |
Dates |
addAll(int index,
DatedCollection datedCollection)
Inserts an entire dated collection into this dated list at the specified index (optional operation). |
protected void |
checkForComodification(int expectedModCount,
java.util.Date date)
Throws a ConcurrentModificationException if the expected modification count does not equal the actual modification count for the specified date. |
void |
clear(java.util.Date from,
java.util.Date to)
Removes all elements from this dated collection for the specified dates (optional operation). |
protected java.lang.Object |
clone()
Creates and returns a copy of this object. |
boolean |
equals(java.util.Date date,
DatedObject obj,
java.util.Date objDate)
Indicates if this dated object at date is equal to
obj at objDate. |
abstract java.lang.Object |
get(int index,
java.util.Date date)
Retrieves the element at the specified position on the specified date. |
int |
hashCode(java.util.Date date)
This implementation merely iterates through the elements of this dated list at the specified date, computing the hash code value as required. |
int |
indexOf(java.lang.Object value,
java.util.Date date)
Returns the position of the first occurrence of the specified element in this list at the specified date. |
Iterator |
iterator(java.util.Date date)
Returns an iterator over the elements of this dated collection at the specified date. |
int |
lastIndexOf(java.lang.Object value,
java.util.Date date)
Returns the position of the last occurrence of the specified element in this list at the specified date. |
ListIterator |
listIterator(java.util.Date date)
Returns a list iterator over the elements of this dated list at the specified date. |
ListIterator |
listIterator(int index,
java.util.Date date)
Returns a list iterator over the elements of this dated list at the specified date, starting at the specified index. |
protected int |
modCount(java.util.Date date)
Returns the modification count at the specified date. |
DatedValue |
remove(int index,
java.util.Date from,
java.util.Date to)
Removes from this list the element at the specified position for the specified date range (optional operation). |
protected void |
removeRange(int fromIndex,
int toIndex,
java.util.Date from,
java.util.Date to)
Removes all elements between fromIndex, inclusive, and
toIndex, exclusive, for the specified date range. |
DatedValue |
set(int index,
java.lang.Object value,
java.util.Date from,
java.util.Date to)
Replaces the element at the specified position with the specified element for the specified date range. |
abstract int |
size(java.util.Date date)
Returns the number of elements in this collection at the specified date. |
DatedList |
subList(int fromIndex,
int toIndex)
Returns a view of this dated list restricted to the range fromIndex,
inclusive, to toIndex, exclusive. |
protected void |
upModCount(java.util.Date from,
java.util.Date to)
|
| 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 AbstractDatedList()
| Method Detail |
public Dates add(java.lang.Object value,
java.util.Date from,
java.util.Date to)
add in interface DatedCollectionadd in class AbstractDatedCollectionvalue - element to addfrom - starting date at which the element should be addedto - ending date at which the element should be added
java.lang.NullPointerException - if from or to is null
java.lang.IllegalArgumentException
public void add(int index,
java.lang.Object value,
java.util.Date from,
java.util.Date to)
add in interface DatedListindex - position to insert the elementvalue - element to insertfrom - starting date at which the element should be insertedto - ending date at which the element should be inserted
java.lang.UnsupportedOperationException - always
public Dates addAll(int index,
DatedCollection datedCollection)
addAll in interface DatedListindex - index at which to insert the dated collectiondatedCollection - collection to insert into this dated list
java.lang.IndexOutOfBoundsException - if index < 0 || index > size( d ) where
d is a date when elements exist in datedCollection
java.lang.NullPointerException - datedCollection is null
protected void checkForComodification(int expectedModCount,
java.util.Date date)
expectedModCount - the caller's expected modification countdate - the date in question
java.util.ConcurrentModificationException - if the expected modification
count does not equal the actual modification count for the specified date
public void clear(java.util.Date from,
java.util.Date to)
This implementation invokes removeRange for each static window within the specified date range, passing in the size of the list at the start of the window, as gotten from a call to size.
clear in interface DatedCollectionclear in class AbstractDatedCollectionfrom - date to start clearing the collection, inclusiveto - date to finish clearing the collection, exclusive
java.lang.NullPointerException - if from or to is null
java.lang.IllegalArgumentException - if from does not precede to
protected java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone method.
clone in class java.lang.Objectjava.lang.CloneNotSupportedException - if this object's class does not
support the Cloneable interface.
public boolean equals(java.util.Date date,
DatedObject obj,
java.util.Date objDate)
DatedObjectdate is equal to
obj at objDate.
equals in interface DatedListequals in class AbstractDatedObjectdate - date at which this object should be testedobj - the other dated object to be compared toobjDate - the date of the other dated object
true if this dated object at date equals
another dated object at objDate
java.lang.NullPointerException - if any of the parameters equal null
public abstract java.lang.Object get(int index,
java.util.Date date)
DatedList
get in interface DatedListindex - position to retrieve an elementdate - date at which this list is to be queried
public int hashCode(java.util.Date date)
hashCode in interface DatedListhashCode in class AbstractDatedObjectdate - date to which the value should correspond
java.lang.NullPointerException - if date is null
public int indexOf(java.lang.Object value,
java.util.Date date)
indexOf in interface DatedListvalue - element whose presence is to be testeddate -
java.lang.NullPointerException - if date is nullpublic Iterator iterator(java.util.Date date)
UnsupportedOperationException in its remove
method because a date range is required to remove an element from
this dated collection.
This implementation returns listIterator( date ).
iterator in interface DatedCollectioniterator in class AbstractDatedCollectiondate - date at which to iterate through the elements
java.lang.NullPointerException
public int lastIndexOf(java.lang.Object value,
java.util.Date date)
lastIndexOf in interface DatedListvalue - element whose presence is to be testeddate -
java.lang.NullPointerException - if date is nullpublic ListIterator listIterator(java.util.Date date)
listIterator( 0, date ).
listIterator in interface DatedListdate - date at which to iterate over the elements of this dated list
java.lang.NullPointerException - if date is null
public ListIterator listIterator(int index,
java.util.Date date)
listIterator in interface DatedListindex - position at which to start the iterationdate - date at which to iterate over the elements of this dated list
java.lang.NullPointerException - if date is nullprotected int modCount(java.util.Date date)
date. If assertions are not enabled, the returned
value is always zero.
date - date to request the modification count
public DatedValue remove(int index,
java.util.Date from,
java.util.Date to)
UnsupportedOperationException.
remove in interface DatedListindex - position at which to start the iterationfrom - starting date at which the element should be removedto - ending date at which the element should be removed
java.lang.UnsupportedOperationException - always
protected void removeRange(int fromIndex,
int toIndex,
java.util.Date from,
java.util.Date to)
fromIndex, inclusive, and
toIndex, exclusive, for the specified date range. The dated
list is constant in the date range.
This implementaion gets a list iterator at from,
starting at fromIndex. It then iterates through the
elements up to toIndex,
invoking remove(from,to). Subclasses may
override this method to make it more efficient for the particular
implementation.
fromIndex - start index of elements to removetoIndex - end index of elements to removefrom - start date (inclusive) for which the elements should be removedto - end date (exclusive) for which the elements should be removed
public DatedValue set(int index,
java.lang.Object value,
java.util.Date from,
java.util.Date to)
set in interface DatedListindex - position to place the elementvalue - element to place in this listfrom - starting date at which the position should be setto - ending date at which the position should be set
java.lang.UnsupportedOperationException - alwayspublic abstract int size(java.util.Date date)
DatedCollection
size in interface DatedCollectionsize in class AbstractDatedCollectiondate - date at which this collection is to be queried
public DatedList subList(int fromIndex,
int toIndex)
fromIndex,
inclusive, to toIndex, exclusive. Changes made to the returned
sub list are reflected in the master list, and vice versa.
This implementation returns a fully operational sublist. The sublist implements
RandomAccess if this dated list implements RandomAccess.
subList in interface DatedListfromIndex - starting position of the returned view (inclusive)toIndex - ending position of the returned view (exclusive)
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException
protected void upModCount(java.util.Date from,
java.util.Date to)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||