package de.ugoe.cs.eventbench.models; import java.io.Serializable; import java.util.List; import java.util.Set; import de.ugoe.cs.eventbench.data.Event; /** *

* This interface defines the functionalities provided by stochastic processes. *

* * @author Steffen Herbold * @version 1.0 */ public interface IStochasticProcess extends Serializable { /** *

* Returns the probability, that the next event is {@code symbol} given the * last events are {@code context}. The last element of {@code context} is * the most recent in the history, the first element is the oldest. *

* * @param context * recently observed symbols * @param symbol * event for which the probability is calculated * @return probabilty the {@code symbol} is the next event, given the last * events {@code context} */ double getProbability(List> context, Event symbol); /** *

* Generates a random sequence of events. The sequence starts with * {@link Event#STARTEVENT} and finishes with {@link Event#ENDEVENT}. *

* * @return randomly generated sequence */ public List> randomSequence(); /** *

* Generates all sequences of a given length are possible, i.e., have a * positive probability.
* All states are used as possible starting states. *

* * @param length * length of the generated sequences * @return generated sequences * @see #generateSequences(int, boolean) */ public Set>> generateSequences(int length); /** *

* Generates all sequences of given length that can are possible, i.e., have * positive probability.
* If {@code fromStart==true}, all generated sequences start in * {@link Event#STARTEVENT}. Otherwise this method is the same as * {@link #generateSequences(int)}. *

* * @param length * length of the generated sequences * @param fromStart * if true, all generated sequences start with * {@link Event#STARTEVENT} * @return generated sequences */ public Set>> generateSequences(int length, boolean fromStart); /** *

* Generates all sequences starting with {@link Event#STARTEVENT} and * finishing with {@link Event#ENDEVENT} of a given length. It is possible * that no such sequence exists with the defined length and the returned set * is empty. If {@code length} is less than 2 the returned set is always * empty. *

* * @param length * @return generated sequences */ public Set>> generateValidSequences(int length); /** *

* Returns the number of states known by the stochastic process, i.e., the * size of its alphabet. *

* * @return number of states */ public int getNumStates(); /** *

* Returns a string representation of all known states. *

* * @return string representation for all known states */ public String[] getStateStrings(); /** *

* Returns all states known by the stochastic process, i.e., its * {@link Event}s. *

* * @return events known by the process */ public Set> getEvents(); }