org.pentaho.reporting.engine.classic.core.util.geom
Class StrictDimension

java.lang.Object
  extended by org.pentaho.reporting.engine.classic.core.util.geom.StrictDimension
All Implemented Interfaces:
Serializable, Cloneable

public class StrictDimension
extends Object
implements Serializable, Cloneable

A dimension object that uses micro-points as units of measurement.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
StrictDimension()
          Default-Constructor.
StrictDimension(long width, long height)
          Creates a new dimension object with the given width and height.
 
Method Summary
 Object clone()
          Creates a copy of this object.
 boolean equals(Object o)
          Checks whether the given object is a StrictDimension instance convering the same area as this dimension.
 long getHeight()
          Returns the height of this dimension object.
 StrictDimension getLockedInstance()
          Returns a copy of this dimension which cannot be modified anymore.
 StrictDimension getUnlockedInstance()
          Returns a copy of this dimension which can be modified later.
 long getWidth()
          Returns the width of this dimension object.
 int hashCode()
          Computes the hashcode for this dimension.
 boolean isLocked()
          Checks whether this instance is locked.
 void setHeight(long height)
          Updates the height of this dimension object.
 void setSize(long width, long height)
          Sets the size of this Dimension object to the specified width and height.
 void setWidth(long width)
          Updates the width of this dimension object.
 String toString()
          Returns a String representation of this dimension object.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StrictDimension

public StrictDimension()
Default-Constructor.


StrictDimension

public StrictDimension(long width,
                       long height)
Creates a new dimension object with the given width and height. The object is not locked.

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

isLocked

public boolean isLocked()
Checks whether this instance is locked.

Returns:
true, if the dimension object is locked, false otherwise.

getLockedInstance

public StrictDimension getLockedInstance()
Returns a copy of this dimension which cannot be modified anymore.

Returns:
a locked copy.

getUnlockedInstance

public StrictDimension getUnlockedInstance()
Returns a copy of this dimension which can be modified later.

Returns:
an unlocked copy.

setSize

public void setSize(long width,
                    long height)
Sets the size of this Dimension object to the specified width and height.

Parameters:
width - the new width for the Dimension object
height - the new height for the Dimension object
Throws:
IllegalStateException - if the dimension object is locked

getHeight

public long getHeight()
Returns the height of this dimension object.

Returns:
the height.

setHeight

public void setHeight(long height)
Updates the height of this dimension object.

Parameters:
height - the new height, given in micro-points.

getWidth

public long getWidth()
Returns the width of this dimension object.

Returns:
the width.

setWidth

public void setWidth(long width)
Updates the width of this dimension object.

Parameters:
width - the new width, given in micro-points.

clone

public Object clone()
Creates a copy of this object. This method is guaranteed to never throw a CloneNotSupportedException.

Overrides:
clone in class Object
Returns:
the cloned copy.

toString

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

Overrides:
toString in class Object
Returns:
a string describing the object.

equals

public boolean equals(Object o)
Checks whether the given object is a StrictDimension instance convering the same area as this dimension.

Overrides:
equals in class Object
Parameters:
o - the other object.
Returns:
true, if the other object is equal to this object, false otherwise.

hashCode

public int hashCode()
Computes the hashcode for this dimension.

Overrides:
hashCode in class Object
Returns:
the computed hashcode.