org.npsnet.xrti.utilities
Class DoubleValuedLogicalTimeInterval

java.lang.Object
  extended byorg.npsnet.xrti.utilities.DoubleValuedLogicalTimeInterval
All Implemented Interfaces:
java.lang.Comparable, LogicalTimeInterval, java.io.Serializable

public class DoubleValuedLogicalTimeInterval
extends java.lang.Object
implements LogicalTimeInterval

DoubleValuedLogicalTimeInterval

Author:
Stanislav Kozina
See Also:
Serialized Form

Field Summary
private  double value
          The value of this logical time interval.
 
Constructor Summary
DoubleValuedLogicalTimeInterval(double pValue)
          Creates a new XRTILogicalTimeInterval.
 
Method Summary
 int compareTo(java.lang.Object other)
          Compares this logical time interval to another.
 void encode(byte[] buffer, int offset)
          Encodes this logical time interval, placing the result into the specified buffer.
 int encodedLength()
          Returns the encoded length of this logical time interval.
 boolean equals(java.lang.Object other)
          Checks this logical time interval for equality with another.
 double getValue()
          Returns the value of this time interval.
 int hashCode()
          Computes and returns a hash code corresponding to this logical time interval.
 boolean isEpsilon()
          Checks whether this logical time interval has an epsilon length.
 boolean isZero()
          Checks whether this logical time interval has a zero length.
 LogicalTimeInterval subtract(LogicalTimeInterval subtrahend)
          Subtracts the specified logical time interval from this one, returning a new LogicalTimeInterval representing the result.
 java.lang.String toString()
          Returns a string representation of this logical time interval.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

private double value
The value of this logical time interval.

Constructor Detail

DoubleValuedLogicalTimeInterval

public DoubleValuedLogicalTimeInterval(double pValue)
Creates a new XRTILogicalTimeInterval.

Parameters:
pValue - the value of the logical time interval
Method Detail

getValue

public double getValue()
Returns the value of this time interval.

Returns:
the value of this time interval

isZero

public boolean isZero()
Checks whether this logical time interval has a zero length.

Specified by:
isZero in interface LogicalTimeInterval
Returns:
true if this logical time interval has a zero length, false otherwise

isEpsilon

public boolean isEpsilon()
Checks whether this logical time interval has an epsilon length.

Specified by:
isEpsilon in interface LogicalTimeInterval
Returns:
true if this logical time interval has an epsilon length, false otherwise

subtract

public LogicalTimeInterval subtract(LogicalTimeInterval subtrahend)
Subtracts the specified logical time interval from this one, returning a new LogicalTimeInterval representing the result.

Specified by:
subtract in interface LogicalTimeInterval
Parameters:
subtrahend - the logical time interval to subtract from this one
Returns:
a new LogicalTimeInterval representing the result of the operation

compareTo

public int compareTo(java.lang.Object other)
Compares this logical time interval to another.

Specified by:
compareTo in interface LogicalTimeInterval
Parameters:
other - the LogicalTimeInterval to compare this to
Returns:
+1 if this logical time interval is longer than the other, -1 if it is shorter, or 0 if the two intervals are the same length

equals

public boolean equals(java.lang.Object other)
Checks this logical time interval for equality with another.

Specified by:
equals in interface LogicalTimeInterval
Parameters:
other - the LogicalTimeInterval to compare this to
Returns:
true if the two intervals are equal, false otherwise

hashCode

public int hashCode()
Computes and returns a hash code corresponding to this logical time interval.

Specified by:
hashCode in interface LogicalTimeInterval
Returns:
a hash code corresponding to this logical time interval

toString

public java.lang.String toString()
Returns a string representation of this logical time interval.

Specified by:
toString in interface LogicalTimeInterval
Returns:
a string representation of this logical time interval

encodedLength

public int encodedLength()
Returns the encoded length of this logical time interval.

Specified by:
encodedLength in interface LogicalTimeInterval
Returns:
the encoded length of this logical time interval (in bytes)

encode

public void encode(byte[] buffer,
                   int offset)
Encodes this logical time interval, placing the result into the specified buffer.

Specified by:
encode in interface LogicalTimeInterval
Parameters:
buffer - the buffer in which to place the encoded interval
offset - the offset within the buffer at which to store the encoded interval