|
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.Objectsos.dated.util.AbstractDatedObject<D>
D - the type of dates used by this dated objectpublic abstract class AbstractDatedObject<D>
A partial implementation of a dated object. This class
makes it easier to define a class that implements the DatedObject interface.
This abstract class provides generic implementations of
equals, hashCode,
toString, and dateIterator().
Subclasses must define dateIterator(Date) and
toString(Date).
DatedObject| Constructor Summary | |
|---|---|
protected |
AbstractDatedObject()
No-argument constructor available only to subclasses. |
| Method Summary | |
|---|---|
DateIterator<D> |
dateIterator()
Returns an iterator of the date ranges of when this dated object has changed. |
abstract DateIterator<D> |
dateIterator(D at)
Returns an iterator of the date ranges of when this dated object has changed, starting at the range that contains the specified date. |
boolean |
equals(D at,
DatedObject<D> obj,
D objAt)
Indicates if this dated object at at is equal to
obj at objAt. |
boolean |
equals(java.lang.Object obj)
Indicates if this dated object equals the specified object. |
int |
hashCode()
Returns the hash code value of this dated object. |
int |
hashCode(D at)
Returns a hash code value of this dated object at the specified date. |
java.lang.String |
toString()
Returns a string representation of this dated object. |
abstract java.lang.String |
toString(D at)
Returns a string representation of this dated object at the specified date. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected AbstractDatedObject()
| Method Detail |
|---|
public DateIterator<D> dateIterator()
dateIterator( null ).
This implementation simply invokes dateIterator(D),
passing null.
dateIterator in interface DatedObject<D>DatedObject.dateIterator(Object)public abstract DateIterator<D> dateIterator(D at)
DatedObjectnextFrom returns the
same date as previousTo.
Passing null as the argument will return an iterator positioned
at the beginning of the sequence.
dateIterator in interface DatedObject<D>at - date to position the iteration
public boolean equals(java.lang.Object obj)
DatedObjects are equal if they have the same dates and if they are equal
at each of these dates, as seen by equals(D,DatedObject,D).
If the parameter is not a DatedObject, this implementation
returns false.
Otherwise, it returns true if the dates of these objects
are equivalent and if these objects are equivalent at the dates.
equals in interface DatedObject<D>equals in class java.lang.Objectobj - object to compare this dated object to
true if this dated object equals the specified objectDatedObject.equals(Object,DatedObject,Object)
public boolean equals(D at,
DatedObject<D> obj,
D objAt)
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.
equals in interface DatedObject<D>at - date at which this object should be testedobj - the other dated object to be compared toobjAt - 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 nullpublic int hashCode()
hashCode = 0;
for each date d that a change in the object occurs
hashCode += d.hashCode() ^ hashCode( d )
hashCode in interface DatedObject<D>hashCode in class java.lang.Objectpublic int hashCode(D at)
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.
hashCode in interface DatedObject<D>at - date to which the hash code value should correspond
java.lang.NullPointerException - if at is nullpublic java.lang.String toString()
toString( d ).
After the last date change, no comma appears, and the string representation
is closed with a closing angle bracket ">".
toString in class java.lang.Objectpublic abstract java.lang.String toString(D at)
DatedObject
toString in interface DatedObject<D>at - date to which the string should correspond
|
Side of Software Dated Collections Library 2.0 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||