JHotDraw 7.1

org.jhotdraw.geom
Class Dimension2DDouble

java.lang.Object
  extended by java.awt.geom.Dimension2D
      extended by org.jhotdraw.geom.Dimension2DDouble
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Dimension2DDouble
extends java.awt.geom.Dimension2D
implements java.io.Serializable

Dimension2DDouble.

Version:
1.0 January 14, 2006 Created.
Author:
Werner Randelshofer
See Also:
Serialized Form

Field Summary
 double height
          The height dimension; negative values can be used.
 double width
          The width dimension; negative values can be used.
 
Constructor Summary
Dimension2DDouble()
          Creates an instance of Dimension2DDouble with a width of zero and a height of zero.
Dimension2DDouble(Dimension2DDouble d)
          Creates an instance of Dimension2DDouble whose width and height are the same as for the specified dimension.
Dimension2DDouble(double width, double height)
          Constructs a Dimension2DDouble and initializes it to the specified width and specified height.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks whether two dimension objects have equal values.
 double getHeight()
          Returns the height of this dimension in double precision.
 Dimension2DDouble getSize()
          Gets the size of this Dimension2DDouble object.
 double getWidth()
          Returns the width of this dimension in double precision.
 int hashCode()
          Returns the hash code for this Dimension2DDouble.
 void setSize(Dimension2DDouble d)
          Sets the size of this Dimension2DDouble object to the specified size.
 void setSize(double width, double height)
          Sets the size of this Dimension2DDouble object to the specified width and height in double precision.
 java.lang.String toString()
          Returns a string representation of the values of this Dimension2DDouble object's height and width fields.
 
Methods inherited from class java.awt.geom.Dimension2D
clone, setSize
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

width

public double width
The width dimension; negative values can be used.

See Also:
getSize(), setSize(double, double)

height

public double height
The height dimension; negative values can be used.

See Also:
getSize(), setSize(double, double)
Constructor Detail

Dimension2DDouble

public Dimension2DDouble()
Creates an instance of Dimension2DDouble with a width of zero and a height of zero.


Dimension2DDouble

public Dimension2DDouble(Dimension2DDouble d)
Creates an instance of Dimension2DDouble whose width and height are the same as for the specified dimension.

Parameters:
d - the specified dimension for the width and height values

Dimension2DDouble

public Dimension2DDouble(double width,
                         double height)
Constructs a Dimension2DDouble and initializes it to the specified width and specified height.

Parameters:
width - the specified width
height - the specified height
Method Detail

getWidth

public double getWidth()
Returns the width of this dimension in double precision.

Specified by:
getWidth in class java.awt.geom.Dimension2D
Returns:
the width of this dimension in double precision

getHeight

public double getHeight()
Returns the height of this dimension in double precision.

Specified by:
getHeight in class java.awt.geom.Dimension2D
Returns:
the height of this dimension in double precision

setSize

public void setSize(double width,
                    double height)
Sets the size of this Dimension2DDouble object to the specified width and height in double precision. Note that if width or height are larger than Integer.MAX_VALUE, they will be reset to Integer.MAX_VALUE.

Specified by:
setSize in class java.awt.geom.Dimension2D
Parameters:
width - the new width for the Dimension2DDouble object
height - the new height for the Dimension2DDouble object

getSize

public Dimension2DDouble getSize()
Gets the size of this Dimension2DDouble object. This method is included for completeness, to parallel the getSize method defined by Component.

Returns:
the size of this dimension, a new instance of Dimension2DDouble with the same width and height
Since:
JDK1.1
See Also:
setSize(double, double), Component.getSize()

setSize

public void setSize(Dimension2DDouble d)
Sets the size of this Dimension2DDouble object to the specified size. This method is included for completeness, to parallel the setSize method defined by Component.

Parameters:
d - the new size for this Dimension2DDouble object
Since:
JDK1.1
See Also:
getSize(), Component.setSize(int, int)

equals

public boolean equals(java.lang.Object obj)
Checks whether two dimension objects have equal values.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns the hash code for this Dimension2DDouble.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this Dimension2DDouble

toString

public java.lang.String toString()
Returns a string representation of the values of this Dimension2DDouble object's height and width fields. 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 java.lang.Object
Returns:
a string representation of this Dimension2DDouble object

Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.