sos.dated.util
Class AbstractDatedSet
java.lang.Object
|
+--sos.dated.util.AbstractDatedObject
|
+--sos.dated.util.AbstractDatedCollection
|
+--sos.dated.util.AbstractDatedSet
- All Implemented Interfaces:
- DatedCollection, DatedObject, DatedSet
- Direct Known Subclasses:
- sos.dated.util.AbstractMapBackedSet
- public abstract class AbstractDatedSet
- extends AbstractDatedCollection
- implements DatedSet
A partial implementation of a dated set. This class provides an implementation
of equals(Date,DatedObject,Date) and
hashCode(Date) that satisfies the contracts
specified in DatedSet.
- Since:
- 1.0
- See Also:
DatedSet,
HashSetByDate,
HashSetByElement,
TreeSetByDate,
TreeSetByElement
|
Constructor Summary |
protected |
AbstractDatedSet()
No-argument constructor available to subclasses only. |
|
Method Summary |
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. |
int |
hashCode(java.util.Date date)
Returns a hash code value of this dated set at the specified date. |
| Methods inherited from class sos.dated.util.AbstractDatedCollection |
add, addAll, clear, contains, containsAll, containsThroughout, dateIterator, excludesThroughout, hasSizeThroughout, isEmpty, isEmptyThroughout, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| 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 |
AbstractDatedSet
protected AbstractDatedSet()
- No-argument constructor available to subclasses only.
equals
public 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.
Two sets are equivalent at the specified dates if their sizes
are equal and one set contains all elements of the other set.
Once this implementation has checked reference equality and verified that
the argument is of type DatedSet, it checks if the sizes of this set and
the set passed in are equal. If not, it iterates through the elements of
obj at objDate, checking if this set contains the elements at date.
- Specified by:
equals in interface DatedSet- Overrides:
equals in class AbstractDatedObject
- Parameters:
date - date at which this object should be testedobj - the other dated object to be compared toobjDate - the date of the other dated object
- Returns:
true if this dated object at date equals
another dated object at objDate
- Throws:
java.lang.NullPointerException - if any argument is null
hashCode
public int hashCode(java.util.Date date)
- Returns a hash code value of this dated set at the specified date.
The hash code of a
DatedSet at a date is calculated the same way as in
hashCode of java.util.Set.
This implementation iterates through the elements of this dated set at
the specified date and sums the hash code values of the elements.
- Specified by:
hashCode in interface DatedSet- Overrides:
hashCode in class AbstractDatedObject
- Parameters:
date - date to which the value should correspond
- Returns:
- the hash code value of this dated object at the specified date
- Throws:
java.lang.NullPointerException - if date is null
Copyright 2003 Side of Software (SOS). All rights reserved.