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 maps Comparable instances with Paint instances.

To support cloning and serialization, you should only use keys that are cloneable and serializable. Special handling for the Paint instances is included in this class.
See Also:
  • Constructor Details

    • PaintMap

      public PaintMap()
      Creates a new (empty) map.
  • Method Details

    • getPaint

      public Paint getPaint(Comparable key)
      Returns the paint associated with the specified key, or null.
      Parameters:
      key - the key (null not permitted).
      Returns:
      The paint, or null.
      Throws:
      IllegalArgumentException - if key is null.
    • containsKey

      public boolean containsKey(Comparable key)
      Returns true if the map contains the specified key, and false otherwise.
      Parameters:
      key - the key.
      Returns:
      true if the map contains the specified key, and false otherwise.
    • put

      public void put(Comparable key, Paint paint)
      Adds a mapping between the specified key and Paint values.
      Parameters:
      key - the key (null not permitted).
      paint - the paint.
      Throws:
      IllegalArgumentException - if key is null.
    • clear

      public void clear()
      Resets the map to empty.
    • equals

      public boolean equals(Object obj)
      Tests this map for equality with an arbitrary object.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object (null permitted).
      Returns:
      A boolean.
    • clone

      Returns a clone of this PaintMap.
      Overrides:
      clone in class Object
      Returns:
      A clone of this instance.
      Throws:
      CloneNotSupportedException - if any key is not cloneable.