|
|||||||||
| 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.AbstractDatedMap
A partial implementation of a dated map. This class is designed
to make it easier to implement the DatedMap interface. To create an unmodifiable
dated map, the client should subclass this class and implement entrySet.
The set returned by this method should be unmodifiable as well. To
create a modifiable dated map, the client should subclass this class,
implement the put method, and return an entry set that supports
clear and has an iterator that supports remove.
DatedMap| Nested Class Summary |
| Nested classes inherited from class sos.dated.util.DatedMap |
DatedMap.Entry |
| Field Summary |
| Fields inherited from interface sos.dated.util.DatedObject |
MAX_DATE, MIN_DATE |
| Constructor Summary | |
protected |
AbstractDatedMap()
No-argument constructor available only to subclasses. |
| Method Summary | |
void |
clear(java.util.Date from,
java.util.Date to)
Removes all mappings from this dated map for the specified date range. |
protected java.lang.Object |
clone()
Creates and returns a copy of this object. |
boolean |
containsKey(java.lang.Object key,
java.util.Date date)
Returns true if this dated map contains the specified key at the
specified date. |
boolean |
containsKeyThroughout(java.lang.Object key,
java.util.Date from,
java.util.Date to)
Returns true if this dated map contains the specified key
throughout the specified date range. |
boolean |
containsValue(java.lang.Object value,
java.util.Date date)
Returns true if any key maps to the specified value at the
specified date. |
boolean |
containsValueThroughout(java.lang.Object value,
java.util.Date from,
java.util.Date to)
Returns true if a key maps to the specified value
throughout the specified date range. |
abstract DatedSet |
entrySet()
Returns a modifiable view of the mappings of this dated map. |
boolean |
equals(java.util.Date date,
DatedObject obj,
java.util.Date objDate)
Indicates if this dated map at date is equal to
obj at objDate. |
boolean |
excludesKeyThroughout(java.lang.Object key,
java.util.Date from,
java.util.Date to)
Returns true if this dated map does not contain the specified key
at any date within the specified date range. |
boolean |
excludesValueThroughout(java.lang.Object value,
java.util.Date from,
java.util.Date to)
Returns true if no key maps to the specified value
at any date within the specified date range. |
DatedValue |
get(java.lang.Object key)
Returns the values associated with the specified key for all dates. |
java.lang.Object |
get(java.lang.Object key,
java.util.Date date)
Retrieves the value associated with the specified key on the specified date. |
int |
hashCode(java.util.Date date)
Returns a hash code value of this dated map at the specified date. |
boolean |
hasSizeThroughout(int size,
java.util.Date from,
java.util.Date to)
Returns true if the size of this dated map is greater than or equal to
the specified size throughout the specified date range. |
boolean |
isEmpty(java.util.Date date)
Returns true if this map contains no mappings on the
specified date. |
boolean |
isEmptyThroughout(java.util.Date from,
java.util.Date to)
Returns true if this map contains no mappings throughout
the specified date range. |
DatedSet |
keySet()
Returns a modifiable view of the keys of this dated map. |
DatedValue |
put(java.lang.Object key,
java.lang.Object value,
java.util.Date from,
java.util.Date to)
Associates key with value in this dated map during
the specified date range. |
void |
putAll(DatedMap datedMap)
Places all mappings in datedMap into this dated map. |
DatedValue |
remove(java.lang.Object key,
java.util.Date from,
java.util.Date to)
Removes any values associated with the specified key in the specified date range. |
int |
size(java.util.Date date)
Returns the number of mappings in this dated map at the specified date. |
java.lang.String |
toString(java.util.Date date)
Returns a string representation of this dated map at the specified date. |
DatedCollection |
values()
Returns a view of the values mapped to keys in this dated map. |
| Methods inherited from class sos.dated.util.AbstractDatedObject |
dateIterator, 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.DatedObject |
dateIterator, dateIterator, equals, hashCode |
| Constructor Detail |
protected AbstractDatedMap()
| Method Detail |
public void clear(java.util.Date from,
java.util.Date to)
clear on the dated entry set.
clear in interface DatedMapfrom - starting date (inclusive) at which this map should be clearedto - ending date (exclusive) at which this map should be cleared
java.lang.NullPointerException - if any argument 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 containsKey(java.lang.Object key,
java.util.Date date)
true if this dated map contains the specified key at the
specified date.
This implementation iterates through the entries at the specified date,
returning true if the specified key is found.
containsKey in interface DatedMapkey - key whose presence is to be testeddate - date at which this map is to be queried
true if this dated map contains the specified key at the
specified date
java.lang.NullPointerException - if date is null
public boolean containsKeyThroughout(java.lang.Object key,
java.util.Date from,
java.util.Date to)
true if this dated map contains the specified key
throughout the specified date range.
This implementation uses the date iterator to iterate through this map's
changed states, calling containsKey at each date range.
containsKeyThroughout in interface DatedMapkey - key whose presence is to be testedfrom - starting date at which containment should be testedto - ending date at which containment should be tested
true if this dated map contains the specified key
throughout the specified date range
java.lang.NullPointerException - if from or to is null
java.lang.IllegalArgumentException - if from does not precede to
public boolean containsValue(java.lang.Object value,
java.util.Date date)
true if any key maps to the specified value at the
specified date.
This implementation iterates through the entries at the specified date
and returns true if it encounters the specified value.
containsValue in interface DatedMapvalue - value whose presence is to be testeddate - date at which this map is to be queried
true if any key maps to the specified value at the
specified date
java.lang.NullPointerException - if date is null
public boolean containsValueThroughout(java.lang.Object value,
java.util.Date from,
java.util.Date to)
true if a key maps to the specified value
throughout the specified date range.
This implementation invokes containsValue at the start of each
date range within from and to.
containsValueThroughout in interface DatedMapvalue - value whose presence is to be testedfrom - starting date (inclusive) at which containment should be testedto - ending date (exclusive) at which containment should be tested
true if a key maps to the specified value
throughout the specified date range
java.lang.NullPointerException - if from or to is null
java.lang.IllegalArgumentException - if from does not precede topublic abstract DatedSet entrySet()
DatedMap
entrySet in interface DatedMap
public boolean equals(java.util.Date date,
DatedObject obj,
java.util.Date objDate)
date is equal to
obj at objDate.
Two maps are equivalent if they contain the same mappings.
This implementation returns true if this dated map and obj are the same
references and if date equals objDate. Then it returns false if
obj does not implement DatedMap. Finally, it returns true if this map's
entry set and obj's entry set are equivalent at these dates.
equals in interface DatedMapequals 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 map at date equals
another dated object at objDate
java.lang.NullPointerException - if any argument is null
public boolean excludesKeyThroughout(java.lang.Object key,
java.util.Date from,
java.util.Date to)
true if this dated map does not contain the specified key
at any date within the specified date range.
This implementation uses the date iterator to iterate through this map's
changed states, calling containsKey at each date range.
excludesKeyThroughout in interface DatedMapkey - key whose presence is to be testedfrom - starting date (inclusive) at which exclusion should be testedto - ending date (exclusive) at which exclusion should be tested
true if this dated map does not contain key key
between from and to
java.lang.NullPointerException - if from or to is null
java.lang.IllegalArgumentException - if from does not precede to
public boolean excludesValueThroughout(java.lang.Object value,
java.util.Date from,
java.util.Date to)
true if no key maps to the specified value
at any date within the specified date range.
This implementation invokes containsValue at the start of each
date range within from and to.
excludesValueThroughout in interface DatedMapvalue - value whose presence is to be testedfrom - starting date (inclusive) at which exclusion should be testedto - ending date (exclusive) at which exclusion should be tested
true if no key maps to the value
at any date between from and to
java.lang.NullPointerException - if from or to is null
java.lang.IllegalArgumentException - if from does not precede topublic DatedValue get(java.lang.Object key)
put on this map. Setting
a value to null is not equivalent to removing the key from
this map. A null value may mean either that the key is associated with
null or that the key is not present in this map. (This behavior
is consistent with the specification of get in java.util.Map).
If this map does not support put, then set of the
dated value will throw an UnsupportedOperationException.
Iteration through the dates of the dated value may result in a
ConcurrentModificationException if this map's dates are altered during
the iteration.
This implementation returns a freshly constructed DatedValue
that invokes AbstractDatedMap.this.get(Object,Date) in response
to get(Date) and AbstractDatedMap.this.put(Object,Object,Date,Date)
in response to set(Object,Date,Date). The date iterator that
it returns is this map's date iterator adapted to ignore dates
that do not reflect a change in the key's mapping.
get in interface DatedMapkey - key whose values are to be returned
key
public java.lang.Object get(java.lang.Object key,
java.util.Date date)
get in interface DatedMapkey - key whose mapping is to be retrieveddate - date at which this map is to be queried
java.lang.NullPointerException - if date is nullpublic int hashCode(java.util.Date date)
DatedMap at a date is calculated the same way as in
hashCode of java.util.Map.
This implementation invokes hashCode(date) on the entry set.
hashCode in interface DatedMaphashCode in class AbstractDatedObjectdate - date to which the value should correspond
java.lang.NullPointerException - if date is null
public boolean hasSizeThroughout(int size,
java.util.Date from,
java.util.Date to)
true if the size of this dated map is greater than or equal to
the specified size throughout the specified date range.
This implementation invokes hasSizeThroughout(size,from,to) on the entry set.
hasSizeThroughout in interface DatedMapsize - number of mappings in questionfrom - starting date (inclusive) at which the size is to be comparedto - ending date (exclusive) at which the size is to be compared
true if this dated map has at least the specified size
throughout the specified date range
java.lang.NullPointerException - if from or to is null
java.lang.IllegalArgumentException - if size < 0 or if from
does not precede topublic boolean isEmpty(java.util.Date date)
true if this map contains no mappings on the
specified date.
This implementation invokes isEmpty(date) on the entry set.
isEmpty in interface DatedMapdate - date at which this map is to be queried
true if this map contains no mappings on the
specified date
java.lang.NullPointerException - if date is null
public boolean isEmptyThroughout(java.util.Date from,
java.util.Date to)
true if this map contains no mappings throughout
the specified date range.
This implementation invokes isEmptyThroughout(from,to) on the entry set.
isEmptyThroughout in interface DatedMapfrom - starting date of range (inclusive) to test for inclusionto - ending date of range (exclusive) to test for inclusion
true if this map contains no mappings in the
specified date range
java.lang.NullPointerException - if any of the parameters equal null
java.lang.IllegalArgumentException - if from does not precede topublic DatedSet keySet()
keySet in interface DatedMap
public DatedValue put(java.lang.Object key,
java.lang.Object value,
java.util.Date from,
java.util.Date to)
key with value in this dated map during
the specified date range.
This implementation throws an UnsupportedOperationException.
put in interface DatedMapkey - key to put in this dated mapvalue - value to map to the keyfrom - starting date of the range (inclusive) to put the mappingto - ending date of the range (exclusive) to put the mapping
public void putAll(DatedMap datedMap)
datedMap into this dated map. If this
dated map and the map passed in are connected in a way that the map
changes during any additions, this method is undefined. This means that this
method cannot handle this as the parameter.
This implementation iterates through the dates of datedMap, invoking
put for each mapping and date range defined in datedMap.
putAll in interface DatedMapdatedMap - mappings to put in this dated map
java.lang.NullPointerException - if datedMap is null
public DatedValue remove(java.lang.Object key,
java.util.Date from,
java.util.Date to)
from and to and invokes remove on the
iterator at the first occurrence of an entry with the key key.
remove in interface DatedMapkey - key indicating which mapping to removefrom - starting date of the range (inclusive) to remove the mappingto - ending date of the range (exclusive) to remove the mapping
public int size(java.util.Date date)
size(date) on the entry set.
size in interface DatedMapdate - date at which to return the size
java.lang.NullPointerException - if date is nullpublic java.lang.String toString(java.util.Date date)
toString(date) on the entry set.
toString in interface DatedObjecttoString in class AbstractDatedObjectdate - to which the string should correspond
java.lang.NullPointerException - if date is nullpublic DatedCollection values()
values in interface DatedMap
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||