public class TwoDimensionalIntCounter<K1,K2>
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
TwoDimensionalIntCounter() |
TwoDimensionalIntCounter(int initialCapacity) |
TwoDimensionalIntCounter(MapFactory<K1,IntCounter<K2>> outerFactory,
MapFactory<K2,MutableInteger> innerFactory) |
TwoDimensionalIntCounter(MapFactory<K1,IntCounter<K2>> outerFactory,
MapFactory<K2,MutableInteger> innerFactory,
int initialCapacity) |
Modifier and Type | Method and Description |
---|---|
void |
addAll(K1 key,
IntCounter<K2> c) |
void |
addAll(TwoDimensionalIntCounter<K1,K2> c) |
void |
clean() |
boolean |
containsKey(K1 o1,
K2 o2) |
void |
decrementCount(K1 o1,
K2 o2) |
void |
decrementCount(K1 o1,
K2 o2,
double count) |
void |
decrementCount(K1 o1,
K2 o2,
int count) |
int |
defaultReturnValue() |
void |
defaultReturnValue(double rv) |
void |
defaultReturnValue(int rv) |
java.util.Set<java.util.Map.Entry<K1,IntCounter<K2>>> |
entrySet() |
boolean |
equals(java.lang.Object o) |
java.util.Set<K1> |
firstKeySet() |
IntCounter<Pair<K1,K2>> |
flatten() |
int |
getCount(K1 o1,
K2 o2) |
IntCounter<K2> |
getCounter(K1 o) |
MapFactory<K2,MutableInteger> |
getInnerMapFactory() |
MapFactory<K1,IntCounter<K2>> |
getOuterMapFactory() |
int |
hashCode() |
void |
incrementCount(K1 o1,
K2 o2) |
void |
incrementCount(K1 o1,
K2 o2,
double count) |
void |
incrementCount(K1 o1,
K2 o2,
int count) |
boolean |
isEmpty() |
void |
remove(K1 key) |
int |
remove(K1 o1,
K2 o2) |
void |
removeZeroCounts() |
static <K1,K2> TwoDimensionalIntCounter<K2,K1> |
reverseIndexOrder(TwoDimensionalIntCounter<K1,K2> cc)
Produces a new ConditionalCounter.
|
java.util.Set<K2> |
secondKeySet() |
void |
setCount(K1 o1,
K2 o2,
double count) |
void |
setCount(K1 o1,
K2 o2,
int count) |
IntCounter<K2> |
setCounter(K1 o,
IntCounter<K2> c)
replace the counter for K1-index o by new counter c
|
int |
size() |
void |
subtractAll(K1 key,
IntCounter<K2> c) |
void |
subtractAll(TwoDimensionalIntCounter<K1,K2> c,
boolean removeKeys) |
java.lang.String |
toCSVString(java.text.NumberFormat nf) |
static <CK1 extends java.lang.Comparable<CK1>,CK2 extends java.lang.Comparable<CK2>> |
toCSVString(TwoDimensionalIntCounter<CK1,CK2> counter,
java.text.NumberFormat nf,
java.util.Comparator<CK1> key1Comparator,
java.util.Comparator<CK2> key2Comparator) |
int[][] |
toMatrix(java.util.List<K1> firstKeys,
java.util.List<K2> secondKeys)
Given an ordering of the first (row) and second (column) keys, will produce a double matrix.
|
java.lang.String |
toMatrixString(int cellSize) |
java.lang.String |
toString()
A simple String representation of this TwoDimensionalCounter, which has
the String representation of each key pair
on a separate line, followed by the count for that pair.
|
int |
totalCount()
Takes linear time.
|
int |
totalCount(K1 k1) |
IntCounter<K1> |
totalCounts() |
public TwoDimensionalIntCounter()
public TwoDimensionalIntCounter(int initialCapacity)
public TwoDimensionalIntCounter(MapFactory<K1,IntCounter<K2>> outerFactory, MapFactory<K2,MutableInteger> innerFactory)
public TwoDimensionalIntCounter(MapFactory<K1,IntCounter<K2>> outerFactory, MapFactory<K2,MutableInteger> innerFactory, int initialCapacity)
public void defaultReturnValue(double rv)
public void defaultReturnValue(int rv)
public int defaultReturnValue()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public IntCounter<K2> getCounter(K1 o)
public java.util.Set<java.util.Map.Entry<K1,IntCounter<K2>>> entrySet()
public int size()
public int totalCount()
public int totalCount(K1 k1)
public IntCounter<K1> totalCounts()
public java.util.Set<K1> firstKeySet()
public IntCounter<K2> setCounter(K1 o, IntCounter<K2> c)
public static <K1,K2> TwoDimensionalIntCounter<K2,K1> reverseIndexOrder(TwoDimensionalIntCounter<K1,K2> cc)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toMatrixString(int cellSize)
public int[][] toMatrix(java.util.List<K1> firstKeys, java.util.List<K2> secondKeys)
public java.lang.String toCSVString(java.text.NumberFormat nf)
public static <CK1 extends java.lang.Comparable<CK1>,CK2 extends java.lang.Comparable<CK2>> java.lang.String toCSVString(TwoDimensionalIntCounter<CK1,CK2> counter, java.text.NumberFormat nf, java.util.Comparator<CK1> key1Comparator, java.util.Comparator<CK2> key2Comparator)
public java.util.Set<K2> secondKeySet()
public boolean isEmpty()
public IntCounter<Pair<K1,K2>> flatten()
public void addAll(TwoDimensionalIntCounter<K1,K2> c)
public void addAll(K1 key, IntCounter<K2> c)
public void subtractAll(K1 key, IntCounter<K2> c)
public void subtractAll(TwoDimensionalIntCounter<K1,K2> c, boolean removeKeys)
public void removeZeroCounts()
public void remove(K1 key)
public void clean()
public MapFactory<K1,IntCounter<K2>> getOuterMapFactory()
public MapFactory<K2,MutableInteger> getInnerMapFactory()