com.fdsapi
Class Coordinate

java.lang.Object
  |
  +--com.fdsapi.Coordinate

public class Coordinate
extends java.lang.Object

This class is used to represent an x, y coordinate system by the FormattedDataSet API at runtime to find which DataSet's are registered at a particular coordinate. For example x can correspond to a row and y a column. This object is used to look up other objects in the HashMap.

View Code


Field Summary
 int x
          The x coordinate in an x, y coordinate system.
 int y
          The y coordinate in an x, y coordinate system.
 
Constructor Summary
Coordinate(int x, int y)
           
 
Method Summary
 boolean equals(java.lang.Object compareKey)
          This method is called automatically by a HashMap when this class is used as a HashMap key.
 int hashCode()
          The hashCode function is used by a HashMap to help find a value associated with a key.
 Coordinate setValues(int x, int y)
          This function implements the flyweight pattern.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public int x
The x coordinate in an x, y coordinate system.


y

public int y
The y coordinate in an x, y coordinate system.

Constructor Detail

Coordinate

public Coordinate(int x,
                  int y)
Method Detail

equals

public boolean equals(java.lang.Object compareKey)
This method is called automatically by a HashMap when this class is used as a HashMap key. A Coordinate is considered equal if its x and y variables have the same value.

Overrides:
equals in class java.lang.Object

setValues

public Coordinate setValues(int x,
                            int y)
This function implements the flyweight pattern. This patterns is used to reduce the number of Coordinate objects that need to be created. Instead of calling new Coordinate(), setValue() can be called instead. The flyweight pattern is documented in the "Design Patterns" book by Gamma, Helm, Johnson and Vlissides and published by Addison Wesley.


hashCode

public int hashCode()
The hashCode function is used by a HashMap to help find a value associated with a key. The hash value doesn't need to be unique, but uniqueness improves performance. The technique of multiplying the integers by primary numbers was taken from Java 2 by Ivor Horton.

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object