Package org.jfree.chart
Class PaintMap
- java.lang.Object
-
- org.jfree.chart.PaintMap
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class PaintMap extends Object implements Cloneable, Serializable
A storage structure that mapsComparable
instances withPaint
instances.
To support cloning and serialization, you should only use keys that are cloneable and serializable. Special handling for thePaint
instances is included in this class.- Since:
- 1.0.3
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PaintMap()
Creates a new (empty) map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Resets the map to empty.Object
clone()
Returns a clone of thisPaintMap
.boolean
containsKey(Comparable key)
Returnstrue
if the map contains the specified key, andfalse
otherwise.boolean
equals(Object obj)
Tests this map for equality with an arbitrary object.Paint
getPaint(Comparable key)
Returns the paint associated with the specified key, ornull
.void
put(Comparable key, Paint paint)
Adds a mapping between the specifiedkey
andpaint
values.
-
-
-
Method Detail
-
getPaint
public Paint getPaint(Comparable key)
Returns the paint associated with the specified key, ornull
.- Parameters:
key
- the key (null
not permitted).- Returns:
- The paint, or
null
. - Throws:
IllegalArgumentException
- ifkey
isnull
.
-
containsKey
public boolean containsKey(Comparable key)
Returnstrue
if the map contains the specified key, andfalse
otherwise.- Parameters:
key
- the key.- Returns:
true
if the map contains the specified key, andfalse
otherwise.
-
put
public void put(Comparable key, Paint paint)
Adds a mapping between the specifiedkey
andpaint
values.- Parameters:
key
- the key (null
not permitted).paint
- the paint.- Throws:
IllegalArgumentException
- ifkey
isnull
.
-
clear
public void clear()
Resets the map to empty.
-
equals
public boolean equals(Object obj)
Tests this map for equality with an arbitrary object.
-
clone
public Object clone() throws CloneNotSupportedException
Returns a clone of thisPaintMap
.- Overrides:
clone
in classObject
- Returns:
- A clone of this instance.
- Throws:
CloneNotSupportedException
- if any key is not cloneable.
-
-