All Packages Class Hierarchy This Package Previous Next Index
Class tadt.standard.Period
java.lang.Object
|
+----tadt.standard.Period
- public class Period
- extends Object
- implements Anchorable
The Period class implements the Anchorable interface for Periods.
A Period consists of two Instants. Each Instant may have a different
granularity. There is no constraint that the Instants must be
Temporally ordered, although this is possible to enforce in future.
-
Period(Granularity, Instant, Instant)
- Construct a Period from a pair of Instants.
-
Period(Granularity, Instant[])
- Construct a Period from an array of Instants and a Granularity.
-
Period(Instant, Instant)
- Construct a Period from a pair of Instants.
-
Period(Instant[])
- Construct a Period from an array of Instants.
-
add(Interval)
- Add an Interval to this Period
-
asInstantArray()
- Retrieve the array of Instants (containing the starting and terminating
Instants) from this Period.
-
asPeriodArray()
- Retrieve the array of Periods (containing only this) from
this Period.
-
cast(Granularity)
- Cast this Period to the indicated granularity.
-
earliestInstant()
- Returns the starting Instant in the Period.
-
earliestPeriod()
- Returns the earliest Period in the Period.
-
enumerateInstants()
- Create an Enumeration of Instants in the Anchorable.
-
enumeratePeriods()
- Create an Enumeration of Periods in the Anchorable.
-
equals(Anchorable)
-
Test for equality, needed only for supporting Hashtables, use
equalTo for comparing Periods directly.
-
equals(Period)
-
Test for equality, needed only for supporting Hashtables, use
equalTo for comparing Periods directly.
-
equalTo(Anchorable)
- Is this Period equalTo another Anchorable? Always false
since the other thing is not an Period.
-
equalTo(Period)
-
Is this Period equalTo another?
-
greaterThan(Anchorable)
- Is this Period greaterThan another Anchorable?
-
greaterThan(Period)
-
Is this Period greaterThan another?
-
greaterThanOrEqualTo(Anchorable)
- Is this Period greaterThanOrEqualTo another Anchorable?
-
greaterThanOrEqualTo(Period)
-
Is this Period greaterThanOrEqualTo another?
-
hashCode()
-
Generate the hash code value, needed for supporting Hashtables.
-
image()
-
Build a nice string image of an Period, for debugging mostly
-
intersection(Period)
- Determine the intersection of two Periods.
-
kind()
- Return the name of this class.
-
latestInstant()
- Returns the terminating Instant in the Period.
-
latestPeriod()
- Returns the latest Period in the Period.
-
lessThan(Anchorable)
-
Is this Period lessThan another Anchorable?
-
lessThan(Period)
-
Is this Period lessThan another Period?
-
lessThanOrEqualTo(Anchorable)
- Is this Period lessThanOrEqualTo another Anchorable?
-
lessThanOrEqualTo(Period)
-
Is this Period lessThanOrEqualTo another?
-
newInstance(String, Instant[])
- Construct a new instance of a Period, Interval combination
-
newInstance(String, Period[])
- Construct a new instance of a Period, Interval combination
-
overlaps(Period)
- Does this Period overlap another?
-
scale(Granularity)
- Scale this Period to the indicated granularity.
-
subtract(Interval)
- Subtract an Interval from this Period
-
union(Period)
- Determine the union of two Periods.
Period
public Period(Granularity g,
Instant start,
Instant terminate)
- Construct a Period from a pair of Instants. It will scale the
Instants to the desired granularity and check to make sure that
the starting Instant is before the ending Instant.
This is not really needed since the Instants should be allowed
to be at different granularities. A scale is
used to preserve all the information in the bounding Instants.
- Parameters:
- g - - Granularity of desired period
- start - - first Instant
- terminate - - second Instant
- Throws: badPeriod
- - possibly terminates before it starts, currently
it will print a warning and set the starting and terminating Instants
as the same Instant, but in future it should throw the exception.
Period
public Period(Instant start,
Instant terminate)
- Construct a Period from a pair of Instants. Note that this will not
cast the instants to the desired granularity, this is the real
constructor.
- Parameters:
- start - - First instant
- terminate - - Second instant
- Throws: badPeriod
- - possibly terminates before it starts, currently
it will print a warning and set the starting and terminating Instants
as the same Instant, but in future it should throw the exception.
Period
public Period(Instant instants[])
- Construct a Period from an array of Instants.
- Parameters:
- instants - - array of Instants
- Throws: tooManyInstants
- - too many Instants in the array, too few
instants will cause an internal error. For now, we give a warning
rather than throwing the exception.
- Throws: badPeriod
- - possibly terminates before it starts, currently
it will print a warning and set the starting and terminating Instants
as the same Instant, but in future it should throw the exception.
Period
public Period(Granularity g,
Instant instants[])
- Construct a Period from an array of Instants and a Granularity.
It will scale the Instants to the supplied Granularity.
- Parameters:
- g - - granularity of Period
- instants - - array of Instants
- Throws: tooManyInstants
- - too many Instants in the array, too few
instants will cause an internal error. For now, we give a warning
rather than throwing the exception.
- Throws: badPeriod
- - possibly terminates before it starts, currently
it will print a warning and set the starting and terminating Instants
as the same Instant, but in future it should throw the exception.
image
public String image()
- Build a nice string image of an Period, for debugging mostly
- Returns:
- String image of Period
hashCode
public int hashCode()
- Generate the hash code value, needed for supporting Hashtables.
- Returns:
- int
- Overrides:
- hashCode in class Object
equals
public boolean equals(Anchorable other)
- Test for equality, needed only for supporting Hashtables, use
equalTo for comparing Periods directly. This will always return
false since the other thing is not a Period.
- Parameters:
- other - - Anchorable to compare
- Returns:
- false
equals
public boolean equals(Period other)
- Test for equality, needed only for supporting Hashtables, use
equalTo for comparing Periods directly.
- Parameters:
- other - - Period to compare
- Returns:
- true or false
earliestInstant
public Instant earliestInstant()
- Returns the starting Instant in the Period.
- Returns:
- Instant - the starting Instant
latestInstant
public Instant latestInstant()
- Returns the terminating Instant in the Period.
- Returns:
- Instant - the terminating Instant
earliestPeriod
public Period earliestPeriod()
- Returns the earliest Period in the Period.
- Returns:
- this
latestPeriod
public Period latestPeriod()
- Returns the latest Period in the Period.
- Returns:
- this
enumeratePeriods
public Enumeration enumeratePeriods()
- Create an Enumeration of Periods in the Anchorable.
enumerateInstants
public Enumeration enumerateInstants()
- Create an Enumeration of Instants in the Anchorable.
asInstantArray
public Instant[] asInstantArray()
- Retrieve the array of Instants (containing the starting and terminating
Instants) from this Period.
- Returns:
- array of Instants
asPeriodArray
public Period[] asPeriodArray()
- Retrieve the array of Periods (containing only this) from
this Period.
- Returns:
- array of Periods with one Period in it.
overlaps
public ExtendedBoolean overlaps(Period other)
- Does this Period overlap another?
- Returns:
- well does it?
union
public Period[] union(Period other)
- Determine the union of two Periods. This is just a helper function
it is not needed really.
- Returns:
- Array of Periods that is the union of the two Periods, it
will have one element if they overlap, two if they do not.
intersection
public Period intersection(Period other)
- Determine the intersection of two Periods.
- Returns:
- Period that is the Interesection, or null if they do not.
kind
public String kind()
- Return the name of this class.
- Returns:
- String
newInstance
public Anchorable newInstance(String beta,
Instant i[])
- Construct a new instance of a Period, Interval combination
- Returns:
- - new Anchorable
newInstance
public Anchorable newInstance(String beta,
Period i[])
- Construct a new instance of a Period, Interval combination
- Returns:
- - new Anchorable
cast
public Period cast(Granularity g)
- Cast this Period to the indicated granularity.
Note that it is not a mutator, it will create a new Period.
scale
public Period scale(Granularity g)
- Scale this Period to the indicated granularity.
Note that it is not a mutator, it will create a new Period.
lessThan
public ExtendedBoolean lessThan(Anchorable beta)
- Is this Period lessThan another Anchorable?
- Parameters:
- beta - - Anchorable to compare
- Returns:
- this < beta
lessThan
public ExtendedBoolean lessThan(Period beta)
- Is this Period lessThan another Period?
- Parameters:
- beta - - Period to compare
- Returns:
- this < beta
lessThanOrEqualTo
public ExtendedBoolean lessThanOrEqualTo(Anchorable beta)
- Is this Period lessThanOrEqualTo another Anchorable?
- Parameters:
- beta - - Anchorable to compare
- Returns:
- this < beta
lessThanOrEqualTo
public ExtendedBoolean lessThanOrEqualTo(Period beta)
- Is this Period lessThanOrEqualTo another?
- Parameters:
- beta - - Period to compare
- Returns:
- this <= beta
greaterThan
public ExtendedBoolean greaterThan(Anchorable beta)
- Is this Period greaterThan another Anchorable?
- Parameters:
- beta - - Anchorable to compare
- Returns:
- this < beta
greaterThan
public ExtendedBoolean greaterThan(Period beta)
- Is this Period greaterThan another?
- Parameters:
- beta - - Period to compare
- Returns:
- this > beta
equalTo
public ExtendedBoolean equalTo(Anchorable beta)
- Is this Period equalTo another Anchorable? Always false
since the other thing is not an Period.
- Parameters:
- beta - - Anchorable to compare
- Returns:
- false
equalTo
public ExtendedBoolean equalTo(Period beta)
- Is this Period equalTo another?
- Parameters:
- beta - - Period to compare
- Returns:
- this == beta
greaterThanOrEqualTo
public ExtendedBoolean greaterThanOrEqualTo(Anchorable beta)
- Is this Period greaterThanOrEqualTo another Anchorable?
- Parameters:
- beta - - Anchorable to compare
- Returns:
- this < beta
greaterThanOrEqualTo
public ExtendedBoolean greaterThanOrEqualTo(Period beta)
- Is this Period greaterThanOrEqualTo another?
- Parameters:
- beta - - Period to compare
- Returns:
- this >= beta
add
public Period add(Interval beta)
- Add an Interval to this Period
- Parameters:
- beta - - Interval to add
- Returns:
- Period - new Period
subtract
public Period subtract(Interval beta)
- Subtract an Interval from this Period
- Parameters:
- beta - - Interval to subtract
- Returns:
- Period - new Period
All Packages Class Hierarchy This Package Previous Next Index