|
tauZaman v0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tauzaman.timestamp.Granule | +--tauzaman.timestamp.NowRelativeGranule
The Granule
class implements the arithmetic and comparison
operations on Granules. A Granule is the most basic unit of time in
a given Granularity. Each granule is a (TimeValue) distance (in granules).
Granules can be used for both unanchored and anchored times. If the time
is anchored, the Granule represents the distance from the granularity
anchor point. If the time is unanchored, the Granule just represents
a distance. Granules can be further classified as determinate or
indeterminate. A determinate granule has a known, fixed distance.
An indeterminate granule is some distance between a lower and upper
bound. A probability mass function determines the probability of
each indeterminate alternative.
Granules can also be now-relative.
A now-relative granule is a moving point on the time-line. It consists
of the variable now that represents the current time, and an
granule count that displaces the granule the specified distance
from the current time. For example, the now-relative granule
'now + 1 day' indicates that the Granule represented is whatever the
current time is displaced by one day in the future.
This class implements now-relative instants that
have a known, fixed displacement (as opposed to instants that have
indeterminate displacements).
Note that none of the operations are mutators, that is, they all
create a new instant if needed.
Granule
,
TimeValue
,
ExtendedBoolean
,
Serialized FormField Summary |
Fields inherited from class tauzaman.timestamp.Granule |
DETERMINATE, FALSE_EB, granularity, INDETERMINATE, kind, lower, MAYBE_EB, NOWRELATIVE, pmf, TRUE_EB, upper |
Constructor Summary | |
NowRelativeGranule()
Create the now granule at the default Granularity (i.e., 'now + 0') |
|
NowRelativeGranule(Granularity g)
Create the now granule at the specified Granularity (i.e., 'now + 0') |
|
NowRelativeGranule(Granularity g,
long p)
Create a now-relative granule at the specified Granularity |
|
NowRelativeGranule(Granularity g,
TimeValue p)
Create a now-relative granule at the specified Granularity |
|
NowRelativeGranule(long p)
Create a now-relative granule at the default Granularity |
|
NowRelativeGranule(TimeValue p)
Create a now-relative granule at the default Granularity |
Method Summary | |
NowRelativeGranule |
add(NowRelativeGranule other)
Add a now-relative to a now-relative. |
Granule |
decrement()
Construct a NowRelativeGranule that has the relative part decremented by 1 |
Granule |
divide(int n)
Divide by a constant. |
ExtendedBoolean |
equalTo(NowRelativeGranule other)
NowRelative/NowRelative comparison - Is this == other? |
TimeValue |
getGranule()
Accessor - retrieve the granule. |
TimeValue |
getLower()
Accessor - retrieve the lower bound from the now-relative granule. |
TimeValue |
getUpper()
Accessor - retrieve the upper bound from the now-relative granule. |
ExtendedBoolean |
greaterThan(NowRelativeGranule other)
NowRelative/NowRelative comparison - Is this > other? |
ExtendedBoolean |
greaterThanOrEqualTo(NowRelativeGranule other)
NowRelative/NowRelative comparison - Is this >= other? |
java.lang.String |
image()
Create a nice string image of a granule, alternative to toString() |
Granule |
increment()
Construct a NowRelativeGranule that has the relative part incremented by 1 |
ExtendedBoolean |
lessThan(NowRelativeGranule other)
NowRelative/NowRelative comparison - Is this < other? |
ExtendedBoolean |
lessThanOrEqualTo(NowRelativeGranule other)
NowRelative/NowRelative comparison - Is this <= other? |
Granule |
multiply(int n)
Multiply by a constant. |
Granule |
negate()
Negate the granule. |
NowRelativeGranule |
subtract(NowRelativeGranule other)
Subtract a now-relative from a now-relative. |
Methods inherited from class tauzaman.timestamp.Granule |
add, equalTo, getGranularity, getKind, greaterThan, greaterThanOrEqualTo, lessThan, lessThanOrEqualTo, main, subtract |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NowRelativeGranule() throws TauZamanException
TauZamanException
- if any abnormal condition occurs when
setting this Granule's default Granularitypublic NowRelativeGranule(Granularity g)
g
- - desired Granularitypublic NowRelativeGranule(TimeValue p) throws TauZamanException
p
- - displacement from now
TauZamanException
- if any abnormal condition occurs when
setting this Granule's default Granularitypublic NowRelativeGranule(Granularity g, TimeValue p)
g
- - desired Granularityp
- - displacement from nowpublic NowRelativeGranule(long p) throws TauZamanException
p
- - count of granules
TauZamanException
- if any abnormal condition occurs when
setting this Granule's default Granularitypublic NowRelativeGranule(Granularity g, long p)
g
- - desired Granularityp
- - count of granulesMethod Detail |
public TimeValue getGranule()
getGranule
in class Granule
public TimeValue getLower()
getLower
in class Granule
public TimeValue getUpper()
getUpper
in class Granule
public java.lang.String image()
image
in class Granule
public Granule decrement()
decrement
in class Granule
public Granule increment()
increment
in class Granule
public Granule negate()
negate
in class Granule
public ExtendedBoolean equalTo(NowRelativeGranule other)
other
- - The NowRelativeGranule to compare
public ExtendedBoolean lessThan(NowRelativeGranule other)
other
- - The NowRelativeGranule to compare
public ExtendedBoolean lessThanOrEqualTo(NowRelativeGranule other)
other
- - The NowRelativeGranule to compare
public ExtendedBoolean greaterThan(NowRelativeGranule other)
other
- - The NowRelativeGranule to compare
public ExtendedBoolean greaterThanOrEqualTo(NowRelativeGranule other)
other
- - The NowRelativeGranule to compare
public NowRelativeGranule add(NowRelativeGranule other)
other
- - The NowRelativeGranule to add
return this + otherpublic NowRelativeGranule subtract(NowRelativeGranule other)
other
- - The NowRelativeGranule to subtract
return this - otherpublic Granule multiply(int n)
multiply
in class Granule
n
- - The multiplier
public Granule divide(int n)
divide
in class Granule
n
- - The divisor
|
tauZaman v0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |