public class KeyToGroupMap
extends java.lang.Object
implements java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable
Comparable) to groups.| Modifier and Type | Field and Description |
|---|---|
private java.lang.Comparable |
defaultGroup
The default group.
|
private java.util.List |
groups
The groups.
|
private java.util.Map |
keyToGroupMap
A mapping between keys and groups.
|
private static long |
serialVersionUID
For serialization.
|
| Constructor and Description |
|---|
KeyToGroupMap()
Creates a new map with a default group named 'Default Group'.
|
KeyToGroupMap(java.lang.Comparable defaultGroup)
Creates a new map with the specified default group.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Returns a clone of the map.
|
private static java.util.Collection |
clone(java.util.Collection list)
Returns a clone of the list.
|
private static java.lang.Object |
clone(java.lang.Object object)
Attempts to clone the specified object using reflection.
|
boolean |
equals(java.lang.Object obj)
Tests the map for equality against an arbitrary object.
|
java.lang.Comparable |
getGroup(java.lang.Comparable key)
Returns the group that a key is mapped to.
|
int |
getGroupCount()
Returns the number of groups in the map.
|
int |
getGroupIndex(java.lang.Comparable group)
Returns the index for the group.
|
java.util.List |
getGroups()
Returns a list of the groups (always including the default group) in the
map.
|
int |
getKeyCount(java.lang.Comparable group)
Returns the number of keys mapped to the specified group.
|
void |
mapKeyToGroup(java.lang.Comparable key,
java.lang.Comparable group)
Maps a key to a group.
|
private static final long serialVersionUID
private java.lang.Comparable defaultGroup
private java.util.List groups
private java.util.Map keyToGroupMap
public KeyToGroupMap()
public KeyToGroupMap(java.lang.Comparable defaultGroup)
defaultGroup - the default group (null not permitted).public int getGroupCount()
public java.util.List getGroups()
null).public int getGroupIndex(java.lang.Comparable group)
group - the group.public java.lang.Comparable getGroup(java.lang.Comparable key)
key - the key (null not permitted).null, returns the default group if
there is no mapping for the specified key).public void mapKeyToGroup(java.lang.Comparable key,
java.lang.Comparable group)
key - the key (null not permitted).group - the group (null permitted, clears any
existing mapping).public int getKeyCount(java.lang.Comparable group)
group - the group (null not permitted).public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object to test against (null permitted).public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface org.jfree.util.PublicCloneableclone in class java.lang.Objectjava.lang.CloneNotSupportedException - if there is a problem cloning the
map.private static java.lang.Object clone(java.lang.Object object)
object - the object (null permitted).private static java.util.Collection clone(java.util.Collection list)
throws java.lang.CloneNotSupportedException
list - the list.java.lang.CloneNotSupportedException - if the list could not be cloned.