Package org.nd4j.common.primitives
Class CounterMap<F,S>
- java.lang.Object
-
- org.nd4j.common.primitives.CounterMap<F,S>
-
- All Implemented Interfaces:
Serializable
public class CounterMap<F,S> extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CounterMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pair<F,S>
argMax()
This method returns pair of elements with a max valuevoid
clear()
This method purges all countersvoid
clear(F element)
This method purges counter for a given first elementdouble
getCount(F first, S second)
This method returns counts for a given first/second pairCounter<S>
getCounter(F first)
This method returns counter for a given first elementIterator<Pair<F,S>>
getIterator()
This method returns Iterator of all first/second pairs stored in this countervoid
incrementAll(CounterMap<F,S> other)
This method will increment values of this counter, by counts of other countervoid
incrementCount(F first, S second, double inc)
This method will increment counts for a given first/second pairboolean
isEmpty()
This method checks if this CounterMap has any values storedboolean
isEmpty(F element)
This method checks if this CounterMap has any values stored for a given first elementSet<F>
keySet()
This method returns Set of all first elementsdouble
setCount(F first, S second, double value)
This method allows you to set counter value for a given first/second pairint
size()
This method returns number of First elements in this CounterMapint
totalSize()
This method returns total number of elements in this CounterMap
-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
This method checks if this CounterMap has any values stored- Returns:
-
isEmpty
public boolean isEmpty(F element)
This method checks if this CounterMap has any values stored for a given first element- Parameters:
element
-- Returns:
-
incrementAll
public void incrementAll(CounterMap<F,S> other)
This method will increment values of this counter, by counts of other counter- Parameters:
other
-
-
incrementCount
public void incrementCount(F first, S second, double inc)
This method will increment counts for a given first/second pair- Parameters:
first
-second
-inc
-
-
getCount
public double getCount(F first, S second)
This method returns counts for a given first/second pair- Parameters:
first
-second
-- Returns:
-
setCount
public double setCount(F first, S second, double value)
This method allows you to set counter value for a given first/second pair- Parameters:
first
-second
-value
-- Returns:
-
clear
public void clear()
This method purges all counters
-
clear
public void clear(F element)
This method purges counter for a given first element- Parameters:
element
-
-
getCounter
public Counter<S> getCounter(F first)
This method returns counter for a given first element- Parameters:
first
-- Returns:
-
getIterator
public Iterator<Pair<F,S>> getIterator()
This method returns Iterator of all first/second pairs stored in this counter- Returns:
-
size
public int size()
This method returns number of First elements in this CounterMap- Returns:
-
totalSize
public int totalSize()
This method returns total number of elements in this CounterMap- Returns:
-
-