public class WZPoint extends Object implements Comparable<WZPoint>, Serializable
WZPoint
class represents an integer-based two-dimensional coordinate.
WZPoint pt1 = new WZPoint(200, 300);
WZPoint pt2 = new WZPoint(287, 543);
double distanceApart = pt1.distanceTo(pt2);
Modifier and Type | Field and Description |
---|---|
int |
x
The x coordinate of the point
|
int |
y
The y coordinate of the point
|
Constructor and Description |
---|
WZPoint()
The default constructor
|
WZPoint(int x,
int y)
Construct a new instance using the specified property values
|
WZPoint(WZPoint other)
Construct a new instance using the property values from the specified instance
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(int x,
int y)
Compare this property values of this instance with the specified values
|
int |
compareTo(WZPoint other)
Compare this instance with the specified instance
|
static double |
distance(int x1,
int y1,
int x2,
int y2)
Calculates the distance between two points
|
double |
distanceTo(int x,
int y)
Calculates the distance between this point and the specified values
|
double |
distanceTo(WZPoint other)
Calculates the distance between this point and the specified instance
|
boolean |
equals(int x,
int y)
Compare the property values of this instance with the specified values for equality
|
boolean |
equals(int x1,
int y1,
int x2,
int y2)
Compare two points for equality
|
boolean |
equals(Object other)
Compare this instance with the specified instance for equality
|
int |
getX() |
int |
getY() |
void |
invert()
Invert the coordinate values of this instance
|
WZPoint |
inverted()
Create a new "inverted" version of this instance with the coordinate values reversed
|
static String |
label(int x,
int y)
Returns a human-readable description of the specified values
|
void |
set(int x,
int y)
Update the property values of this instance with the specified values
|
void |
set(WZPoint other)
Update the property values of this instance with the property values from the specified instance
|
void |
setX(int x)
Update the x coordinate property value
|
void |
setY(int y)
Update the y coordinate property value
|
String |
toString()
Returns a human-readable description of this instance
|
public int x
public int y
public WZPoint()
public WZPoint(int x, int y)
x
- The value for the x coordinatey
- The value fot the y coordinatepublic WZPoint(WZPoint other)
other
- The instance to replicatepublic boolean equals(int x1, int y1, int x2, int y2)
x1
- The x coordinate of the first pointy1
- The y coordinate of the first pointx2
- The x coordinate of the second pointy2
- The y coordinate of the second pointtrue
is the points are equal, false
otherwisepublic static double distance(int x1, int y1, int x2, int y2)
x1
- The x coordinate of the first pointy1
- The y coordinate of the first pointx2
- The x coordinate of the second pointy2
- The y coordinate of the second pointpublic static String label(int x, int y)
public int getX()
public void setX(int x)
x
- The value for the x coordinatepublic int getY()
public void setY(int y)
y
- The value for the y coordinatepublic void set(int x, int y)
x
- The value for the x coordinatey
- The value for the y coordinatepublic void set(WZPoint other)
other
- The instance with the property values to replicatepublic boolean equals(int x, int y)
x
- The value for the x coordinatey
- The value for the y coordinatetrue
> is the values are equal, false
> otherwisepublic boolean equals(Object other)
public int compareTo(int x, int y)
x
- The value for the x coordinatey
- The value for the y coordinatepublic int compareTo(WZPoint other)
compareTo
in interface Comparable<WZPoint>
other
- The instance to be used for comparisonpublic String toString()
public WZPoint inverted()
public void invert()
public double distanceTo(int x, int y)
x
- The value for the x coordinatey
- The value for the y coordinatepublic double distanceTo(WZPoint other)
other
- The instance to use for the calculation© 2016 Wowza Media Systems, LLC. All rights reserved. Terms | Privacy | Trademarks | Legal