Package org.jfree.data
Class KeyToGroupMap
java.lang.Object
org.jfree.data.KeyToGroupMap
- All Implemented Interfaces:
Serializable
,Cloneable
,org.jfree.util.PublicCloneable
public class KeyToGroupMap extends Object implements Cloneable, org.jfree.util.PublicCloneable, Serializable
A class that maps keys (instances of
Comparable
to groups.- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description KeyToGroupMap()
Creates a new map with a default group named 'Default Group'.KeyToGroupMap(Comparable defaultGroup)
Creates a new map with the specified default group. -
Method Summary
Modifier and Type Method Description Object
clone()
Returns a clone of the map.boolean
equals(Object obj)
Tests the map for equality against an arbitrary object.Comparable
getGroup(Comparable key)
Returns the group that a key is mapped to.int
getGroupCount()
Returns the number of groups in the map.int
getGroupIndex(Comparable group)
Returns the index for the group.List
getGroups()
Returns the groups (always including the default group) in the map.void
mapKeyToGroup(Comparable key, Comparable group)
Maps a key to a group.
-
Constructor Details
-
KeyToGroupMap
public KeyToGroupMap()Creates a new map with a default group named 'Default Group'. -
KeyToGroupMap
Creates a new map with the specified default group.- Parameters:
defaultGroup
- the default group (null
not permitted).
-
-
Method Details
-
getGroups
Returns the groups (always including the default group) in the map.- Returns:
- The groups.
-
getGroupCount
public int getGroupCount()Returns the number of groups in the map.- Returns:
- The number of groups in the map.
-
getGroupIndex
Returns the index for the group.- Parameters:
group
- the group.- Returns:
- The group index.
-
getGroup
Returns the group that a key is mapped to.- Parameters:
key
- the key.- Returns:
- The group (never
null
, returns the default group if there is no mapping for the specified key).
-
mapKeyToGroup
Maps a key to a group.- Parameters:
key
- the key (null
not permitted).group
- the group (null
permitted, replaced by default group).
-
equals
Tests the map for equality against an arbitrary object. -
clone
Returns a clone of the map.- Specified by:
clone
in interfaceorg.jfree.util.PublicCloneable
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- if there is a problem cloning the map.
-