com.swfm.mica.core
Class MiMargins

java.lang.Object
  extended bycom.swfm.mica.core.MiMargins

public class MiMargins
extends java.lang.Object

Version:
%I% %G%
Author:
Michael L. Davis

Field Summary
 double bottom
           
 double left
           
 double right
           
 double top
           
 
Constructor Summary
MiMargins()
          Constructs a new MiMargins.
MiMargins(double d)
          Constructs a new MiMargins.
MiMargins(double left, double bottom, double right, double top)
          Constructs a new MiMargins.
MiMargins(MiMargins other)
          Constructs a new MiMargins that is a copy of the given margin.
 
Method Summary
 void addMargins(double margin)
          Adds the distance to each side of these margins.
 void addMargins(MiMargins other)
          Adds the components of the given margins to this.
 void copy(MiMargins other)
          Copies the components of the given margins.
 boolean equals(MiMargins other)
          Gets whether the given MiMargins is equal to this MiMargins.
 double getBottom()
          Returns the distance assigned to the bottom side of these margins.
 double getHeight()
          Returns the combined height of these margins (i.e.
 double getLeft()
          Returns the distance assigned to the left side of these margins.
 double getRight()
          Returns the distance assigned to the right side of these margins.
 double getTop()
          Returns the distance assigned to the top side of these margins.
 double getWidth()
          Returns the combined width of these margins (i.e.
 void setMargins(double d)
          Set the margins in all 4 directions to the given value.
 void setMargins(double left, double bottom, double right, double top)
          Set the margins to the given values.
 void subtractMargins(double margin)
          Subtracts the distance to each side of these margins.
 java.lang.String toString()
          Return text that describes these margins.
 void union(MiMargins m)
          Assigns a distance to each side of these margins the maximum of each side and the value of the corresponding side found in the given margins.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

left

public double left

bottom

public double bottom

right

public double right

top

public double top
Constructor Detail

MiMargins

public MiMargins()
Constructs a new MiMargins.


MiMargins

public MiMargins(MiMargins other)
Constructs a new MiMargins that is a copy of the given margin.

Parameters:
other - the margin to copy

MiMargins

public MiMargins(double d)
Constructs a new MiMargins.

Parameters:
d - the distance assigned to the left right, top and bottom margins

MiMargins

public MiMargins(double left,
                 double bottom,
                 double right,
                 double top)
Constructs a new MiMargins.

Parameters:
left - the left margin
bottom - the bottom margin
right - the right margin
top - the top margin
Method Detail

setMargins

public void setMargins(double d)
Set the margins in all 4 directions to the given value.

Parameters:
d - the distance assigned to each margin.

setMargins

public void setMargins(double left,
                       double bottom,
                       double right,
                       double top)
Set the margins to the given values.

Parameters:
left - the left margin
bottom - the bottom margin
right - the right margin
top - the top margin

addMargins

public void addMargins(MiMargins other)
Adds the components of the given margins to this.

Parameters:
other - the margins to add to this one

addMargins

public void addMargins(double margin)
Adds the distance to each side of these margins.

Parameters:
margin - the margins to add to this one

subtractMargins

public void subtractMargins(double margin)
Subtracts the distance to each side of these margins.

Parameters:
margin - the margins to subtract from this one

union

public void union(MiMargins m)
Assigns a distance to each side of these margins the maximum of each side and the value of the corresponding side found in the given margins.


copy

public void copy(MiMargins other)
Copies the components of the given margins.

Parameters:
other - the margins to copy

equals

public boolean equals(MiMargins other)
Gets whether the given MiMargins is equal to this MiMargins.

Parameters:
other - the margins to compare to

getWidth

public double getWidth()
Returns the combined width of these margins (i.e. left + right).

Returns:
the combined width of these margins

getHeight

public double getHeight()
Returns the combined height of these margins (i.e. bottom + top).

Returns:
the combined height of these margins

getLeft

public double getLeft()
Returns the distance assigned to the left side of these margins.

Returns:
the left side distance

getRight

public double getRight()
Returns the distance assigned to the right side of these margins.

Returns:
the right side distance

getTop

public double getTop()
Returns the distance assigned to the top side of these margins.

Returns:
the top side distance

getBottom

public double getBottom()
Returns the distance assigned to the bottom side of these margins.

Returns:
the bottom side distance

toString

public java.lang.String toString()
Return text that describes these margins.