org.mars_sim.msp.simulation
Class Direction

java.lang.Object
  extended by org.mars_sim.msp.simulation.Direction
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Direction
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Direction. Represents an angular direction. It provides some useful static methods involving directions.

See Also:
Serialized Form

Constructor Summary
Direction(double direction)
          Constructs a Direction object 0 = North, clockwise
 
Method Summary
 java.lang.Object clone()
          Clones this Direction object
 boolean equals(java.lang.Object obj)
          Returns true if object is an equal direction
 double getCosDirection()
          Returns the cosine of the direction
 double getDirection()
          Returns direction in radians 0 = North, clockwise
 double getSinDirection()
          Returns the sine of the direction
 int hashCode()
          Gets the hash code for this object.
 void setDirection(double direction)
          Sets the direction 0 = North, clockwise
 java.lang.String toString()
          Gets the string value of the object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Direction

public Direction(double direction)
Constructs a Direction object 0 = North, clockwise

Parameters:
direction - direction in radians
Method Detail

clone

public java.lang.Object clone()
Clones this Direction object

Overrides:
clone in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Returns true if object is an equal direction

Overrides:
equals in class java.lang.Object
Parameters:
obj - an Object instance
Returns:
true if obj is an equal direction

hashCode

public int hashCode()
Gets the hash code for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
hash code.

toString

public java.lang.String toString()
Gets the string value of the object.

Overrides:
toString in class java.lang.Object

getDirection

public double getDirection()
Returns direction in radians 0 = North, clockwise

Returns:
direction in radians

setDirection

public void setDirection(double direction)
Sets the direction 0 = North, clockwise

Parameters:
direction - new direction

getSinDirection

public double getSinDirection()
Returns the sine of the direction

Returns:
the sine of the direction

getCosDirection

public double getCosDirection()
Returns the cosine of the direction

Returns:
the cosine of the direction