Package org.jfree.chart.axis
Class AxisSpace
- java.lang.Object
-
- org.jfree.chart.axis.AxisSpace
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,PublicCloneable
public class AxisSpace extends java.lang.Object implements java.lang.Cloneable, PublicCloneable, java.io.Serializable
A record that contains the space required at each edge of a plot.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private doublebottomThe bottom space.private doubleleftThe left space.private doublerightThe right space.private static longserialVersionUIDFor serialization.private doubletopThe top space.
-
Constructor Summary
Constructors Constructor Description AxisSpace()Creates a new axis space record.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(double space, RectangleEdge edge)Adds space to the top, bottom, left or right edge of the plot area.java.lang.Objectclone()Returns a clone of the object.voidensureAtLeast(double space, RectangleEdge edge)Ensures there is a minimum amount of space at the edge corresponding to the specified axis location.voidensureAtLeast(AxisSpace space)Ensures that this object reserves at least as much space as another.booleanequals(java.lang.Object obj)Tests this object for equality with another object.java.awt.geom.Rectangle2Dexpand(java.awt.geom.Rectangle2D area, java.awt.geom.Rectangle2D result)Expands an area by the amount of space represented by this object.doublegetBottom()Returns the space reserved for axes at the bottom of the plot area.doublegetLeft()Returns the space reserved for axes at the left of the plot area.doublegetRight()Returns the space reserved for axes at the right of the plot area.doublegetTop()Returns the space reserved for axes at the top of the plot area.inthashCode()Returns a hash code for this object.java.awt.geom.Rectangle2Dreserved(java.awt.geom.Rectangle2D area, RectangleEdge edge)Calculates the reserved area.voidsetBottom(double space)Sets the space reserved for axes at the bottom of the plot area.voidsetLeft(double space)Sets the space reserved for axes at the left of the plot area.voidsetRight(double space)Sets the space reserved for axes at the right of the plot area.voidsetTop(double space)Sets the space reserved for axes at the top of the plot area.java.awt.geom.Rectangle2Dshrink(java.awt.geom.Rectangle2D area, java.awt.geom.Rectangle2D result)Shrinks an area by the space attributes.java.lang.StringtoString()Returns a string representing the object (for debugging purposes).
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
top
private double top
The top space.
-
bottom
private double bottom
The bottom space.
-
left
private double left
The left space.
-
right
private double right
The right space.
-
-
Method Detail
-
getTop
public double getTop()
Returns the space reserved for axes at the top of the plot area.- Returns:
- The space (in Java2D units).
-
setTop
public void setTop(double space)
Sets the space reserved for axes at the top of the plot area.- Parameters:
space- the space (in Java2D units).
-
getBottom
public double getBottom()
Returns the space reserved for axes at the bottom of the plot area.- Returns:
- The space (in Java2D units).
-
setBottom
public void setBottom(double space)
Sets the space reserved for axes at the bottom of the plot area.- Parameters:
space- the space (in Java2D units).
-
getLeft
public double getLeft()
Returns the space reserved for axes at the left of the plot area.- Returns:
- The space (in Java2D units).
-
setLeft
public void setLeft(double space)
Sets the space reserved for axes at the left of the plot area.- Parameters:
space- the space (in Java2D units).
-
getRight
public double getRight()
Returns the space reserved for axes at the right of the plot area.- Returns:
- The space (in Java2D units).
-
setRight
public void setRight(double space)
Sets the space reserved for axes at the right of the plot area.- Parameters:
space- the space (in Java2D units).
-
add
public void add(double space, RectangleEdge edge)Adds space to the top, bottom, left or right edge of the plot area.- Parameters:
space- the space (in Java2D units).edge- the edge (nullnot permitted).
-
ensureAtLeast
public void ensureAtLeast(AxisSpace space)
Ensures that this object reserves at least as much space as another.- Parameters:
space- the other space.
-
ensureAtLeast
public void ensureAtLeast(double space, RectangleEdge edge)Ensures there is a minimum amount of space at the edge corresponding to the specified axis location.- Parameters:
space- the space.edge- the location.
-
shrink
public java.awt.geom.Rectangle2D shrink(java.awt.geom.Rectangle2D area, java.awt.geom.Rectangle2D result)Shrinks an area by the space attributes.- Parameters:
area- the area to shrink.result- an optional carrier for the result.- Returns:
- The result.
-
expand
public java.awt.geom.Rectangle2D expand(java.awt.geom.Rectangle2D area, java.awt.geom.Rectangle2D result)Expands an area by the amount of space represented by this object.- Parameters:
area- the area to expand.result- an optional carrier for the result.- Returns:
- The result.
-
reserved
public java.awt.geom.Rectangle2D reserved(java.awt.geom.Rectangle2D area, RectangleEdge edge)Calculates the reserved area.- Parameters:
area- the area.edge- the edge.- Returns:
- The reserved area.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionReturns a clone of the object.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classjava.lang.Object- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException- This class won't throw this exception, but subclasses (if any) might.
-
equals
public boolean equals(java.lang.Object obj)
Tests this object for equality with another object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to compare against.- Returns:
trueorfalse.
-
hashCode
public int hashCode()
Returns a hash code for this object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- A hash code.
-
toString
public java.lang.String toString()
Returns a string representing the object (for debugging purposes).- Overrides:
toStringin classjava.lang.Object- Returns:
- A string.
-
-