public class Dimension2D
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private int |
hash
Cache the hash code to make computing hashes faster.
|
private double |
height
The height of the dimension.
|
private double |
width
The width of the dimension.
|
Constructor and Description |
---|
Dimension2D(double width,
double height)
Constructs a
Dimension2D with the specified width and
height. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
double |
getHeight()
The height of the dimension.
|
double |
getWidth()
The width of the dimension.
|
int |
hashCode()
Returns a hash code value for the Dimension2D object.
|
java.lang.String |
toString()
Returns a string representation of this
Dimension2D . |
private double width
private double height
private int hash
public Dimension2D(double width, double height)
Dimension2D
with the specified width and
height.width
- the widthheight
- the heightpublic final double getWidth()
public final double getHeight()
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()
Dimension2D
.
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