org.kaboum.util
Class KaboumCoordinate

java.lang.Object
  extended by org.kaboum.util.KaboumCoordinate

public class KaboumCoordinate
extends java.lang.Object

This class define a 2D coordinate

Author:
Jérôme Gasperi aka jrom

Field Summary
static int K_TYPE_BOX
           
static int K_TYPE_CIRCLE
           
static int K_TYPE_IMAGE
           
static int K_TYPE_POINT
          Constants definition
 double x
          X coordinate
 double y
          Y coordinate
 
Constructor Summary
KaboumCoordinate()
          Constructor
KaboumCoordinate(double x, double y)
          Constructor
KaboumCoordinate(KaboumCoordinate coord)
          Sort of copy constructor
 
Method Summary
 java.lang.Object clone()
           
 int compareTo(KaboumCoordinate o)
          Compares this object with the specified object for order.
 double distance(KaboumCoordinate internal)
          Return the distance from this coordinate to the input one
 boolean equals(KaboumCoordinate other)
          Check if other other coordinate equals this coordinate
 void moveTo(double x, double y)
          Move a point to the current position
 void moveTo(KaboumCoordinate internal)
          Move a point to the current position
static int stoi(java.lang.String str)
          Convert an input string to the corresponding int value
 java.lang.String write()
          Return a string of the location of the point Format: x, y
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

K_TYPE_POINT

public static final int K_TYPE_POINT
Constants definition

See Also:
Constant Field Values

K_TYPE_BOX

public static final int K_TYPE_BOX
See Also:
Constant Field Values

K_TYPE_CIRCLE

public static final int K_TYPE_CIRCLE
See Also:
Constant Field Values

K_TYPE_IMAGE

public static final int K_TYPE_IMAGE
See Also:
Constant Field Values

x

public double x
X coordinate


y

public double y
Y coordinate

Constructor Detail

KaboumCoordinate

public KaboumCoordinate()
Constructor


KaboumCoordinate

public KaboumCoordinate(double x,
                        double y)
Constructor

Parameters:
x - X coordinate
y - Y coordinate

KaboumCoordinate

public KaboumCoordinate(KaboumCoordinate coord)
Sort of copy constructor

Parameters:
cp - Control point
Method Detail

moveTo

public void moveTo(double x,
                   double y)
Move a point to the current position

Parameters:
x - X coordinate (map)
y - Y coordinate (map)

moveTo

public void moveTo(KaboumCoordinate internal)
Move a point to the current position

Parameters:
internal - Coordinate

distance

public double distance(KaboumCoordinate internal)
Return the distance from this coordinate to the input one

Parameters:
internal - Input coordinate

equals

public boolean equals(KaboumCoordinate other)
Check if other other coordinate equals this coordinate

Parameters:
other - an other coordinate to check equality
Returns:
true if other this coordinate id equals to other

write

public java.lang.String write()
Return a string of the location of the point Format: x, y


clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

compareTo

public int compareTo(KaboumCoordinate o)
Compares this object with the specified object for order.

Parameters:
o - the Coordinate with which this Coordinate is being compared
Returns:
a negative integer, zero, or a positive integer as this Coordinate is less than, equal to, or greater than the specified Coordinate

stoi

public static int stoi(java.lang.String str)
Convert an input string to the corresponding int value



Copyright © 2005 Kaboum team. All Rights Reserved.