edu.umd.cs.piccolo.util
Class PDimension

java.lang.Object
  extended by java.awt.geom.Dimension2D
      extended by edu.umd.cs.piccolo.util.PDimension
All Implemented Interfaces:
Serializable, Cloneable

public class PDimension
extends Dimension2D
implements Serializable

PDimension this class should be removed once a concrete Dimension2D that supports doubles is added to java.

Version:
1.0
Author:
Jesse Grosjean
See Also:
Serialized Form

Field Summary
 double height
          The height of the dimension.
 double width
          The width of the dimension.
 
Constructor Summary
PDimension()
          Returns a dimension with no width or height.
PDimension(Dimension2D aDimension)
          Copies the provided dimension.
PDimension(double aWidth, double aHeight)
          Creates a dimension with the provided dimensions.
PDimension(Point2D p1, Point2D p2)
          Creates a dimension that's the size of a rectangel with the points provided as opposite corners.
 
Method Summary
 double getHeight()
          Returns the height of the dimension.
 double getWidth()
          Returns the width of the dimension.
 void setSize(double aWidth, double aHeight)
          Resizes the dimension to have the dimensions provided.
 String toString()
          Returns a string representation of this dimension object.
 
Methods inherited from class java.awt.geom.Dimension2D
clone, setSize
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

width

public double width
The width of the dimension.


height

public double height
The height of the dimension.

Constructor Detail

PDimension

public PDimension()
Returns a dimension with no width or height.


PDimension

public PDimension(Dimension2D aDimension)
Copies the provided dimension.

Parameters:
aDimension - dimension to copy

PDimension

public PDimension(double aWidth,
                  double aHeight)
Creates a dimension with the provided dimensions.

Parameters:
aWidth - desired width
aHeight - desired height

PDimension

public PDimension(Point2D p1,
                  Point2D p2)
Creates a dimension that's the size of a rectangel with the points provided as opposite corners.

Parameters:
p1 - first point on rectangle
p2 - point diagonally across from p1
Method Detail

getHeight

public double getHeight()
Returns the height of the dimension.

Specified by:
getHeight in class Dimension2D
Returns:
height height of the dimension

getWidth

public double getWidth()
Returns the width of the dimension.

Specified by:
getWidth in class Dimension2D
Returns:
width width of the dimension

setSize

public void setSize(double aWidth,
                    double aHeight)
Resizes the dimension to have the dimensions provided.

Specified by:
setSize in class Dimension2D
Parameters:
aWidth - desired width
aHeight - desired height

toString

public String toString()
Returns a string representation of this dimension object.

Overrides:
toString in class Object
Returns:
string representation of this dimension object.


Copyright © 1995-2011 Piccolo2D. All Rights Reserved.