Spec-Zone .ru
спецификации, руководства, описания, API
|
public class Point2D
extends java.lang.Object
Constructor and Description |
---|
Point2D(double x,
double y)
Creates a new instance of
Point2D . |
Modifier and Type | Method and Description |
---|---|
double |
distance(double x1,
double y1)
Computes the distance between this point and point
(x1, y1) . |
double |
distance(Point2D p)
Computes the distance between this point and point
p . |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
double |
getX()
The x coordinate.
|
double |
getY()
The y coordinate.
|
int |
hashCode()
Returns a hash code value for the point.
|
java.lang.String |
toString()
Returns a string representation of this
Point2D . |
public Point2D(double x, double y)
Point2D
.x
- the x coordinate of the pointy
- the y coordinate of the pointpublic final double getX()
public final double getY()
public double distance(double x1, double y1)
(x1, y1)
.x1
- the x coordinate of other pointy1
- the y coordinate of other point(x1, y1)
.public double distance(Point2D p)
p
.p
- the other pointp
.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the reference object with which to comparepublic int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
Point2D
.
This method is intended to be used only for informational purposes.
The content and format of the returned string might vary between
implementations.
The returned string might be empty but cannot be null
.toString
in class java.lang.Object
Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. Use is subject to