|
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
A Granule
is a pairing of a TimeValue and a
Granularity, independent of a TauZamanService. This class implements
operations on 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.
TimeValue
,
ExtendedBoolean
,
Serialized FormField Summary | |
static int |
DETERMINATE
|
protected static ExtendedBoolean |
FALSE_EB
|
protected Granularity |
granularity
|
static int |
INDETERMINATE
|
protected int |
kind
|
protected TimeValue |
lower
|
protected static ExtendedBoolean |
MAYBE_EB
|
static int |
NOWRELATIVE
|
protected ProbabilityMassFunction |
pmf
|
protected static ExtendedBoolean |
TRUE_EB
|
protected TimeValue |
upper
|
Constructor Summary | |
Granule(Granularity g,
long p)
Create a determinate granule at the specified Granularity |
|
Granule(Granularity g,
long lower,
long upper)
Create an indeterminate granule with an unknown PMF at the specified Granularity |
|
Granule(Granularity g,
long lower,
long upper,
ProbabilityMassFunction pmf)
Create an indeterminate granule with the specified PMF at the specified Granularity |
|
Granule(Granularity g,
TimeValue p)
Create a determinate granule at the specified Granularity |
|
Granule(Granularity g,
TimeValue lower,
TimeValue upper)
Create an indeterminate granule with an unknown PMF at the specified Granularity |
|
Granule(Granularity g,
TimeValue lower,
TimeValue upper,
ProbabilityMassFunction pmf)
Create an indeterminate granule with the specified PMF at the specified Granularity |
|
Granule(long p)
Create a determinate granule at the default Granularity |
|
Granule(long lower,
long upper)
Create an indeterminate granule with an unknown PMF at the default Granularity |
|
Granule(long lower,
long upper,
ProbabilityMassFunction pmf)
Create an indeterminate granule with the specified PMF at the default Granularity |
|
Granule(TimeValue p)
Create a determinate granule at the default Granularity |
|
Granule(TimeValue lower,
TimeValue upper)
Create an indeterminate granule with an unknown PMF at the default Granularity |
|
Granule(TimeValue lower,
TimeValue upper,
ProbabilityMassFunction pmf)
Create an indeterminate granule with the specified PMF at the default Granularity |
Method Summary | |
Granule |
add(Granule other)
Construct a new Granule that is this + other. |
Granule |
decrement()
Construct a Granule that has each bound decremented by 1 |
Granule |
divide(int n)
Divide by a constant. |
ExtendedBoolean |
equalTo(Granule other)
Is this == other? |
Granularity |
getGranularity()
Accessor - retrieve the granularity of this granule |
TimeValue |
getGranule()
Accessor - retrieve the granules from a determinate granule (defaults to lower bound for indeterminate granule) |
int |
getKind()
Accessor - retrieve the kind of this granule, INDETERMINATE or DETERMINATE |
TimeValue |
getLower()
Accessor - retrieve the lower bound from an indeterminate granule (defaults to granules for determinate granule) |
TimeValue |
getUpper()
Accessor - retrieve the upper bound from an indeterminate granule (defaults to granules for determinate granule) |
ExtendedBoolean |
greaterThan(Granule other)
Is this > other? |
ExtendedBoolean |
greaterThanOrEqualTo(Granule other)
Is this >= other? |
java.lang.String |
image()
Create a nice string image of a granule, alternative to toString() |
Granule |
increment()
Construct a Granule that has each bound incremented by 1 |
ExtendedBoolean |
lessThan(Granule other)
Is this < other? |
ExtendedBoolean |
lessThanOrEqualTo(Granule other)
Is this <= other? |
static void |
main(java.lang.String[] argv)
A simple test for the class. |
Granule |
multiply(int n)
Multiply by a constant. |
Granule |
negate()
Negate the granule. |
Granule |
subtract(Granule other)
Construct a new Granule that is this - other. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int kind
public static final int DETERMINATE
public static final int INDETERMINATE
public static final int NOWRELATIVE
protected static final ExtendedBoolean FALSE_EB
protected static final ExtendedBoolean TRUE_EB
protected static final ExtendedBoolean MAYBE_EB
protected Granularity granularity
protected TimeValue lower
protected TimeValue upper
protected ProbabilityMassFunction pmf
Constructor Detail |
public Granule(TimeValue p)
p
- - count of granules
TauZamanException
- if any abnormal condition occurs when
setting this Granule's default Granularitypublic Granule(Granularity g, TimeValue p)
g
- - desired Granularityp
- - count of granulespublic Granule(long p)
p
- - count of granules
TauZamanException
- if any abnormal condition occurs when
setting this Granule's default Granularitypublic Granule(Granularity g, long p)
g
- - desired Granularityp
- - count of granulespublic Granule(TimeValue lower, TimeValue upper)
lower
- - count of granulesupper
- - count of granules
TauZamanException
- if any abnormal condition occurs when
setting this Granule's default Granularitypublic Granule(long lower, long upper)
lower
- - count of granulesupper
- - count of granules
TauZamanException
- if any abnormal condition occurs when
setting this Granule's default Granularitypublic Granule(Granularity g, TimeValue lower, TimeValue upper)
g
- - desired Granularitylower
- - count of granulesupper
- - count of granulespublic Granule(Granularity g, long lower, long upper)
g
- - desired Granularitylower
- - count of granulesupper
- - count of granulespublic Granule(TimeValue lower, TimeValue upper, ProbabilityMassFunction pmf)
lower
- - count of granulesupper
- - count of granulespmf
- - probability mass function
TauZamanException
- if any abnormal condition occurs when
setting this Granule's default Granularitypublic Granule(long lower, long upper, ProbabilityMassFunction pmf)
lower
- - count of granulesupper
- - count of granulespmf
- - probability mass function
TauZamanException
- if any abnormal condition occurs when
setting this Granule's default Granularitypublic Granule(Granularity g, TimeValue lower, TimeValue upper, ProbabilityMassFunction pmf)
g
- - desired Granularitylower
- - count of granulesupper
- - count of granulespmf
- - probability mass functionpublic Granule(Granularity g, long lower, long upper, ProbabilityMassFunction pmf)
g
- - desired Granularitylower
- - count of granulesupper
- - count of granulespmf
- - probability mass functionMethod Detail |
public Granularity getGranularity()
public int getKind()
public TimeValue getGranule()
public TimeValue getLower()
public TimeValue getUpper()
public java.lang.String image()
public Granule decrement()
public Granule increment()
public Granule negate()
public ExtendedBoolean equalTo(Granule other)
other
- - The Granule to compare
public ExtendedBoolean lessThan(Granule other)
other
- - The Granule to compare
public ExtendedBoolean lessThanOrEqualTo(Granule other)
other
- - The Granule to compare
public ExtendedBoolean greaterThan(Granule other)
other
- - The Granule to compare
public ExtendedBoolean greaterThanOrEqualTo(Granule other)
other
- - The Granule to compare
public Granule add(Granule other)
other
- - The Granule to add
return this + otherpublic Granule subtract(Granule other)
other
- - The Granule to subtract
return this - otherpublic Granule multiply(int n)
n
- - The divisor
public Granule divide(int n)
n
- - The divisor
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
|
tauZaman v0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |