mathcomp.gridgeom
Class Node

java.lang.Object
  extended by mathcomp.gridgeom.Node
All Implemented Interfaces:
java.lang.Comparable, Geometric
Direct Known Subclasses:
GhostNode

public class Node
extends java.lang.Object
implements java.lang.Comparable, Geometric

A node consists of an x and an y coordinate.

Author:
pht

Constructor Summary
Node()
          Creates an origo.
Node(double x, double y)
          Creates an node at (x,y)
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object o)
           
 double getDistanceTo(Node k)
          Calculates euclidian distance to k.
 double getX()
          Returns the x.
 double getY()
          Returns the y.
 int hashCode()
           
 Node node(int i)
          Returns the i-th node.
 int nodesCount()
          Number of nodes.
 java.lang.String toString()
           
 void update(double x, double y)
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node()
Creates an origo.


Node

public Node(double x,
            double y)
Creates an node at (x,y)

Parameters:
x -
y -
Method Detail

getX

public double getX()
Returns the x.

Returns:
double

getY

public double getY()
Returns the y.

Returns:
double

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

toString

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

getDistanceTo

public double getDistanceTo(Node k)
Calculates euclidian distance to k.

Parameters:
k -
Returns:
euclidian distance to k

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

nodesCount

public int nodesCount()
Description copied from interface: Geometric
Number of nodes.

Specified by:
nodesCount in interface Geometric
Returns:
number of nodes

node

public Node node(int i)
Description copied from interface: Geometric
Returns the i-th node.

Specified by:
node in interface Geometric
Returns:
i-th node

update

public void update(double x,
                   double y)