|
tauZaman v0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tauzaman.temporaldatatypes.Instant
The Instant
class provides a set of constructor and accessor
operations on Instants.
(Arithmetic and comparison operations are implemented in a Semantics.)
An instant is a
point on the time-line, e.g., 'July 3, 2002'.
An instant could also be indeterminately known,
e.g., "July 3, 2002 ~ July 4, 2002".
To perform comparisons and arithmetic operations on Instants,
it is first necessary to create a 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 two Instants, in this case, both are at the granularity of days Instant i = new Instant("July 3, 2002"); Instant j = new Instant("July 4, 2002"); // Is i earlier on the time-line than j? if (Ops.precedes(i,j)) ...We employ this strategy so that all the instant operations can be performed under varying Semantics.
DeterminateSemantics
,
IndeterminateSemantics
Field Summary | |
static Instant |
BEGINNING_OF_TIME
|
(package private) TauZamanService |
cachedTauZamanService
TauZamanService that this Instant is created under |
static Instant |
END_OF_TIME
|
private Granule |
granule
|
static Instant |
ZERO_TIME
|
Constructor Summary | |
Instant()
Construct a zero Instant in the default granularity. |
|
Instant(Granularity g)
Construct a zero Instant in the desired granularity. |
|
Instant(Granularity g,
Granule granule)
Construct an Instant from a granule representing the distance from the granularity anchor point Convert the Instant to the desired granularity. |
|
Instant(Granule granule)
Construct an Instant from a granule representing the distance from the granularity anchor point |
|
Instant(java.lang.String literal)
Construct an Instant by parsing a string, using the default granularity. |
|
Instant(java.lang.String literal,
Granularity g)
Construct an Instant by parsing a string. |
Method Summary | |
Instant |
cast(Granularity g)
Cast this Instant to the indicated granularity. |
Granule |
earliest()
Returns the earliest (only!) |
Granularity |
getGranularity()
Retrieve the Granularity from this Instant |
Granule |
getGranule()
Retrieve the granule from this Instant |
java.lang.String |
image()
Build a nice string image of an Instant, for debugging mostly. |
Granule |
latest()
Returns the latest (only!) |
java.lang.String |
output()
Returns string representation of this Instant . |
Instant |
scale(Granularity g)
Scale this Instant to the indicated granularity. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Instant BEGINNING_OF_TIME
public static final Instant END_OF_TIME
public static final Instant ZERO_TIME
private Granule granule
TauZamanService cachedTauZamanService
TauZamanService
that this Instant
is created under
Constructor Detail |
public Instant(Granule granule)
granule
- - distance in granules from the anchorpublic Instant(Granularity g, Granule granule)
g
- - granularitygranule
- - distance in granules from the anchorpublic Instant(java.lang.String literal) throws TemporalDataTypeFormationException
literal
- - a string representation of the instant
TemporalDataTypeFormationException
- if any abnormal condition occurs during parsing of
string temporal constant to Instant
timestamppublic Instant(java.lang.String literal, Granularity g)
literal
- - a string representation of the instantg
- - granularitypublic Instant(Granularity g)
g
- - Granularitypublic Instant()
Method Detail |
public java.lang.String output() throws TemporalDataTypeFormationException
Instant
.
Instant
TemporalDataTypeFormationException
- if any abnormal condition occurs when forming
string temporal constant from timestamppublic java.lang.String image()
public Granule earliest()
public Granule latest()
public Instant cast(Granularity g)
g
- - desired Granularitypublic Instant scale(Granularity g)
g
- - desired Granularitypublic Granularity getGranularity()
public Granule getGranule()
|
tauZaman v0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |