Class PDimension

java.lang.Object
java.awt.geom.Dimension2D
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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    The height of the dimension.
    double
    The width of the dimension.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Returns a dimension with no width or height.
    PDimension(double aWidth, double aHeight)
    Creates a dimension with the provided dimensions.
    PDimension(Dimension2D aDimension)
    Copies the provided dimension.
    Creates a dimension that's the size of a rectangel with the points provided as opposite corners.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the height of the dimension.
    double
    Returns the width of the dimension.
    void
    setSize(double aWidth, double aHeight)
    Resizes the dimension to have the dimensions provided.
    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 Details

    • width

      public double width
      The width of the dimension.
    • height

      public double height
      The height of the dimension.
  • Constructor Details

    • 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 Details

    • 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.