com.sun.xml.analysis.frequency
Class FrequencySet<T>

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<T,Integer>
          extended by com.sun.xml.analysis.frequency.FrequencySet<T>
All Implemented Interfaces:
Serializable, Cloneable, Map<T,Integer>

public class FrequencySet<T>
extends HashMap<T,Integer>

A Set that manages how many occurances of a value occurs in the set. TODO: Sort entries lexically for set of values with 0 occurences.

Author:
Paul.Sandoz@Sun.Com
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
FrequencySet()
           
 
Method Summary
 void add(T value)
          Add a value to the set.
 void add0(T value)
          Add a value to the set with 0 occurences.
 List<T> createFrequencyBasedList()
          Create an ordered list of values in the order of decreasing frequency of occurence.
 Set<T> createFrequencyBasedSet()
          Create an ordered set of values in the order of decreasing frequency of occurence.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

FrequencySet

public FrequencySet()
Method Detail

add

public void add(T value)
Add a value to the set.

Parameters:
value - the value to put in the set.

add0

public void add0(T value)
Add a value to the set with 0 occurences.

Parameters:
value - the value to put in the set.

createFrequencyBasedList

public List<T> createFrequencyBasedList()
Create an ordered list of values in the order of decreasing frequency of occurence.

Returns:
the list of values in the order of decreasing frequency of occurence.

createFrequencyBasedSet

public Set<T> createFrequencyBasedSet()
Create an ordered set of values in the order of decreasing frequency of occurence.

Returns:
the set of values in the order of decreasing frequency of occurence.


Copyright © 2012 Oracle Corpration. All Rights Reserved.