Package opennlp.tools.util
Class CountedSet<E>
- java.lang.Object
-
- opennlp.tools.util.CountedSet<E>
-
- All Implemented Interfaces:
java.lang.Iterable<E>,java.util.Collection<E>,java.util.Set<E>
public class CountedSet<E> extends java.lang.Object implements java.util.Set<E>Set which counts the number of times a values are added to it. This value can be accessed with the #getCount method.
-
-
Constructor Summary
Constructors Constructor Description CountedSet()Creates a new counted set.CountedSet(int size)Creates a new counted set of the specified initial size.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanadd(E o)booleanaddAll(java.util.Collection<? extends E> c)voidclear()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)intgetCount(E o)Return the count of the specified object.booleanisEmpty()java.util.Iterator<E>iterator()booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)voidsetCount(E o, int c)Assigns the specified object the specified count in the set.intsize()voidsubtract(E o)Reduces the count associated with this object by 1.java.lang.Object[]toArray()<T> T[]toArray(T[] a)voidwrite(java.lang.String fileName, int countCutoff)Deprecated.voidwrite(java.lang.String fileName, int countCutoff, java.lang.String delim)Deprecated.voidwrite(java.lang.String fileName, int countCutoff, java.lang.String delim, java.lang.String encoding)Deprecated.
-
-
-
Method Detail
-
add
public boolean add(E o)
-
subtract
public void subtract(E o)
Reduces the count associated with this object by 1. If this causes the count to become 0, then the object is removed form the set.- Parameters:
o- The object whose count is being reduced.
-
setCount
public void setCount(E o, int c)
Assigns the specified object the specified count in the set.- Parameters:
o- The object to be added or updated in the set.c- The count of the specified object.
-
getCount
public int getCount(E o)
Return the count of the specified object.- Parameters:
o- the object whose count needs to be determined.- Returns:
- the count of the specified object.
-
write
@Deprecated public void write(java.lang.String fileName, int countCutoff)Deprecated.This methods is deprecated use opennlp.toolsdictionary.serialization package for writing aCountedSet.- Parameters:
fileName-countCutoff-
-
write
@Deprecated public void write(java.lang.String fileName, int countCutoff, java.lang.String delim)Deprecated.This methods is deprecated use opennlp.toolsdictionary.serialization package for writing aCountedSet.- Parameters:
fileName-countCutoff-delim-
-
write
@Deprecated public void write(java.lang.String fileName, int countCutoff, java.lang.String delim, java.lang.String encoding)Deprecated.This methods is deprecated use opennlp.toolsdictionary.serialization package for writing aCountedSet.- Parameters:
fileName-countCutoff-delim-encoding-
-
addAll
public boolean addAll(java.util.Collection<? extends E> c)
-
clear
public void clear()
-
contains
public boolean contains(java.lang.Object o)
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
-
isEmpty
public boolean isEmpty()
-
iterator
public java.util.Iterator<E> iterator()
-
remove
public boolean remove(java.lang.Object o)
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
-
size
public int size()
-
toArray
public java.lang.Object[] toArray()
-
-