jasi.sim.geo.cartesian
Class Space

java.lang.Object
  extended by jasi.sim.basic.value.AbstractSimValueType
      extended by jasi.sim.basic.value.AbstractComparableObject<T>
          extended by jasi.sim.geo.ComparableGeoObject<Space>
              extended by jasi.sim.geo.cartesian.Space
All Implemented Interfaces:
ExtendedComparable<Space>, SimValue, Geometric, java.io.Serializable, java.lang.Comparable<Space>

public final class Space
extends ComparableGeoObject<Space>

Immutable class to represent space values.

See Also:
Serialized Form

Nested Class Summary
static class Space.Distance
          Distance function, which imposes a total ordering by comparing the distance to a center.
 
Field Summary
static java.util.Comparator<Space> COMPARATOR
          The space value comparator, which imposes a total ordering.
static Space DELTA
          The epsilon constant for equal spaces.
static Space KM
          Space constant for a kilometer.
static Space M
          Space constant for a meter.
static Space MM
          Space constant for a millimeter.
static Space ORIGIN
          The center of the space values.
 
Fields inherited from interface jasi.sim.geo.Geometric
BEGIN, END, MIDLE
 
Constructor Summary
Space(Space s)
          Constructor of a space value.
Space(java.lang.String s)
          Constructor of a space value.
 
Method Summary
 Space add(Space s)
          Add that space value to this space value.
 double amount(Space s)
          Retrieve the amount of this space value in units of that space value.
 int compareTo(Space s)
          Compares this object with the specified object for order.
 Speed divide(Time t)
          Returns the speed for moving this space in a given time.
 boolean equals(java.lang.Object o)
          Indicates whether some other object is "equal to" this one.
 int hashCode()
          Returns a hash code value for the object.
 Space minus(Space s)
          Subtract that space value from this space value.
 Time timeFor(Speed v)
          Returns the time needed to move this distance ba a given speed.
 Space times(double f)
          Multiply this space value by a factor.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class jasi.sim.basic.value.AbstractComparableObject
isEQ, isGE, isGT, isLE, isLT, isNE
 
Methods inherited from class jasi.sim.basic.value.AbstractSimValueType
getContent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jasi.sim.basic.value.SimValue
getContent
 

Field Detail

COMPARATOR

public static final java.util.Comparator<Space> COMPARATOR
The space value comparator, which imposes a total ordering.


M

public static final Space M
Space constant for a meter.


MM

public static final Space MM
Space constant for a millimeter.


KM

public static final Space KM
Space constant for a kilometer.


ORIGIN

public static final Space ORIGIN
The center of the space values.


DELTA

public static final Space DELTA
The epsilon constant for equal spaces.

Constructor Detail

Space

public Space(Space s)
Constructor of a space value.

Parameters:
s - A space value.

Space

public Space(java.lang.String s)
Constructor of a space value.

Parameters:
s - The string representation of a space value.
Method Detail

amount

public double amount(Space s)
Retrieve the amount of this space value in units of that space value.

Parameters:
s - That space value.
Returns:
The amount.

add

public Space add(Space s)
Add that space value to this space value.

Parameters:
s - That space value.
Returns:
The sum of the space values.

minus

public Space minus(Space s)
Subtract that space value from this space value.

Parameters:
s - That space value.
Returns:
The difference of the space values.

times

public Space times(double f)
Multiply this space value by a factor.

Parameters:
f - The multiplication factor.
Returns:
The scaled space value.

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
The string.

timeFor

public Time timeFor(Speed v)
Returns the time needed to move this distance ba a given speed.

Parameters:
v - That speed.
Returns:
The time.

divide

public Speed divide(Time t)
Returns the speed for moving this space in a given time.

Parameters:
t - That time.
Returns:
The speed.

hashCode

public int hashCode()
Returns a hash code value for the object. This method is supported for the benefit of hash tables.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this object.

equals

public boolean equals(java.lang.Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class java.lang.Object
Parameters:
o - That object which is compared with this object.
Returns:
True, if this object is the same as that object.

compareTo

public int compareTo(Space s)
Compares this object with the specified object for order. Implementation of jComparable interface.

Specified by:
compareTo in interface java.lang.Comparable<Space>
Specified by:
compareTo in class AbstractComparableObject<Space>
Parameters:
s - The space to be compared.
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than that object.
See Also:
Comparable.compareTo(Object)