public class RefCountedSet<K>
extends java.lang.Object
Constructor and Description |
---|
RefCountedSet()
Constructor.
|
RefCountedSet(java.util.Map<K,java.lang.Integer> refSet,
int numValues) |
Modifier and Type | Method and Description |
---|---|
boolean |
add(K key)
Add a key to the set.
|
void |
add(K key,
int numReferences)
Add a key to the set with the given number of references.
|
void |
clear()
Clear out the collection.
|
java.util.Iterator<java.util.Map.Entry<K,java.lang.Integer>> |
entryIterator()
Returns an iterator over the entry set.
|
int |
getNumValues() |
java.util.Map<K,java.lang.Integer> |
getRefSet() |
java.util.Iterator<K> |
keyIterator()
Returns a key iterator.
|
boolean |
remove(K key)
Removed a key to the set.
|
boolean |
removeAll(K key)
Remove a key from the set regardless of the number of references.
|
void |
setNumValues(int numValues) |
int |
size()
Returns the number of values in the collection.
|
public RefCountedSet()
public RefCountedSet(java.util.Map<K,java.lang.Integer> refSet, int numValues)
public void clear()
public boolean add(K key)
key
- to addpublic void add(K key, int numReferences)
key
- to addnumReferences
- initial number of referencespublic boolean remove(K key)
key
- to addjava.lang.IllegalStateException
- is a key is removed that wasn't added to the mappublic boolean removeAll(K key)
key
- to addjava.lang.IllegalStateException
- if a key is removed that wasn't added to the mappublic java.util.Iterator<java.util.Map.Entry<K,java.lang.Integer>> entryIterator()
public java.util.Iterator<K> keyIterator()
public int size()
public java.util.Map<K,java.lang.Integer> getRefSet()
public int getNumValues()
public void setNumValues(int numValues)