sos.dated.util
Interface DatedValue

All Superinterfaces:
DatedObject
All Known Implementing Classes:
AbstractDatedValue, ValueByDate

public interface DatedValue
extends DatedObject

A value over time. The DatedValue interface defines a reference that has a value dependent on time. Primitive values must be wrapped in their appropriate wrapper.

Since:
1.0
See Also:
ValueByDate

Field Summary
 
Fields inherited from interface sos.dated.util.DatedObject
MAX_DATE, MIN_DATE
 
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.
 java.lang.Object get(java.util.Date date)
          Returns the value at a specified date.
 int hashCode(java.util.Date date)
          Returns a hash code value of this dated object at the specified date.
 boolean is(java.lang.Object value, java.util.Date date)
          Returns true if this dated value has the specified value at the specified date.
 boolean isNotThroughout(java.lang.Object value, java.util.Date from, java.util.Date to)
          Returns true if this dated value does not have the specified value at any date within the specified date range.
 boolean isThroughout(java.lang.Object value, java.util.Date from, java.util.Date to)
          Returns true if this dated value has the specified value throughout the specified date range.
 DatedValue set(java.lang.Object value, java.util.Date from, java.util.Date to)
          Sets the value for a specified date range (optional operation).
 
Methods inherited from interface sos.dated.util.DatedObject
dateIterator, dateIterator, equals, hashCode, toString
 

Method Detail

equals

public boolean equals(java.util.Date date,
                      DatedObject obj,
                      java.util.Date objDate)
Description copied from interface: DatedObject
Indicates if this dated object at date is equal to obj at objDate.

Specified by:
equals in interface DatedObject
Parameters:
date - date at which this object should be tested
obj - the other dated object to be compared to
objDate - the date of the other dated object
Returns:
true if this dated object at date equals another dated object at objDate

get

public java.lang.Object get(java.util.Date date)
Returns the value at a specified date. It returns null if no value has been set for that date. Thus, it is impossible to distinguish an unset value and a set value of null. If such a distinction is necessary, the client can use a special marker value instead of null to signal a null value.

Parameters:
date - date at which this dated value is to be queried
Returns:
the value at a specified date
Throws:
java.lang.NullPointerException - if date is null

hashCode

public int hashCode(java.util.Date date)
Description copied from interface: DatedObject
Returns a hash code value of this dated object at the specified date. For two dated objects 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 ).

Specified by:
hashCode in interface DatedObject
Parameters:
date - date to which the value should correspond
Returns:
the hash code value of this dated object at the specified date

is

public boolean is(java.lang.Object value,
                  java.util.Date date)
Returns true if this dated value has the specified value at the specified date. If value is null and this dated value has not been set at the specified date, this method returns true.

Parameters:
value - value whose presence is to be tested
date - date at which this dated value is to be queried
Returns:
true if this dated value has a specified value at a specified date
Throws:
java.lang.NullPointerException - if date is null

isNotThroughout

public boolean isNotThroughout(java.lang.Object value,
                               java.util.Date from,
                               java.util.Date to)
Returns true if this dated value does not have the specified value at any date within the specified date range.

Parameters:
value - value whose presence is to be tested
from - starting date (inclusive) at which containment should be tested
to - ending date (exclusive) at which containment should be tested
Returns:
true if this dated value has a specified value throughout the specified date range
Throws:
java.lang.NullPointerException - if from or to is null
java.lang.IllegalArgumentException - if from does not precede to

isThroughout

public boolean isThroughout(java.lang.Object value,
                            java.util.Date from,
                            java.util.Date to)
Returns true if this dated value has the specified value throughout the specified date range.

Parameters:
value - value whose presence is to be tested
from - starting date (inclusive) at which containment should be tested
to - ending date (exclusive) at which containment should be tested
Returns:
true if this dated value has a specified value throughout the specified date range
Throws:
java.lang.NullPointerException - if from or to is null
java.lang.IllegalArgumentException - if from does not precede to

set

public DatedValue set(java.lang.Object value,
                      java.util.Date from,
                      java.util.Date to)
Sets the value for a specified date range (optional operation).

The returned value holds the old values before the call to set and is applicable only for the specified date range. It may be read-only, and it is not tied to this dated value.

Parameters:
value - value to be set
from - starting date (inclusive) at which the value should hold
to - ending date (exclusive) at which the value should hold
Returns:
Returns a DatedValue indicating the values held in the date range of interest before the call to set.
Throws:
java.lang.IllegalArgumentException - to is not greater than from
java.lang.UnsupportedOperationException - if this dated value does not support set


Copyright 2003 Side of Software (SOS). All rights reserved.