jasi.sim.geo.cartesian
Class SpaceVec

java.lang.Object
  extended by jasi.sim.geo.GeoObject
      extended by jasi.sim.geo.cartesian.SpaceVec
All Implemented Interfaces:
SimValue, Geometric, java.io.Serializable

public final class SpaceVec
extends GeoObject

Immutable class to represent a space vector.

See Also:
Serialized Form

Nested Class Summary
static class SpaceVec.Distance
          Distance function, which imposes a total ordering of space vectors by comparing the distance to a center.
static class SpaceVec.IndexComparator
          Comparison function, which imposes a total ordering of space vectors by selecting one of the components of the space vector.
 
Field Summary
static SpaceVec ORIGIN
          The origin of three dimensional space.
 
Fields inherited from interface jasi.sim.geo.Geometric
BEGIN, END, MIDLE
 
Constructor Summary
SpaceVec(Space x, Space y)
          Constructor of a space vector, with vanishing third component.
SpaceVec(Space x, Space y, Space z)
          Constructor of a space vector.
SpaceVec(SpaceVec s)
          Constructor of a space vector.
SpaceVec(java.lang.String s)
          Constructor of a space vector.
 
Method Summary
 Space abs()
          Retrieve this space vector's absolute value, i.e. its distance from the origin of space.
 SpaceVec add(SpaceVec p)
          Add that space vector to this space vector.
 Space[] components()
          Get the components of this space vector.
 Direction direction()
          Retrieve this space vector's unit direction to origin of space.
 Space distance(SpaceVec p)
          Retrieve the distance of this space vector from that space vector.
 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.
 SpaceVec minus(SpaceVec p)
          Subtract that space vector from this space vector.
 SpaceVec times(double f)
          Multiply this space vector by a factor.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class jasi.sim.geo.GeoObject
getContent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ORIGIN

public static final SpaceVec ORIGIN
The origin of three dimensional space.

Constructor Detail

SpaceVec

public SpaceVec(Space x,
                Space y,
                Space z)
Constructor of a space vector.

Parameters:
x - First component.
y - Second component.
z - Third component.

SpaceVec

public SpaceVec(SpaceVec s)
Constructor of a space vector.

Parameters:
s - A space vector.

SpaceVec

public SpaceVec(Space x,
                Space y)
Constructor of a space vector, with vanishing third component.

Parameters:
x - First component.
y - Second component.

SpaceVec

public SpaceVec(java.lang.String s)
Constructor of a space vector.

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

distance

public Space distance(SpaceVec p)
Retrieve the distance of this space vector from that space vector.

Parameters:
p - That point.
Returns:
Its distance.

abs

public Space abs()
Retrieve this space vector's absolute value, i.e. its distance from the origin of space.

Returns:
Its distance.

direction

public Direction direction()
Retrieve this space vector's unit direction to origin of space.

Returns:
The direction.

add

public SpaceVec add(SpaceVec p)
Add that space vector to this space vector.

Parameters:
p - That space vector.
Returns:
The sum of the space vectors.

minus

public SpaceVec minus(SpaceVec p)
Subtract that space vector from this space vector.

Parameters:
p - That space vector.
Returns:
The difference of the space vectors.

times

public SpaceVec times(double f)
Multiply this space vector by a factor.

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

components

public Space[] components()
Get the components of this space vector.

Returns:
The components.

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.

toString

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

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