Package org.jfree.chart.renderer
Class LookupPaintScale
- java.lang.Object
-
- org.jfree.chart.renderer.LookupPaintScale
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,PaintScale
,PublicCloneable
public class LookupPaintScale extends java.lang.Object implements PaintScale, PublicCloneable, java.io.Serializable
A paint scale that uses a lookup table to associate paint instances with data value ranges.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
LookupPaintScale.PaintItem
Stores the paint for a value.
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Paint
defaultPaint
The default paint.private java.util.List
lookupTable
The lookup table.private double
lowerBound
The lower bound.(package private) static long
serialVersionUID
For serialization.private double
upperBound
The upper bound.
-
Constructor Summary
Constructors Constructor Description LookupPaintScale()
Creates a new paint scale.LookupPaintScale(double lowerBound, double upperBound, java.awt.Paint defaultPaint)
Creates a new paint scale with the specified default paint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(double value, java.awt.Paint paint)
Adds an entry to the lookup table.java.lang.Object
clone()
Returns a clone of the instance.boolean
equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.java.awt.Paint
getDefaultPaint()
Returns the default paint (nevernull
).double
getLowerBound()
Returns the lower bound.java.awt.Paint
getPaint(double value)
Returns the paint associated with the specified value.double
getUpperBound()
Returns the upper bound.private void
readObject(java.io.ObjectInputStream stream)
Provides serialization support.private void
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
lowerBound
private double lowerBound
The lower bound.
-
upperBound
private double upperBound
The upper bound.
-
defaultPaint
private transient java.awt.Paint defaultPaint
The default paint.
-
lookupTable
private java.util.List lookupTable
The lookup table.
-
-
Constructor Detail
-
LookupPaintScale
public LookupPaintScale()
Creates a new paint scale.
-
LookupPaintScale
public LookupPaintScale(double lowerBound, double upperBound, java.awt.Paint defaultPaint)
Creates a new paint scale with the specified default paint.- Parameters:
lowerBound
- the lower bound.upperBound
- the upper bound.defaultPaint
- the default paint (null
not permitted).
-
-
Method Detail
-
getDefaultPaint
public java.awt.Paint getDefaultPaint()
Returns the default paint (nevernull
).- Returns:
- The default paint.
-
getLowerBound
public double getLowerBound()
Returns the lower bound.- Specified by:
getLowerBound
in interfacePaintScale
- Returns:
- The lower bound.
- See Also:
getUpperBound()
-
getUpperBound
public double getUpperBound()
Returns the upper bound.- Specified by:
getUpperBound
in interfacePaintScale
- Returns:
- The upper bound.
- See Also:
getLowerBound()
-
add
public void add(double value, java.awt.Paint paint)
Adds an entry to the lookup table. Any values fromn
up to but not including the next value in the table take on the specifiedPaint
.- Parameters:
value
- the data value.paint
- the paint.
-
getPaint
public java.awt.Paint getPaint(double value)
Returns the paint associated with the specified value.- Specified by:
getPaint
in interfacePaintScale
- Parameters:
value
- the value.- Returns:
- The paint.
- See Also:
getDefaultPaint()
-
equals
public boolean equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object (null
permitted).- Returns:
- A boolean.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of the instance.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classjava.lang.Object
- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException
- if there is a problem cloning the instance.
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
Provides serialization support.- Parameters:
stream
- the output stream.- Throws:
java.io.IOException
- if there is an I/O error.
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
Provides serialization support.- Parameters:
stream
- the input stream.- Throws:
java.io.IOException
- if there is an I/O error.java.lang.ClassNotFoundException
- if there is a classpath problem.
-
-