Skip to content
Snippets Groups Projects
Commit 31fe7bc7 authored by Andrea Burattin's avatar Andrea Burattin
Browse files

Some work on the documentation

parent 8dc22b41
No related branches found
No related tags found
No related merge requests found
/**
* This package contains the description of events in Beamline.
*/
package beamline.events;
\ No newline at end of file
package beamline.exceptions; package beamline.exceptions;
/**
* Exception thrown during events creation
*
* @author Andrea Burattin
*/
public class EventException extends Exception { public class EventException extends Exception {
private static final long serialVersionUID = 5835305478001040595L; private static final long serialVersionUID = 5835305478001040595L;
/**
* Constructs a new exception
*
* @param message the message
*/
public EventException(String message) { public EventException(String message) {
super(message); super(message);
} }
......
package beamline.exceptions; package beamline.exceptions;
/**
* Exception thrown during source processing
*
* @author Andrea Burattin
*/
public class SourceException extends Exception { public class SourceException extends Exception {
private static final long serialVersionUID = -3387719059778550013L; private static final long serialVersionUID = -3387719059778550013L;
/**
* Constructs a new exception
*
* @param message the message
*/
public SourceException(String message) { public SourceException(String message) {
super(message); super(message);
} }
......
/**
* This package contains the specific exceptions that Beamline can throw.
*/
package beamline.exceptions;
\ No newline at end of file
...@@ -3,13 +3,11 @@ package beamline.models.algorithms; ...@@ -3,13 +3,11 @@ package beamline.models.algorithms;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.deckfour.xes.model.XTrace;
import beamline.events.BEvent; import beamline.events.BEvent;
import beamline.models.responses.DirectlyFollowsRelation; import beamline.models.responses.DirectlyFollowsRelation;
/** /**
* This mapper transforms a stream of {@link XTrace}s into a stream of * This mapper transforms a stream of {@link BEvent}s into a stream of
* {@link DirectlyFollowsRelation}s. It transforms each pair of consequent * {@link DirectlyFollowsRelation}s. It transforms each pair of consequent
* events appearing in the same case as a directly follows operator (generating * events appearing in the same case as a directly follows operator (generating
* an object with type {@link DirectlyFollowsRelation}). * an object with type {@link DirectlyFollowsRelation}).
......
...@@ -2,7 +2,6 @@ package beamline.models.algorithms; ...@@ -2,7 +2,6 @@ package beamline.models.algorithms;
import java.io.IOException; import java.io.IOException;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.functions.RichFlatMapFunction; import org.apache.flink.api.common.functions.RichFlatMapFunction;
import org.apache.flink.api.common.state.ValueState; import org.apache.flink.api.common.state.ValueState;
import org.apache.flink.api.common.state.ValueStateDescriptor; import org.apache.flink.api.common.state.ValueStateDescriptor;
...@@ -14,8 +13,14 @@ import beamline.models.responses.Response; ...@@ -14,8 +13,14 @@ import beamline.models.responses.Response;
/** /**
* This abstract class defines the root of the mining algorithms hierarchy. It * This abstract class defines the root of the mining algorithms hierarchy. It
* is a {@link MapFunction} of elements with type {@link BEvent} that is capable * is a {@link RichFlatMapFunction} of elements with type {@link BEvent} that is
* of producing responses of type {@link Response}. * capable of producing responses of type {@link Response}.
*
* <p>
* 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 * @author Andrea Burattin
*/ */
...@@ -42,8 +47,13 @@ public abstract class StreamMiningAlgorithm<T extends Response> extends RichFlat ...@@ -42,8 +47,13 @@ public abstract class StreamMiningAlgorithm<T extends Response> extends RichFlat
* The argument of the method is the new observation and the returned value * The argument of the method is the new observation and the returned value
* is the result of the mining. * is the result of the mining.
* *
* <p>
* If this method returns value <tt>null</tt>, then the value is not moved
* forward into the pipeline.
*
* @param event the new event being observed * @param event the new event being observed
* @return the result of the mining of the event * @return the result of the mining of the event, or <tt>null</tt> if
* nothing should go through the rest of the pipeline
*/ */
public abstract T ingest(BEvent event); public abstract T ingest(BEvent event);
......
...@@ -2,8 +2,12 @@ package beamline.models.responses; ...@@ -2,8 +2,12 @@ package beamline.models.responses;
import java.io.Serializable; import java.io.Serializable;
import beamline.models.algorithms.StreamMiningAlgorithm;
/** /**
* Marker interface used to define the type of the responses * General class describing what a {@link StreamMiningAlgorithm} is supposed to
* return. This class can be extended with additional information. The class by
* itself carries only information regarding the number of events processed.
* *
* @author Andrea Burattin * @author Andrea Burattin
*/ */
...@@ -12,10 +16,21 @@ public class Response implements Serializable { ...@@ -12,10 +16,21 @@ public class Response implements Serializable {
private static final long serialVersionUID = 3104314256198741100L; private static final long serialVersionUID = 3104314256198741100L;
private Long processedEvents; private Long processedEvents;
/**
* Gets the number of events processed when the response was produced
*
* @return number of events processed when the response was produced
*/
public Long getProcessedEvents() { public Long getProcessedEvents() {
return processedEvents; return processedEvents;
} }
/**
* Sets the number of events processed when the response was produced
*
* @param processedEvents the number of events processed when the response
* was produced
*/
public void setProcessedEvents(Long processedEvents) { public void setProcessedEvents(Long processedEvents) {
this.processedEvents = processedEvents; this.processedEvents = processedEvents;
} }
......
package beamline.models.responses; package beamline.models.responses;
/**
* A simple {@link Response} containing just a string
*
* @author Andrea Burattin
*/
public class StringResponse extends Response { public class StringResponse extends Response {
private static final long serialVersionUID = 7863665787098981704L; private static final long serialVersionUID = 7863665787098981704L;
private String str; private String str;
/**
* Constructor
*
* @param str the value of this response
*/
public StringResponse(String str) { public StringResponse(String str) {
set(str); set(str);
} }
/**
* Gets the string of this response
*
* @return the string of this response
*/
public String get() { public String get() {
return str; return str;
} }
/**
* Sets the string of this response
*
* @param str the string of this response
*/
public void set(String str) { public void set(String str) {
this.str = str; this.str = str;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment