|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.rbnb.api.TimeRange
public final class TimeRange
The range of times that applies to the data of an Rmap.
A TimeRange consists of:
The number of time values in the TimeRange and the number of
data points must satisfy one of the following three cases:
When the number of times equals the number of points, the time for a point is equal to the time corresponding to the point.
When there is a single time and a number of points larger than one, the time for a point is equal to:
time + (point #)/(number of points)
When there are multiple times and a single data point, all of the times apply to the point. This is usually used when the "point" of data is is actually a data pool. The children of the data pool are inheriting the times.
All data points have a duration that is either:
TimeRange (when there is just a single
time in the TimeRange), orTimeRange divided by the number of
data points.
TimeRanges can inherit time values and duration from other
TimeRanges. The way that the inheritance works is described
in the documentation for Rmaps.
Rmap,
Serialized Form| Field Summary | |
|---|---|
static double |
INHERIT_DURATION
Duration value is inherited. |
static double[] |
INHERIT_TIMES
Time values are inherited. |
static TimeRange |
SERVER_TOD
server time of day. |
| Constructor Summary | |
|---|---|
TimeRange()
Class constructor. |
|
TimeRange(double timeI)
Class constructor to build a TimeRange for a single time
and an inherited duration. |
|
TimeRange(double[] ptimesI)
Class constructor to build a TimeRange from an array of
times and an inherited duration. |
|
TimeRange(double[] ptimesI,
double durationI)
Class constructor to build a TimeRange from an array of
times and a duration. |
|
TimeRange(double startI,
double durationI)
Class constructor to build a TimeRange from a single time
and duration. |
|
| Method Summary | |
|---|---|
Object |
clone()
Clones this TimeRange. |
int |
compareTo(TimeRange otherI)
Compares this TimeRange to the input one. |
int |
copyTimes(int nPointsI,
double[] timeI,
int startAtI)
Copies the times for all of the points in this range to an array. |
boolean |
extend(int myPointsI,
TimeRange otherI,
int oPointsI)
Extends the range of this TimeRange by adding the input
TimeRange to the end. |
double |
getDuration()
Gets the duration. |
double[] |
getLimits()
Gets the minimum and maximum times of this TimeRange. |
int |
getNptimes()
Gets the number of point times in a TimeRange. |
double |
getPointTime(int pointI,
int nPointsI)
Gets the time value for a particular point. |
double[] |
getPtimes()
Gets the individual point times array. |
double |
getTime()
Gets the time of the range. |
boolean |
isInclusive()
Inclusive of both ends of range? |
void |
nullify()
Nullifies this TimeRange. |
void |
set(double timeI)
Sets the time of the range and clears the duration so that it gets inherited. |
void |
set(double[] ptimesI)
Sets the individual point times for the range and clears the duration so that it gets inherited. |
void |
set(double[] ptimesI,
double durationI)
Sets the individual point times for the range and the duration. |
void |
set(double startI,
double durationI)
Sets the time and duration of the range. |
void |
setDuration(double durationI)
Sets the duration. |
void |
setInclusive(boolean inclusiveI)
Sets the inclusive flag. |
void |
setPtimes(double[] ptimesI)
Sets the individual point times array. |
String |
toString()
Gets a displayable string representation of this TimeRange. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final double INHERIT_DURATION
public static final double[] INHERIT_TIMES
public static final TimeRange SERVER_TOD
| Constructor Detail |
|---|
public TimeRange()
public TimeRange(double timeI)
TimeRange for a single time
and an inherited duration.
timeI - the time.TimeRange(double,double),
TimeRange(double[]),
TimeRange(double[],double)
public TimeRange(double startI,
double durationI)
TimeRange from a single time
and duration.
startI - the time.durationI - the duration.TimeRange(double),
TimeRange(double[]),
TimeRange(double[],double)public TimeRange(double[] ptimesI)
TimeRange from an array of
times and an inherited duration.
ptimesI - the individual point times.TimeRange(double),
TimeRange(double,double),
TimeRange(double[],double)
public TimeRange(double[] ptimesI,
double durationI)
TimeRange from an array of
times and a duration.
ptimesI - the individual point times.TimeRange(double),
TimeRange(double,double),
TimeRange(double[])| Method Detail |
|---|
public final Object clone()
TimeRange.
This method clones the ptimes array.
public final int compareTo(TimeRange otherI)
TimeRange to the input one.
The only way that two TimeRanges can be considered "equal"
is if they have exactly the same values. Otherwise, one is always
considered to come "before" the other. The comparison depends on exactly
what fields are set and how they are set in the two
TimeRanges. The rules are:
TimeRanges in order. If
any of the times for one is less than the corresponding time for
for the other, then that TimeRange is less than the
other. If one TimeRange runs out of times before the
other does, then it is less than the other.TimeRange is inherited or
less than the other, then that TimeRange is less than
the other.
otherI - the other TimeRange.
<0 if this TimeRange is less than the input,
=0 if the two TimeRanges are equal, or
>0 if this TimeRange is greater than the input.
public final int copyTimes(int nPointsI,
double[] timeI,
int startAtI)
nPointsI - the number of data points that the
TimeRange describes. This can be one of
the following:
getNptimes(),getNptimes() is
1, orgetNptimes().timeI - the time array to copy the points into.startAtI - the starting index into the time array.
IllegalArgumentException - thrown if:
getNptimes() and the latter is
not equal to 1.
public final boolean extend(int myPointsI,
TimeRange otherI,
int oPointsI)
TimeRange by adding the input
TimeRange to the end.
This method determines whether or not the input TimeRange
is compatible with this one. To be compatible, the two
TimeRanges must satisfy the one of the following:
TimeRanges must have multiple start times and
equal durations, orTimeRanges must have a single start time and a
duration such that the start time of the input
TimeRange is equal to the start time + duration of this
TimeRange and the interval between points in the two
TimeRanges are equal.
myPointsI - the number of data points represented by this
TimeRange.otherI - the other TimeRange.oPointsI - the number of data points represented by the input
TimeRange.
TimeRanges compatible? If this is
false, then this TimeRange is left
unchanged, otherwise this TimeRange is extended to
include the input.public final double getDuration()
set(double,double),
set(double[],double),
setDuration(double)public final double[] getLimits()
TimeRange.
TimeRange as
an array.public final int getNptimes()
TimeRange.
set(double),
set(double,double),
set(double[]),
set(double[],double)
public final double getPointTime(int pointI,
int nPointsI)
The time value equals one of:
getTime() +
getDuration()*pointI/nPointsI.
pointI - the desired point.nPointsI - the number of data points that the
TimeRange describes. This can be one of
the following:
getNptimes(),getNptimes() is
1, orgetNptimes().IllegalStateException - thrown if getNptimes() is zero.
IllegalArgumentException - thrown if:
getNptimes() and the latter is
not equal to 1, orpublic final double[] getPtimes()
set(double[]),
set(double[],double),
setPtimes(double[])public final double getTime()
public boolean isInclusive()
If the duration of the TimeRange is zero (0),
then the range is inclusive.
TimeRange include both the start and end
time, or just the one nearest the reference of a request?public final void nullify()
TimeRange.
This method ensures that all pointers in this DataBlock
are cleared, reducing the effort needed by the garbage collector to
clean it up.
public final void set(double timeI)
timeI - the time.getTime(),
set(double,double),
set(double[]),
set(double[],double)
public final void set(double startI,
double durationI)
startI - the time.durationI - the duration.
IllegalArgumentException - thrown if the duration is negative and is not
INHERIT_DURATION.getTime(),
getDuration(),
set(double),
set(double[]),
set(double[],double),
setDuration(double),
setPtimes(double[])public final void set(double[] ptimesI)
ptimesI - the individual point times.getNptimes(),
getPtimes(),
set(double),
set(double,double),
set(double[],double),
setDuration(double),
setPtimes(double[])
public final void set(double[] ptimesI,
double durationI)
ptimesI - the individual point times.durationI - the duration.
IllegalArgumentException - thrown if the duration is negative and is not
INHERIT_DURATION.getDuration(),
getNptimes(),
getPtimes(),
set(double),
set(double,double),
set(double[])public final void setDuration(double durationI)
durationI - the new duration.getDuration()public final void setInclusive(boolean inclusiveI)
inclusiveI - include both ends of the range?isInclusive()public final void setPtimes(double[] ptimesI)
ptimesI - the new point times array.getPtimes()public String toString()
TimeRange.
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||