Package beamline.models.algorithms
Class StreamMiningAlgorithm<T extends Response>
- java.lang.Object
-
- org.apache.flink.api.common.functions.AbstractRichFunction
-
- org.apache.flink.api.common.functions.RichFlatMapFunction<BEvent,T>
-
- beamline.models.algorithms.StreamMiningAlgorithm<T>
-
- All Implemented Interfaces:
Serializable
,org.apache.flink.api.common.functions.FlatMapFunction<BEvent,T>
,org.apache.flink.api.common.functions.Function
,org.apache.flink.api.common.functions.RichFunction
- Direct Known Subclasses:
InfiniteSizeDirectlyFollowsMapper
public abstract class StreamMiningAlgorithm<T extends Response> extends org.apache.flink.api.common.functions.RichFlatMapFunction<BEvent,T>
This abstract class defines the root of the mining algorithms hierarchy. It is aRichFlatMapFunction
of elements with typeBEvent
that is capable of producing responses of typeResponse
.Since this map is actually "rich" this means that classes that extends this one can have access to the state of the operator and use it in a distributed fashion. Additionally, being this map a "flat" it might return 0 or 1 results for each event being consumed.
- Author:
- Andrea Burattin
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description StreamMiningAlgorithm()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
flatMap(BEvent event, org.apache.flink.util.Collector<T> out)
long
getProcessedEvents()
Returns the total number of events processed so farabstract T
ingest(BEvent event)
This abstract method is what each derive class is expected to implement.void
open(org.apache.flink.configuration.Configuration parameters)
protected T
process(BEvent event)
-
-
-
Method Detail
-
open
public void open(org.apache.flink.configuration.Configuration parameters) throws Exception
- Specified by:
open
in interfaceorg.apache.flink.api.common.functions.RichFunction
- Overrides:
open
in classorg.apache.flink.api.common.functions.AbstractRichFunction
- Throws:
Exception
-
ingest
public abstract T ingest(BEvent event)
This abstract method is what each derive class is expected to implement. The argument of the method is the new observation and the returned value is the result of the mining.If this method returns value
null
, then the value is not moved forward into the pipeline.- Parameters:
event
- the new event being observed- Returns:
- the result of the mining of the event, or
null
if nothing should go through the rest of the pipeline
-
getProcessedEvents
public long getProcessedEvents()
Returns the total number of events processed so far- Returns:
- the total number of events processed so far
-
-