public class TemporalDifference
extends java.lang.Object
implements java.io.Serializable
Class made serializable so that schedule adherence data can be made available through RMI calls.
Constructor and Description |
---|
TemporalDifference(int temporalDifferenceMsec) |
TemporalDifference(long temporalDifferenceMsec)
Often working with longs for time so it is convenient to have a
constructor that will accept a long as the temporal difference.
|
Modifier and Type | Method and Description |
---|---|
void |
addTime(int latenessMsec)
Adds the latenessMsec to this.
|
boolean |
betterThan(TemporalDifference other)
Returns true if the temporal difference for this object is better than
that for the TemporalDifference parameter other.
|
boolean |
betterThanOrEqualTo(TemporalDifference other)
Returns if the temporal difference for this object is better than or
equal to that for the TemporalDifference parameter other.
|
int |
early()
If early then returns positive value indicating how many msec early.
|
int |
getTemporalDifference()
Returns the temporalDifferenceMsec in msec.
|
boolean |
isEarlierThan(int allowableEarlySeconds)
Returns true if vehicle is earlier than allowableEarlySeconds
|
boolean |
isLaterThan(int allowableLateSeconds)
Returns true if vehicle is later than allowableLateSeconds
|
boolean |
isWithinBounds()
Returns true if the temporal difference is within the bounds specified by
CoreConfig.getAllowableEarlySeconds() and
CoreConfig.getAllowableLateSeconds().
|
boolean |
isWithinBounds(int allowableEarlySeconds,
int allowableLateSeconds)
Returns whether the temporal difference is within the specified bounds.
|
boolean |
isWithinBoundsForInitialMatching()
Returns true if the temporal difference is within the bounds specified by
CoreConfig.getAllowableEarlySecondsForInitialMatching() and
CoreConfig.getAllowableLateSecondsForInitialMatching().
|
java.lang.String |
toString() |
public TemporalDifference(int temporalDifferenceMsec)
temporalDifferenceMsec
- Positive means vehicle is ahead of where expected, negative
means behind.public TemporalDifference(long temporalDifferenceMsec)
temporalDifferenceMsec
- Positive means vehicle is ahead of where expected, negative
means behind.public void addTime(int latenessMsec)
latenessMsec
- How much lateness to add.public boolean isWithinBounds()
public boolean isWithinBoundsForInitialMatching()
public boolean isWithinBounds(int allowableEarlySeconds, int allowableLateSeconds)
allowableEarlySeconds
- allowableLateSeconds
- public boolean isEarlierThan(int allowableEarlySeconds)
allowableEarlySeconds
- public boolean isLaterThan(int allowableLateSeconds)
allowableLateSeconds
- public int early()
public boolean betterThan(TemporalDifference other)
other
- TemporalDifference to be compared to. Can be null.public boolean betterThanOrEqualTo(TemporalDifference other)
other
- TemporalDifference to be compared topublic int getTemporalDifference()
public java.lang.String toString()
toString
in class java.lang.Object