Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.protocol
Class WhiteboardPoint

java.lang.Object
  extended by net.java.sip.communicator.service.protocol.WhiteboardPoint
All Implemented Interfaces:
Cloneable

public class WhiteboardPoint
extends Object
implements Cloneable

A point representing a location in (x,y) coordinate space, specified in integer precision.

This class has been inspired by the java.awt.Point class.

Author:
Julien Waechter, Emil Ivov

Constructor Summary
WhiteboardPoint(double x, double y)
          Constructs and initializes a point at the specified (x,y) location in the coordinate space.
WhiteboardPoint(WhiteboardPoint p)
          Constructs and initializes a point with the same location as the specified Point object.
 
Method Summary
protected  Object clone()
          Creates and returns a copy of this WhiteboardPoint.
 double distance(WhiteboardPoint p)
          Calculates the distance from this point the given point.
 boolean equals(Object obj)
          Determines whether or not two points are equal.
 double getX()
          Returns the X coordinate of this WhiteboardPoint.
 double getY()
          Returns the Y coordinate of this WhiteboardPoint.
 void setX(double x)
          Sets a new value to the x coordinate.
 void setY(double y)
          Sets a new value to the y coordinate.
 String toString()
          Returns a string representation of this point and its location in the (x,y) coordinate space.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WhiteboardPoint

public WhiteboardPoint(WhiteboardPoint p)
Constructs and initializes a point with the same location as the specified Point object.

Parameters:
p - a point

WhiteboardPoint

public WhiteboardPoint(double x,
                       double y)
Constructs and initializes a point at the specified (x,y) location in the coordinate space.

Parameters:
x - the X coordinate of the newly constructed Point
y - the Y coordinate of the newly constructed Point
Since:
1.0
Method Detail

getX

public double getX()
Returns the X coordinate of this WhiteboardPoint.

Returns:
the x coordinate of this WhiteboardPoint.

getY

public double getY()
Returns the Y coordinate of this WhiteboardPoint.

Returns:
the y coordinate of this WhiteboardPoint.

setX

public void setX(double x)
Sets a new value to the x coordinate.

Parameters:
x - the new value of the x coordinate

setY

public void setY(double y)
Sets a new value to the y coordinate.

Parameters:
y - the new value of the y coordinate

equals

public boolean equals(Object obj)
Determines whether or not two points are equal. Two instances of WhiteboardPoint are equal if the values of their x and y member fields, representing their position in the coordinate space, are the same.

Overrides:
equals in class Object
Parameters:
obj - an object to be compared with this WhiteboardPoint
Returns:
true if the object to be compared is an instance of WhiteboardPoint and has the same values; false otherwise.

toString

public String toString()
Returns a string representation of this point and its location in the (x,y) coordinate space. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Overrides:
toString in class Object
Returns:
a string representation of this point

clone

protected Object clone()
Creates and returns a copy of this WhiteboardPoint.

Overrides:
clone in class Object
Returns:
a clone of this WhiteboardPoint instance.

distance

public double distance(WhiteboardPoint p)
Calculates the distance from this point the given point.

Parameters:
p - the point to which to calculate the distance
Returns:
the distance between this point and the given point

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.