Search this API

y.layout
Class Direction

java.lang.Object
  extended by y.layout.Direction

public final class Direction
extends Object

Class that represents directions. Note: for each direction there exists exactly one object.


Field Summary
static Direction DOWN
          Decodes the down direction
static Direction LEFT
          Decodes the left direction
static Direction RIGHT
          Decodes the right direction
static Direction UP
          Decodes the up direction
 
Method Summary
 int getDirection()
          Returns the direction as int value.
 Direction getMirror()
          Returns the mirror direction (turns the direction two times).
 Direction getTurnCCW()
          Returns the direction that follows this direction in counterclockwise order.
 Direction getTurnCW()
          Returns the direction that follows this direction in clockwise order.
 boolean isHorizontal()
          Returns true if this direction is horizontal (right or left).
 boolean isVertical()
          Returns true if this direction is vertical (up or down).
 String toString()
          Returns the current direction as string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UP

public static final Direction UP
Decodes the up direction


RIGHT

public static final Direction RIGHT
Decodes the right direction


DOWN

public static final Direction DOWN
Decodes the down direction


LEFT

public static final Direction LEFT
Decodes the left direction

Method Detail

getTurnCW

public Direction getTurnCW()
Returns the direction that follows this direction in clockwise order.

Returns:
the direction that follows this direction in clockwise order.

getTurnCCW

public Direction getTurnCCW()
Returns the direction that follows this direction in counterclockwise order.

Returns:
the direction that follows this direction in counterclockwise order.

getMirror

public Direction getMirror()
Returns the mirror direction (turns the direction two times).

Returns:
the mirror direction.

isHorizontal

public boolean isHorizontal()
Returns true if this direction is horizontal (right or left).


isVertical

public boolean isVertical()
Returns true if this direction is vertical (up or down).


getDirection

public int getDirection()
Returns the direction as int value.

Returns:
0 for UP, 1 for RIGHT, 2 for DOWN, and 3 for LEFT.

toString

public String toString()
Returns the current direction as string.

Overrides:
toString in class Object
Returns:
^ for UP, > for RIGHT, v for DOWN, and < for LEFT.

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.