JHotDraw 7.1

org.jhotdraw.geom
Class Insets2D

java.lang.Object
  extended by org.jhotdraw.geom.Insets2D
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Insets2D.Double, Insets2D.Float

public abstract class Insets2D
extends java.lang.Object
implements java.lang.Cloneable

Insets2D.

Version:
1.0 December 6, 2006 Refactored from Insets2DDouble to better match expectations of people used to the java.awt.geom.xxx2D.Double/xxx2D.Float idioms.
Author:
Werner Randelshofer

Nested Class Summary
static class Insets2D.Double
          The Double class defines insets specified in double precision.
static class Insets2D.Float
          The Float class defines insets specified in float precision.
 
Constructor Summary
protected Insets2D()
          Creates a new instance.
 
Method Summary
 void add(double top, double left, double bottom, double right)
          Adds the specified insets to the current insets.
 void add(Insets2D i)
          Adds the specified insets to the current insets.
 void addTo(java.awt.geom.Rectangle2D r)
          Adds the current insets to the specified Rectangle2D making the rectangle larger.
 java.lang.Object clone()
          Creates a new object of the same class as this object.
 boolean equals(java.lang.Object obj)
          Checks whether two insets objects are equal.
abstract  double getBottom()
          Returns the bottom insets in double precision.
abstract  double getLeft()
          Returns the left insets in double precision.
abstract  double getRight()
          Returns the right insets in double precision.
abstract  double getTop()
          Returns the top insets in double precision.
 int hashCode()
          Returns the hash code for this Insets2DDouble.
abstract  void set(double top, double left, double bottom, double right)
          Sets the insets.
 void set(Insets2D i)
          Sets the insets.
 void subtract(double top, double left, double bottom, double right)
          Subtracts the specified insets from the current insets.
 void subtract(Insets2D i)
          Subtracts the specified insets from the current insets.
 void subtractTo(java.awt.geom.Rectangle2D r)
          Subtracts the current insets to the specified Rectangle2D making the rectangle smaller.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Insets2D

protected Insets2D()
Creates a new instance.

Method Detail

getTop

public abstract double getTop()
Returns the top insets in double precision.

Returns:
the top insets of this Insets2D.

getLeft

public abstract double getLeft()
Returns the left insets in double precision.

Returns:
the left insets of this Insets2D.

getBottom

public abstract double getBottom()
Returns the bottom insets in double precision.

Returns:
the bottom insets of this Insets2D.

getRight

public abstract double getRight()
Returns the right insets in double precision.

Returns:
the right insets of this Insets2D.

set

public abstract void set(double top,
                         double left,
                         double bottom,
                         double right)
Sets the insets.

Parameters:
top - The top insets.
left - The left insets.
bottom - The bottom insets.
right - The right insets.

set

public void set(Insets2D i)
Sets the insets.

Parameters:
i - The new insets.

add

public void add(double top,
                double left,
                double bottom,
                double right)
Adds the specified insets to the current insets.

Parameters:
top - The top insets.
left - The left insets.
bottom - The bottom insets.
right - The right insets.

add

public void add(Insets2D i)
Adds the specified insets to the current insets.

Parameters:
i - The insets to be added.

addTo

public void addTo(java.awt.geom.Rectangle2D r)
Adds the current insets to the specified Rectangle2D making the rectangle larger.

Parameters:
r - The Rectangle2D.

subtract

public void subtract(double top,
                     double left,
                     double bottom,
                     double right)
Subtracts the specified insets from the current insets.

Parameters:
top - The top insets.
left - The left insets.
bottom - The bottom insets.
right - The right insets.

subtract

public void subtract(Insets2D i)
Subtracts the specified insets from the current insets.

Parameters:
i - The insets to be subtracted.

subtractTo

public void subtractTo(java.awt.geom.Rectangle2D r)
Subtracts the current insets to the specified Rectangle2D making the rectangle smaller.

Parameters:
r - The Rectangle2D.

equals

public boolean equals(java.lang.Object obj)
Checks whether two insets objects are equal. Two instances of Insets2DDouble are equal if the four integer values of the fields top, left, bottom, and right are all equal.

Overrides:
equals in class java.lang.Object
Returns:
true if the two insets are equal; otherwise false.
Since:
JDK1.1

hashCode

public int hashCode()
Returns the hash code for this Insets2DDouble.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this Insets2DDouble.

clone

public java.lang.Object clone()
Creates a new object of the same class as this object.

Overrides:
clone in class java.lang.Object

Copyright 1996-2007 (c) JHotDraw.org.
Some rights reserved.