Package org.jfree.chart
Class PaintMap
- java.lang.Object
-
- org.jfree.chart.PaintMap
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class PaintMap extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable
A storage structure that mapsComparableinstances withPaintinstances.
To support cloning and serialization, you should only use keys that are cloneable and serializable. Special handling for thePaintinstances 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 voidclear()Resets the map to empty.java.lang.Objectclone()Returns a clone of thisPaintMap.booleancontainsKey(java.lang.Comparable key)Returnstrueif the map contains the specified key, andfalseotherwise.booleanequals(java.lang.Object obj)Tests this map for equality with an arbitrary object.java.awt.PaintgetPaint(java.lang.Comparable key)Returns the paint associated with the specified key, ornull.voidput(java.lang.Comparable key, java.awt.Paint paint)Adds a mapping between the specifiedkeyandpaintvalues.
-
-
-
Constructor Detail
-
PaintMap
public PaintMap()
Creates a new (empty) map.
-
-
Method Detail
-
getPaint
public java.awt.Paint getPaint(java.lang.Comparable key)
Returns the paint associated with the specified key, ornull.- Parameters:
key- the key (nullnot permitted).- Returns:
- The paint, or
null. - Throws:
java.lang.IllegalArgumentException- ifkeyisnull.
-
containsKey
public boolean containsKey(java.lang.Comparable key)
Returnstrueif the map contains the specified key, andfalseotherwise.- Parameters:
key- the key.- Returns:
trueif the map contains the specified key, andfalseotherwise.
-
put
public void put(java.lang.Comparable key, java.awt.Paint paint)
Adds a mapping between the specifiedkeyandpaintvalues.- Parameters:
key- the key (nullnot permitted).paint- the paint.- Throws:
java.lang.IllegalArgumentException- ifkeyisnull.
-
clear
public void clear()
Resets the map to empty.
-
equals
public boolean equals(java.lang.Object obj)
Tests this map for equality with an arbitrary object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of thisPaintMap.- Overrides:
clonein classjava.lang.Object- Returns:
- A clone of this instance.
- Throws:
java.lang.CloneNotSupportedException- if any key is not cloneable.
-
-