|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
A list of elements over time.
The following table compares the efficiencies of the two implementations
in this package. Each cell is the average big-Oh notation, where T denotes the
number of dates in the map and N denotes the number of elements at any given
date.
The interface is based on the interface
ArrayListByDate ArrayListByElement add T*N T (amortized) add(i) T*N T*N clear T T*N contains log(T)+N log(T)*N containsThroughout T*N T*N dateIterator log(T) T*N get log(T) log(T) hashCode T*N T*N hashCode(d) log(T)+N log(T)*N indexOf log(T)+N log(T)*N iterator log(T) log(T) lastIndexOf log(T)+N log(T)*N listIterator log(T) log(T) remove T*N T*N remove(i) T*N T*N set T*N T size log(T) log(T) java.util.List. This interface does not extend java.util.List directly
because at least one date is needed. To make a dated list appear
like a non-dated list, use Adapters.asList(DatedList,Date).
Similarly, to treat a non-dated collection as dated, use
Adapters.asDatedList(List,Date,Date).
ArrayListByDate,
ArrayListByElement,
Adapters.asList(DatedList,Date),
Adapters.asDatedList(List,Date,Date)| Field Summary |
| Fields inherited from interface sos.dated.util.DatedObject |
MAX_DATE, MIN_DATE |
| 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 |
addAll(int index,
DatedCollection datedCollection)
Inserts an entire dated collection into this dated list at the specified index (optional operation). |
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. |
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)
Returns a hash code value of this dated list at the specified date. |
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. |
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. |
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). |
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. |
DatedList |
subList(int fromIndex,
int toIndex)
Returns a view of this dated list restricted to the range fromIndex,
inclusive, to toIndex, exclusive. |
| Methods inherited from interface sos.dated.util.DatedCollection |
add, addAll, clear, contains, containsAll, containsThroughout, excludesThroughout, hasSizeThroughout, isEmpty, isEmptyThroughout, iterator, remove, removeAll, retainAll, size, toArray, toArray |
| Methods inherited from interface sos.dated.util.DatedObject |
dateIterator, dateIterator, equals, hashCode, toString |
| Method Detail |
public void add(int index,
java.lang.Object value,
java.util.Date from,
java.util.Date to)
index - 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.NullPointerException - if from or to is null
java.lang.UnsupportedOperationException - if this collection does not support add
java.lang.IllegalArgumentException - if index < 0
public Dates addAll(int index,
DatedCollection datedCollection)
index - 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
public boolean equals(java.util.Date date,
DatedObject obj,
java.util.Date objDate)
DatedObjectdate is equal to
obj at objDate.
equals in interface DatedObjectdate - 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
public java.lang.Object get(int index,
java.util.Date date)
index - position to retrieve an elementdate - date at which this list is to be queried
java.lang.NullPointerException - if date is null
java.lang.IllegalArgumentException - if index < 0public int hashCode(java.util.Date date)
DatedList at a date is calculated the same way as in
hashCode of java.util.List.
hashCode in interface DatedObjectdate - 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)
value - element whose presence is to be testeddate -
java.lang.NullPointerException - if date is null
public int lastIndexOf(java.lang.Object value,
java.util.Date date)
value - element whose presence is to be testeddate -
java.lang.NullPointerException - if date is nullpublic ListIterator listIterator(java.util.Date date)
date - 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)
index - 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 null
java.lang.IndexOutOfBoundsException - if index < 0 || index >= size( date )
public DatedValue remove(int index,
java.util.Date from,
java.util.Date to)
index - 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.NullPointerException - if from or to is null
java.lang.UnsupportedOperationException - if this collection does not support remove
java.lang.IllegalArgumentException - if index < 0
public DatedValue set(int index,
java.lang.Object value,
java.util.Date from,
java.util.Date to)
index - 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.NullPointerException - if from or to is null
java.lang.UnsupportedOperationException - if this collection does not support set
java.lang.IllegalArgumentException
java.lang.IndexOutOfBoundsException - if this dated list does not contain index +1
elements throughout the specified date range
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.
fromIndex - starting position of the returned view (inclusive)toIndex - ending position of the returned view (exclusive)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||