y.geom
Class YDimension

java.lang.Object
  |
  +--y.geom.YDimension
All Implemented Interfaces:
Comparable
Direct Known Subclasses:
YRectangle

public class YDimension
extends Object
implements Comparable

This class represents the size of an object. An instance of this class implements the immutable design pattern.


Field Summary
 double height
          the height of the dimension
 double width
          the width of the dimension
 
Constructor Summary
YDimension(double width, double height)
          Creates a new YDimension2D object for given size.
 
Method Summary
 int compareTo(Object o)
           
 boolean equals(Object o)
          Tests a dimension to equality to another dimension.
 double getHeight()
          Get the height of the dimension object.
 double getWidth()
          Get the width of the dimension object.
 int hashCode()
           
 String toString()
          Returns the size in the form: "W: width H: heigth"
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

width

public final double width
the width of the dimension


height

public final double height
the height of the dimension

Constructor Detail

YDimension

public YDimension(double width,
                  double height)
Creates a new YDimension2D object for given size.

Method Detail

getWidth

public final double getWidth()
Get the width of the dimension object.


getHeight

public final double getHeight()
Get the height of the dimension object.


equals

public boolean equals(Object o)
Tests a dimension to equality to another dimension.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Returns the size in the form: "W: width H: heigth"

Overrides:
toString in class Object

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

© Copyright 2000-2003,
yWorks GmbH.
All rights reserved.

2003