hla.rti
Interface LogicalTimeInterval

All Superinterfaces:
java.lang.Comparable, java.io.Serializable

public interface LogicalTimeInterval
extends java.lang.Comparable, java.io.Serializable

An immutable logical time interval.

Author:
DMSO

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.
 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.
 

Method Detail

isZero

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

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.

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.

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 java.lang.Comparable
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.

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.

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.

Returns:
a string representation of this logical time interval

encodedLength

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

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.

Parameters:
buffer - the buffer in which to place the encoded interval
offset - the offset within the buffer at which to store the encoded interval