com.mapquest
Class Point

java.lang.Object
  extended bycom.mapquest.MQObject
      extended bycom.mapquest.Point
All Implemented Interfaces:
java.lang.Cloneable

public class Point
extends MQObject

Encapsulates X and Y coordinates.


Field Summary
static int CLASS_ID
           
static java.lang.String CLASS_NAME
           
 
Fields inherited from class com.mapquest.MQObject
DEFAULT_ID, DEFAULT_NAME, DEFAULT_VERSION, FORMAT_NUMERIC_ID, FORMAT_TEXT_NAME, INVALID_ID, INVALID_NAME, INVALID_VERSION
 
Constructor Summary
Point()
          Default constructor.
Point(int nX, int nY)
          Constructor when it is desired to set the X and Y coordinates.
Point(Point pt)
          Copy constructor.
 
Method Summary
 boolean equals(java.lang.Object otherObject)
          Compares this object to the specified object.
 int getClassId()
          Returns the numeric id of this class.
 java.lang.String getClassName()
          Returns the text name of this class.
 int getX()
          Returns the X value of this point.
 int getY()
          Returns the Y value of this point.
 int hashCode()
          Returns a hash code for this Point.
 void init()
          Initializes object.
 void setX(int sX)
          Sets only the X value.
 void setXY(int nX, int nY)
          Sets the horizontal and vertical coordinates to the values passed in.
 void setY(int sY)
          Sets only the Y value.
 boolean valid()
          Returns a true if both the X and Y coordinates are set to a value other than the static "INVALID" value.
 
Methods inherited from class com.mapquest.MQObject
clone, getFormat, getIdWithVersion, getNameWithVersion, getObjectVersion, getTypeId, getTypeName, getVerboseConsoleOutput, setFormat, setObjectVersion, setVerboseConsoleOutput, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_ID

public static final int CLASS_ID
See Also:
Constant Field Values

CLASS_NAME

public static final java.lang.String CLASS_NAME
See Also:
Constant Field Values
Constructor Detail

Point

public Point()
Default constructor.


Point

public Point(int nX,
             int nY)
Constructor when it is desired to set the X and Y coordinates.

Parameters:
nX - The X coordinate of the point.
nY - The Y coordinate of the point.

Point

public Point(Point pt)
Copy constructor.

Parameters:
pt - The Point object which is to be copied to this Point object.
Method Detail

init

public void init()
Initializes object.

Overrides:
init in class MQObject

getClassId

public int getClassId()
Returns the numeric id of this class.

Overrides:
getClassId in class MQObject
Returns:
the numeric id of this class.

getClassName

public java.lang.String getClassName()
Returns the text name of this class.

Overrides:
getClassName in class MQObject
Returns:
the text name of this class.

setXY

public void setXY(int nX,
                  int nY)
Sets the horizontal and vertical coordinates to the values passed in.

Parameters:
nX - The X coordinate.
nY - The Y coordinate.

setX

public void setX(int sX)
Sets only the X value.

Parameters:
sX - The X value to which the point is to be set.

setY

public void setY(int sY)
Sets only the Y value.

Parameters:
sY - The Y value to which the point is to be set.

getX

public int getX()
Returns the X value of this point.

Returns:
The X value of this point.

getY

public int getY()
Returns the Y value of this point.

Returns:
The Y value of this point.

valid

public boolean valid()
Returns a true if both the X and Y coordinates are set to a value other than the static "INVALID" value.

Returns:
true if both the X and Y coordinates are not equal to the static "INVALID", false otherwise.

equals

public boolean equals(java.lang.Object otherObject)
Compares this object to the specified object. The result is true if and only if the argument is not null and is a Point object that has same attributes as this object.

Overrides:
equals in class MQObject
Parameters:
otherObject - the object to compare this Point against.
Returns:
true if the Point objects are equal; false otherwise.

hashCode

public int hashCode()
Returns a hash code for this Point.

Overrides:
hashCode in class MQObject
Returns:
a hash code value for this Point.