public class WhiteboardPoint
extends java.lang.Object
implements java.lang.Cloneable
(x,y)
coordinate space,
specified in integer precision.
This class has been inspired by the java.awt.Point class.
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.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(java.lang.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.
|
int |
hashCode() |
void |
setX(double x)
Sets a new value to the x coordinate.
|
void |
setY(double y)
Sets a new value to the y coordinate.
|
java.lang.String |
toString()
Returns a string representation of this point and its location
in the
(x,y) coordinate space. |
public WhiteboardPoint(WhiteboardPoint p)
p
- a pointpublic WhiteboardPoint(double x, double y)
x
- the X coordinate of the newly constructed Point
y
- the Y coordinate of the newly constructed Point
public double getX()
public double getY()
public void setX(double x)
x
- the new value of the x coordinatepublic void setY(double y)
y
- the new value of the y coordinatepublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- an object to be compared with this WhiteboardPointpublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
(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
.toString
in class java.lang.Object
protected java.lang.Object clone()
clone
in class java.lang.Object
public double distance(WhiteboardPoint p)
p
- the point to which to calculate the distance
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.