[17] | 1 | package de.ugoe.cs.eventbench.models;
|
---|
| 2 |
|
---|
[86] | 3 | import java.io.Serializable;
|
---|
[17] | 4 | import java.util.List;
|
---|
[80] | 5 | import java.util.Set;
|
---|
[17] | 6 |
|
---|
| 7 | import de.ugoe.cs.eventbench.data.Event;
|
---|
| 8 |
|
---|
[99] | 9 | /**
|
---|
| 10 | * <p>
|
---|
| 11 | * This interface defines the functionalities provided by stochastic processes.
|
---|
| 12 | * </p>
|
---|
| 13 | *
|
---|
| 14 | * @author Steffen Herbold
|
---|
| 15 | * @version 1.0
|
---|
| 16 | */
|
---|
[86] | 17 | public interface IStochasticProcess extends Serializable {
|
---|
[99] | 18 |
|
---|
| 19 | /**
|
---|
| 20 | * <p>
|
---|
| 21 | * Returns the probability, that the next event is {@code symbol} given the
|
---|
| 22 | * last events are {@code context}. The last element of {@code context} is
|
---|
| 23 | * the most recent in the history, the first element is the oldest.
|
---|
| 24 | * </p>
|
---|
| 25 | *
|
---|
| 26 | * @param context
|
---|
| 27 | * recently observed symbols
|
---|
| 28 | * @param symbol
|
---|
| 29 | * event for which the probability is calculated
|
---|
| 30 | * @return probabilty the {@code symbol} is the next event, given the last
|
---|
| 31 | * events {@code context}
|
---|
| 32 | */
|
---|
[93] | 33 | double getProbability(List<? extends Event<?>> context, Event<?> symbol);
|
---|
[17] | 34 |
|
---|
[99] | 35 | /**
|
---|
| 36 | * <p>
|
---|
| 37 | * Generates a random sequence of events. The sequence starts with
|
---|
| 38 | * {@link Event#STARTEVENT} and finishes with {@link Event#ENDEVENT}.
|
---|
| 39 | * </p>
|
---|
| 40 | *
|
---|
| 41 | * @return randomly generated sequence
|
---|
| 42 | */
|
---|
[66] | 43 | public List<? extends Event<?>> randomSequence();
|
---|
[99] | 44 |
|
---|
| 45 | /**
|
---|
| 46 | * <p>
|
---|
| 47 | * Generates all sequences of a given length are possible, i.e., have a
|
---|
| 48 | * positive probability.<br>
|
---|
| 49 | * All states are used as possible starting states.
|
---|
| 50 | * </p>
|
---|
| 51 | *
|
---|
| 52 | * @param length
|
---|
| 53 | * length of the generated sequences
|
---|
| 54 | * @return generated sequences
|
---|
| 55 | * @see #generateSequences(int, boolean)
|
---|
| 56 | */
|
---|
[93] | 57 | public Set<List<? extends Event<?>>> generateSequences(int length);
|
---|
[99] | 58 |
|
---|
| 59 | /**
|
---|
| 60 | * <p>
|
---|
| 61 | * Generates all sequences of given length that can are possible, i.e., have
|
---|
| 62 | * positive probability.<br>
|
---|
| 63 | * If {@code fromStart==true}, all generated sequences start in
|
---|
| 64 | * {@link Event#STARTEVENT}. Otherwise this method is the same as
|
---|
| 65 | * {@link #generateSequences(int)}.
|
---|
| 66 | * </p>
|
---|
| 67 | *
|
---|
| 68 | * @param length
|
---|
| 69 | * length of the generated sequences
|
---|
| 70 | * @param fromStart
|
---|
| 71 | * if true, all generated sequences start with
|
---|
| 72 | * {@link Event#STARTEVENT}
|
---|
| 73 | * @return generated sequences
|
---|
| 74 | */
|
---|
| 75 | public Set<List<? extends Event<?>>> generateSequences(int length,
|
---|
| 76 | boolean fromStart);
|
---|
| 77 |
|
---|
| 78 | /**
|
---|
| 79 | * <p>
|
---|
| 80 | * Generates all sequences starting with {@link Event#STARTEVENT} and
|
---|
| 81 | * finishing with {@link Event#ENDEVENT} of a given length. It is possible
|
---|
| 82 | * that no such sequence exists with the defined length and the returned set
|
---|
| 83 | * is empty. If {@code length} is less than 2 the returned set is always
|
---|
| 84 | * empty.
|
---|
| 85 | * </p>
|
---|
| 86 | *
|
---|
| 87 | * @param length
|
---|
| 88 | * @return generated sequences
|
---|
| 89 | */
|
---|
[94] | 90 | public Set<List<? extends Event<?>>> generateValidSequences(int length);
|
---|
[99] | 91 |
|
---|
| 92 | /**
|
---|
| 93 | * <p>
|
---|
| 94 | * Returns the number of states known by the stochastic process, i.e., the
|
---|
| 95 | * size of its alphabet.
|
---|
| 96 | * </p>
|
---|
| 97 | *
|
---|
| 98 | * @return number of states
|
---|
| 99 | */
|
---|
[66] | 100 | public int getNumStates();
|
---|
[99] | 101 |
|
---|
| 102 | /**
|
---|
| 103 | * <p>
|
---|
| 104 | * Returns a string representation of all known states.
|
---|
| 105 | * </p>
|
---|
| 106 | *
|
---|
| 107 | * @return string representation for all known states
|
---|
| 108 | */
|
---|
[70] | 109 | public String[] getStateStrings();
|
---|
[99] | 110 |
|
---|
| 111 | /**
|
---|
| 112 | * <p>
|
---|
| 113 | * Returns all states known by the stochastic process, i.e., its
|
---|
| 114 | * {@link Event}s.
|
---|
| 115 | * </p>
|
---|
| 116 | *
|
---|
| 117 | * @return events known by the process
|
---|
| 118 | */
|
---|
[93] | 119 | public Set<? extends Event<?>> getEvents();
|
---|
[17] | 120 |
|
---|
| 121 | } |
---|