|
tauZaman v0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tauzaman.temporaldatatypes.Interval
The Interval
class provides a set of constructor and accessor
operations for intervals.
(Arithmetic and comparison operations are implemented in a @see Semantics.)
An interval is a length of time, unanchonred to any specific
point or region on the time-line. For example, the interval "1 day"
represents a length. It can be used, for example, to displace values
anchored to the time-line, e.g., "July 3, 2002", by a distance of "1 day",
moving the instant to "July 4, 2002".
This class implements intervals that have a known, fixed length as well as
intervals that are indeterminately known.
To perform comparisons and arithmetic operations on Intervals,
it is first necessary to create a @see Semantics interface.
A Semantics implements common comparison and arithmetic operations on
temporal entities. For example a user would write code like the following
// Left operand semantics casts operands in binary operations // to the granularity of the left operand, and then performs // the desired operation. Ops = new LeftOperandSemantics(); // Create an Instant and an Interval. // In this example, both are at the granularity of days. Instant i = new Instant("July 3, 2002"); Interval j = new Interval("1 day"); // Displace i by length j, k will represent the day "July 4, 2002" Instant k = Ops.add(i,j);We employ this strategy so that interval operations can be performed under varying Semantics.
DeterminateSemantics
,
IndeterminateSemantics
Field Summary | |
(package private) TauZamanService |
cachedTauZamanService
TauZamanService that this Instant is created under |
private Granule |
granule
|
Constructor Summary | |
Interval(Granularity g,
Granule granule)
Construct an Interval from a count of granules. |
|
Interval(Granule granule)
Construct an Interval from a count of granules. |
|
Interval(Period p)
Construct an Interval as the distance between a period's endpoints |
|
Interval(java.lang.String literal)
Construct a Interval given a String literal. |
Method Summary | |
Interval |
cast()
Cast this Interval to the default granularity. |
Interval |
cast(Granularity g)
Cast this Interval to the indicated granularity. |
Granularity |
getGranularity()
Retrieve the Granularity from this Interval |
Granule |
granule()
Accessor - retrieve the Granule from this Interval. |
java.lang.String |
image()
Build a nice string image of an Interval, for debugging mostly. |
Granule |
largest()
Get the largest (only!) |
java.lang.String |
output()
Returns string representation of this Interval . |
Interval |
scale()
Scale this Interval to the default granularity. |
Interval |
scale(Granularity g)
Scale this Interval to the indicated granularity. |
Granule |
smallest()
Get the smallest (only!) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private Granule granule
TauZamanService cachedTauZamanService
TauZamanService
that this Instant
is created under
Constructor Detail |
public Interval(Granularity g, Granule granule)
g
- - granularitygranule
- - length in granulespublic Interval(Granule granule)
granule
- - length in granulespublic Interval(java.lang.String literal) throws TemporalDataTypeFormationException
Interval
given a String literal.
literal
- String representing temporal constant
TemporalDataTypeFormationException
- if any abnormal condition occurs during parsing of
string temporal constant to Instant
timestamppublic Interval(Period p)
Method Detail |
public java.lang.String output() throws TemporalDataTypeFormationException
Interval
.
Interval
TemporalDataTypeFormationException
- if any abnormal condition occurs when forming
string temporal constant from timestamppublic java.lang.String image()
public Interval cast(Granularity g)
g
- - Granularitypublic Interval cast()
public Interval scale(Granularity g)
g
- - Granularitypublic Interval scale()
public Granule smallest()
public Granule largest()
public Granule granule()
public Granularity getGranularity()
|
tauZaman v0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |