org.elkoserver.server.context
Class CartesianPosition

java.lang.Object
  extended by org.elkoserver.server.context.CartesianPosition
All Implemented Interfaces:
Encodable, Position

public class CartesianPosition
extends Object
implements Position

Position class representing an integer (x,y) coordinate on a plane.


Constructor Summary
CartesianPosition(int x, int y)
          JSON-driven constructor.
 
Method Summary
 JSONLiteral encode(EncodeControl control)
          Encode this position for transmission or persistence.
 int x()
          Obtain the X-coordinate of this position.
 int y()
          Obtain the Y-coordinate of this position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CartesianPosition

@JSONMethod(value={"x","y"})
public CartesianPosition(int x,
                                         int y)
JSON-driven constructor.

Parameters:
x - X-coordinate
y - Y-coordinate
Method Detail

encode

public JSONLiteral encode(EncodeControl control)
Encode this position for transmission or persistence.

Specified by:
encode in interface Encodable
Parameters:
control - Encode control determining what flavor of encoding should be done.
Returns:
a JSON literal representing this position.

x

public int x()
Obtain the X-coordinate of this position.

Returns:
this position's X-coordinate.

y

public int y()
Obtain the Y-coordinate of this position.

Returns:
this position's Y-coordinate.