com.yospace.yae.yogi
Class Dimension
java.lang.Object
|
+--com.yospace.yae.yogi.Dimension
- public class Dimension
- extends java.lang.Object
The Dimension class encapsulates the width and
height of a component (in integer precision) in a single object.
|
Field Summary |
int |
height
The height dimension. |
int |
width
The width dimension. |
|
Constructor Summary |
Dimension()
Creates an instance of Dimension with a width
of zero and a height of zero. |
Dimension(Dimension d)
Creates an instance of Dimension whose width
and height are the same as for the specified Dimension. |
Dimension(int width,
int height)
Constructs a Dimension 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. |
static Dimension |
parseDimension(java.lang.String s)
Parses a string representation of a Dimension object. |
java.lang.String |
toString()
Override of the standard toString() method. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
width
public int width
- The width dimension. Negative values can be used.
height
public int height
- The height dimension. Negative values can be used.
Dimension
public Dimension()
- Creates an instance of
Dimension with a width
of zero and a height of zero.
Dimension
public Dimension(Dimension d)
- Creates an instance of
Dimension whose width
and height are the same as for the specified Dimension.
- Parameters:
d - the specified Dimension.
Dimension
public Dimension(int width,
int height)
- Constructs a Dimension and initializes it to the specified width and
specified height.
- Parameters:
width - the desired Dimension width.height - the desired Dimension height.
equals
public boolean equals(java.lang.Object obj)
- Checks whether two dimension objects have equal values.
- Overrides:
equals in class java.lang.Object
- Parameters:
obj - the Object to compare against. The Object has to be a Dimension.- Returns:
- whether the objects are the same or not.
toString
public java.lang.String toString()
- Override of the standard
toString() method. Builds a String that is the width followed by the
height separated by a ",".
- Overrides:
toString in class java.lang.Object
- Returns:
- a String representation of this object.
parseDimension
public static Dimension parseDimension(java.lang.String s)
- Parses a string representation of a Dimension object.
A valid string is a comma-separated pair of values representing the
width and height of the object. null is returned if the string is invalid.
E.G. "3,6"
- Parameters:
s - the String representation of the dimension.- Returns:
- the generated Dimension object.