net.infonode.util
Class Direction

java.lang.Object
  extended bynet.infonode.util.Enum
      extended bynet.infonode.util.Direction
All Implemented Interfaces:
Serializable, Writable

public final class Direction
extends Enum

An enum class for directions, up, down, left, right.

Version:
$Revision: 1.6 $
See Also:
Serialized Form

Field Summary
static Direction[] DIRECTIONS
          Array containing all directions.
static Direction DOWN
          Down direction.
static Direction LEFT
          Left direction.
static Direction RIGHT
          Right direction.
static Direction UP
          Up direction.
 
Method Summary
static Direction decode(ObjectInputStream in)
          Decodes a direction from a stream.
static Direction[] getDirections()
          Gets all directions.
 Direction getNextCCW()
          Returns the direction that is one quarter of a revolution counter clock wise.
 Direction getNextCW()
          Returns the direction that is one quarter of a revolution clock wise.
 Direction getOpposite()
          Returns the opposite direction.
 boolean isHorizontal()
          Returns true if the direction is horizontal.
 
Methods inherited from class net.infonode.util.Enum
getName, getValue, toString, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UP

public static final Direction UP
Up direction.


RIGHT

public static final Direction RIGHT
Right direction.


DOWN

public static final Direction DOWN
Down direction.


LEFT

public static final Direction LEFT
Left direction.


DIRECTIONS

public static final Direction[] DIRECTIONS
Array containing all directions.

Method Detail

getNextCW

public Direction getNextCW()
Returns the direction that is one quarter of a revolution clock wise.

Returns:
the direction that is one quarter of a revolution clock wise

getNextCCW

public Direction getNextCCW()
Returns the direction that is one quarter of a revolution counter clock wise.

Returns:
the direction that is one quarter of a revolution counter clock wise

isHorizontal

public boolean isHorizontal()
Returns true if the direction is horizontal.

Returns:
true if the direction is horizontal

getOpposite

public Direction getOpposite()
Returns the opposite direction.

Returns:
the opposite direction

getDirections

public static Direction[] getDirections()
Gets all directions.

Returns:
all directions
Since:
1.1.0

decode

public static Direction decode(ObjectInputStream in)
                        throws IOException
Decodes a direction from a stream.

Parameters:
in - the stream containing the direction
Returns:
the direction
Throws:
IOException - if there is a stream error


Copyright © 2007 NNL Technology AB. All Rights Reserved.