org.jfree.data
Class KeyToGroupMap
java.lang.Objectorg.jfree.data.KeyToGroupMap
- Cloneable, PublicCloneable, Serializable
extends java.lang.Object
implements Cloneable, PublicCloneable, Serializable
A class that maps keys (instances of Comparable) to groups.
KeyToGroupMap()- Creates a new map with a default group named 'Default Group'.
|
KeyToGroupMap(Comparable defaultGroup)- Creates a new map with the specified default group.
|
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 a list of the groups (always including the default group) in the
map.
|
int | getKeyCount(Comparable group)- Returns the number of keys mapped to the specified group.
|
void | mapKeyToGroup(Comparable key, Comparable group)- Maps a key to a group.
|
KeyToGroupMap
public KeyToGroupMap()
Creates a new map with a default group named 'Default Group'.
KeyToGroupMap
public KeyToGroupMap(Comparable defaultGroup)
Creates a new map with the specified default group.
defaultGroup - the default group (null not permitted).
clone
public Object clone()
throws CloneNotSupportedException Returns a clone of the map.
equals
public boolean equals(Object obj)
Tests the map for equality against an arbitrary object.
obj - the object to test against (null permitted).
getGroup
public Comparable getGroup(Comparable key)
Returns the group that a key is mapped to.
key - the key (null not permitted).
- The group (never
null, returns the default group if
there is no mapping for the specified key).
getGroupCount
public int getGroupCount()
Returns the number of groups in the map.
- The number of groups in the map.
getGroupIndex
public int getGroupIndex(Comparable group)
Returns the index for the group.
- The group index (or -1 if the group is not represented within
the map).
getGroups
public List getGroups()
Returns a list of the groups (always including the default group) in the
map. The returned list is independent of the map, so altering the list
will have no effect.
getKeyCount
public int getKeyCount(Comparable group)
Returns the number of keys mapped to the specified group. This method
won't always return an accurate result for the default group, since
explicit mappings are not required for this group.
group - the group (null not permitted).
mapKeyToGroup
public void mapKeyToGroup(Comparable key,
Comparable group) Maps a key to a group.
key - the key (null not permitted).group - the group (null permitted, clears any
existing mapping).