algoanim.util
Class Offset

java.lang.Object
  extended by algoanim.util.Node
      extended by algoanim.util.Offset

public class Offset
extends Node

This is a concrete kind of a Node. The coordinates are measured from a given offset Primitive. For example, to place an element 20 pixels to the right and 10 pixels below the lower west point of object a, you would use the following: Node n = new Offset(20, 10, a, "SW");

Author:
Jens Pfau

Field Summary
static int ID_REFERENCE
          Constant for an offset based on an identifier
static int NODE_REFERENCE
          Constant for an offset based on a node
static int PRIMITIVE_REFERENCE
          Constant for an offset based on a primitive
 
Constructor Summary
Offset(int xCoordinate, int yCoordinate, Node baseNode, java.lang.String targetDirection)
          Creates a new Offset instance at a distance of (xCoordinate, yCoordinate) in direction "targetDirection" from the base Node "baseNode".
Offset(int xCoordinate, int yCoordinate, Primitive reference, java.lang.String targetDirection)
          Creates a new Offset instance at a distance of (xCoordinate, yCoordinate) in direction "targetDirection" from the base primitive "reference".
Offset(int xCoordinate, int yCoordinate, java.lang.String baseIDRef, java.lang.String targetDirection)
          Creates a new Offset instance at a distance of (xCoordinate, yCoordinate) in direction "targetDirection" from the base reference ID "baseIDRef".
 
Method Summary
 java.lang.String getBaseID()
          Returns the reference.
 java.lang.String getDirection()
          Returns the direction.
 Node getNode()
          Returns the reference.
 Primitive getRef()
          Returns the reference.
 int getReferenceMode()
          Returns the reference mode
 int getX()
          Returns the x-axis offset.
 int getY()
          Returns the y-axis offset.
 
Methods inherited from class algoanim.util.Node
convertToNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIMITIVE_REFERENCE

public static final int PRIMITIVE_REFERENCE
Constant for an offset based on a primitive

See Also:
Constant Field Values

NODE_REFERENCE

public static final int NODE_REFERENCE
Constant for an offset based on a node

See Also:
Constant Field Values

ID_REFERENCE

public static final int ID_REFERENCE
Constant for an offset based on an identifier

See Also:
Constant Field Values
Constructor Detail

Offset

public Offset(int xCoordinate,
              int yCoordinate,
              Primitive reference,
              java.lang.String targetDirection)
Creates a new Offset instance at a distance of (xCoordinate, yCoordinate) in direction "targetDirection" from the base primitive "reference".

Parameters:
xCoordinate - the x-axis offset.
yCoordinate - the y-axis offset.
reference - the referenced Primitive
targetDirection - the relative placement of this Node seen from the reference.

Offset

public Offset(int xCoordinate,
              int yCoordinate,
              Node baseNode,
              java.lang.String targetDirection)
Creates a new Offset instance at a distance of (xCoordinate, yCoordinate) in direction "targetDirection" from the base Node "baseNode".

Parameters:
xCoordinate - the x-axis offset.
yCoordinate - the y-axis offset.
baseNode - the referenced Node
targetDirection - the relative placement of this Node seen from the reference.

Offset

public Offset(int xCoordinate,
              int yCoordinate,
              java.lang.String baseIDRef,
              java.lang.String targetDirection)
Creates a new Offset instance at a distance of (xCoordinate, yCoordinate) in direction "targetDirection" from the base reference ID "baseIDRef".

Parameters:
xCoordinate - the x-axis offset.
yCoordinate - the y-axis offset.
baseIDRef - the referenced identifier
targetDirection - the relative placement of this Node seen from the reference.
Method Detail

getBaseID

public java.lang.String getBaseID()
Returns the reference.

Returns:
the reference.

getDirection

public java.lang.String getDirection()
Returns the direction.

Returns:
the direction.

getNode

public Node getNode()
Returns the reference.

Returns:
the reference.

getRef

public Primitive getRef()
Returns the reference.

Returns:
the reference.

getReferenceMode

public int getReferenceMode()
Returns the reference mode

Returns:
the reference mode (one of the constants ID_REFERENCE, NODE_REFERENCE, PRIMITIVE_REFERENCE

getX

public int getX()
Returns the x-axis offset.

Returns:
the x-axis offset.

getY

public int getY()
Returns the y-axis offset.

Returns:
the y-axis offset.