|
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.AbstractDatedSet<E,D>
E
- the type of elements maintained by this dated setD
- the type of dates used by this dated setpublic abstract class AbstractDatedSet<E,D>
A partial implementation of a dated set. This class provides an implementation
of equals(D,DatedObject,D)
and
hashCode(D)
that satisfies the contracts
specified in DatedSet
.
DatedSet
,
HashSetByDate
,
HashSetByElement
,
TreeSetByDate
,
TreeSetByElement
Constructor Summary | |
---|---|
protected |
AbstractDatedSet()
No-argument constructor available to subclasses only. |
Method Summary | |
---|---|
boolean |
equals(D date,
DatedObject<D> obj,
D objDate)
Indicates if this dated object at at is equal to
obj at objAt . |
int |
hashCode(D date)
Returns a hash code value of this dated object 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 sos.dated.util.AbstractDatedObject |
---|
dateIterator, equals, hashCode, 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 |
Methods inherited from interface sos.dated.util.DatedObject |
---|
dateIterator, dateIterator, equals, hashCode, toString |
Constructor Detail |
---|
protected AbstractDatedSet()
Method Detail |
---|
public boolean equals(D date, DatedObject<D> obj, D objDate)
at
is equal to
obj
at objAt
.
This implementation uses object identity to determine equality. In other
words, it returns true
if
this == obj && date.equals( objDate )Subclasses should override this method to impose a weaker equality condition.
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.
equals
in interface DatedObject<D>
equals
in interface DatedSet<E,D>
equals
in class AbstractDatedObject<D>
date
- 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 at
equals
another dated object at objAt
java.lang.NullPointerException
- if any argument is null
public int hashCode(D date)
o1
and o2
and two dates
d1
and d2
, if
o1.equals( d1, o2, d2 )
returns true
,
then o1.hashCode( d1 )
must equal o2.hashCode( d2 )
.
This implementation returns the identity hash code value of this dated
object.
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.
hashCode
in interface DatedObject<D>
hashCode
in interface DatedSet<E,D>
hashCode
in class AbstractDatedObject<D>
date
- date to which the hash code value should correspond
java.lang.NullPointerException
- if if at
is null
|
Side of Software Dated Collections Library 2.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |