Package com.gengoai.stream.local
Class LocalMSetAccumulator<E>
- java.lang.Object
-
- com.gengoai.stream.local.LocalMAccumulator<E,Set<E>>
-
- com.gengoai.stream.local.LocalMSetAccumulator<E>
-
- All Implemented Interfaces:
Copyable<LocalMAccumulator<E,Set<E>>>
,MAccumulator<E,Set<E>>
,Serializable
public class LocalMSetAccumulator<E> extends LocalMAccumulator<E,Set<E>>
An implementation of a
MAccumulator
that accumulates values in a set for local streams- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LocalMSetAccumulator(String name)
Instantiates a LocalMIndexAccumulator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(E e)
Adds an item to the accumulatorLocalMAccumulator<E,Set<E>>
copy()
Makes a copy of this object.boolean
isZero()
Determines if the accumulator is a zero valuevoid
merge(MAccumulator<E,Set<E>> other)
Merges another accumulator with this onevoid
reset()
Resets the accumulator to its zero-value.Set<E>
value()
The value of the accumulator.-
Methods inherited from class com.gengoai.stream.local.LocalMAccumulator
name, register, report
-
-
-
-
Constructor Detail
-
LocalMSetAccumulator
public LocalMSetAccumulator(String name)
Instantiates a LocalMIndexAccumulator.- Parameters:
name
- the name of the accumulator (null is ok)
-
-
Method Detail
-
add
public void add(E e)
Description copied from interface:MAccumulator
Adds an item to the accumulator- Parameters:
e
- the item to add
-
merge
public void merge(MAccumulator<E,Set<E>> other)
Description copied from interface:MAccumulator
Merges another accumulator with this one- Parameters:
other
- the other accumulator to merge
-
reset
public void reset()
Description copied from interface:MAccumulator
Resets the accumulator to its zero-value.
-
value
public Set<E> value()
Description copied from interface:MAccumulator
The value of the accumulator.- Returns:
- the result of the accumulator
-
isZero
public boolean isZero()
Description copied from interface:MAccumulator
Determines if the accumulator is a zero value- Returns:
- True if the accumulator is in a zero state
-
copy
public LocalMAccumulator<E,Set<E>> copy()
Description copied from interface:Copyable
Makes a copy of this object.
- Returns:
- A copy of this object.
-
-