MATES 3.0-rc2

org.mates.util
Class Position2D

java.lang.Object
  extended byorg.mates.util.Position
      extended byorg.mates.util.Position2D
All Implemented Interfaces:
java.lang.Cloneable

public class Position2D
extends Position
implements java.lang.Cloneable

Class for storing a position in Euclidean space.

Author:
Evan Sultanik

Constructor Summary
Position2D(double x, double y)
          Creates a new Position object.
 
Method Summary
 java.lang.Object clone()
           
 double distanceTo(Position position)
          Returns the distance from this position to position (i.e.
 double getX()
          Returns the x coordinate of this position.
 double getY()
          Returns the y coordinate of this position.
 void setX(double newx)
          Sets the x coordinate of this position.
 void setY(double newy)
          Sets the y coordinate of this position.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Position2D

public Position2D(double x,
                  double y)
Creates a new Position object.

Method Detail

getX

public double getX()
Returns the x coordinate of this position.


getY

public double getY()
Returns the y coordinate of this position.


setX

public void setX(double newx)
Sets the x coordinate of this position.


setY

public void setY(double newy)
Sets the y coordinate of this position.


distanceTo

public double distanceTo(Position position)
Returns the distance from this position to position (i.e. the L2-Norm of the positions). The argument is expected to be another instance of Position2D.

Specified by:
distanceTo in class Position
Throws:
java.lang.IllegalArgumentException - if position is not an instance of Position2D.

clone

public java.lang.Object clone()
Specified by:
clone in class Position

toString

public java.lang.String toString()

MATES 3.0-rc2

Submit a bug or request a feature
http://mates.sourceforge.net/

Copyright 2004 Evan Sultanik