Class IntCounter
- java.lang.Object
-
- org.apache.flink.api.common.accumulators.IntCounter
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Accumulator<Integer,Integer>
,SimpleAccumulator<Integer>
@PublicEvolving public class IntCounter extends Object implements SimpleAccumulator<Integer>
An accumulator that sums upInteger
values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IntCounter()
IntCounter(int value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int value)
void
add(Integer value)
Consider usingadd(int)
instead for primitive int valuesIntCounter
clone()
Duplicates the accumulator.Integer
getLocalValue()
int
getLocalValuePrimitive()
void
merge(Accumulator<Integer,Integer> other)
Used by system internally to merge the collected parts of an accumulator at the end of the job.void
resetLocal()
Reset the local value.String
toString()
-
-
-
Method Detail
-
add
public void add(Integer value)
Consider usingadd(int)
instead for primitive int values- Specified by:
add
in interfaceAccumulator<Integer,Integer>
- Parameters:
value
- The value to add to the accumulator object
-
getLocalValue
public Integer getLocalValue()
- Specified by:
getLocalValue
in interfaceAccumulator<Integer,Integer>
- Returns:
- local The local value from the current UDF context
-
merge
public void merge(Accumulator<Integer,Integer> other)
Description copied from interface:Accumulator
Used by system internally to merge the collected parts of an accumulator at the end of the job.- Specified by:
merge
in interfaceAccumulator<Integer,Integer>
- Parameters:
other
- Reference to accumulator to merge in.
-
resetLocal
public void resetLocal()
Description copied from interface:Accumulator
Reset the local value. This only affects the current UDF context.- Specified by:
resetLocal
in interfaceAccumulator<Integer,Integer>
-
clone
public IntCounter clone()
Description copied from interface:Accumulator
Duplicates the accumulator. All subclasses need to properly implement cloning and cannot throw aCloneNotSupportedException
-
add
public void add(int value)
-
getLocalValuePrimitive
public int getLocalValuePrimitive()
-
-