Index: /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/DeterministicFiniteAutomaton.java
===================================================================
--- /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/DeterministicFiniteAutomaton.java	(revision 341)
+++ /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/DeterministicFiniteAutomaton.java	(revision 342)
@@ -1,4 +1,5 @@
 package de.ugoe.cs.eventbench.models;
 
+import java.security.InvalidParameterException;
 import java.util.Collection;
 import java.util.LinkedList;
@@ -52,4 +53,10 @@
 	public double getProbability(List<? extends Event<?>> context,
 			Event<?> symbol) {
+		if( context==null ) {
+			throw new InvalidParameterException("context must not be null");
+		}
+		if( symbol==null ) {
+			throw new InvalidParameterException("symbol must not be null");
+		}
 		double result = 0.0d;
 
Index: /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/HighOrderMarkovModel.java
===================================================================
--- /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/HighOrderMarkovModel.java	(revision 341)
+++ /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/HighOrderMarkovModel.java	(revision 342)
@@ -1,4 +1,5 @@
 package de.ugoe.cs.eventbench.models;
 
+import java.security.InvalidParameterException;
 import java.util.Collection;
 import java.util.LinkedList;
@@ -9,5 +10,7 @@
 
 /**
- * <p>Implements high-order Markov models.</p>
+ * <p>
+ * Implements high-order Markov models.
+ * </p>
  * 
  * @author Steffen Herbold
@@ -15,5 +18,5 @@
  */
 public class HighOrderMarkovModel extends TrieBasedModel {
-	
+
 	/**
 	 * <p>
@@ -24,41 +27,59 @@
 
 	/**
-	 * <p>Constructor. Creates a new HighOrderMarkovModel with a defined Markov order.</p>
-	 * @param maxOrder Markov order of the model
-	 * @param r random number generator used by probabilistic methods of the class
+	 * <p>
+	 * Constructor. Creates a new HighOrderMarkovModel with a defined Markov
+	 * order.
+	 * </p>
+	 * 
+	 * @param maxOrder
+	 *            Markov order of the model
+	 * @param r
+	 *            random number generator used by probabilistic methods of the
+	 *            class
 	 */
 	public HighOrderMarkovModel(int maxOrder, Random r) {
 		super(maxOrder, r);
 	}
-	
+
 	/**
 	 * <p>
-	 * Calculates the probability of the next Event being symbol based on the order of the Markov model. The order is defined in the constructor {@link #HighOrderMarkovModel(int, Random)}. 
+	 * Calculates the probability of the next Event being symbol based on the
+	 * order of the Markov model. The order is defined in the constructor
+	 * {@link #HighOrderMarkovModel(int, Random)}.
 	 * </p>
-	 * @see de.ugoe.cs.eventbench.models.IStochasticProcess#getProbability(java.util.List, de.ugoe.cs.eventbench.data.Event)
+	 * 
+	 * @see de.ugoe.cs.eventbench.models.IStochasticProcess#getProbability(java.util.List,
+	 *      de.ugoe.cs.eventbench.data.Event)
 	 */
 	@Override
-	public double getProbability(List<? extends Event<?>> context, Event<?> symbol) {
+	public double getProbability(List<? extends Event<?>> context,
+			Event<?> symbol) {
+		if (context == null) {
+			throw new InvalidParameterException("context must not be null");
+		}
+		if (symbol == null) {
+			throw new InvalidParameterException("symbol must not be null");
+		}
 		double result = 0.0d;
-		
+
 		List<Event<?>> contextCopy;
-		if( context.size()>=trieOrder ) {
-			contextCopy = new LinkedList<Event<?>>(context.subList(context.size()-trieOrder+1, context.size()));
+		if (context.size() >= trieOrder) {
+			contextCopy = new LinkedList<Event<?>>(context.subList(
+					context.size() - trieOrder + 1, context.size()));
 		} else {
 			contextCopy = new LinkedList<Event<?>>(context);
 		}
 
-	
 		Collection<Event<?>> followers = trie.getFollowingSymbols(contextCopy);
 		int sumCountFollowers = 0; // N(s\sigma')
-		for( Event<?> follower : followers ) {
+		for (Event<?> follower : followers) {
 			sumCountFollowers += trie.getCount(contextCopy, follower);
 		}
-		
+
 		int countSymbol = trie.getCount(contextCopy, symbol);
-		if( sumCountFollowers!=0 ) {
+		if (sumCountFollowers != 0) {
 			result = ((double) countSymbol / sumCountFollowers);
 		}
-		
+
 		return result;
 	}
Index: /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/IStochasticProcess.java
===================================================================
--- /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/IStochasticProcess.java	(revision 341)
+++ /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/IStochasticProcess.java	(revision 342)
@@ -2,4 +2,5 @@
 
 import java.io.Serializable;
+import java.security.InvalidParameterException;
 import java.util.Collection;
 import java.util.List;
@@ -30,4 +31,6 @@
 	 * @return probabilty the {@code symbol} is the next event, given the last
 	 *         events {@code context}
+	 * @throws InvalidParameterException
+	 *             thrown if context or symbol is null
 	 */
 	double getProbability(List<? extends Event<?>> context, Event<?> symbol);
@@ -42,4 +45,6 @@
 	 *            sequences of which the probability is calculated
 	 * @return probability of the sequences; 1.0 if sequence is empty or null
+	 * @throws InvalidParameterException
+	 *             thrown if sequence is null
 	 */
 	double getProbability(List<? extends Event<?>> sequence);
@@ -66,4 +71,6 @@
 	 * @return generated sequences
 	 * @see #generateSequences(int, boolean)
+	 * @throws InvalidParameterException
+	 *             thrown if length is less than or equal to 0
 	 */
 	public Collection<List<? extends Event<?>>> generateSequences(int length);
@@ -84,4 +91,6 @@
 	 *            {@link Event#STARTEVENT}
 	 * @return generated sequences
+	 * @throws InvalidParameterException
+	 *             thrown if length is less than or equal to 0
 	 */
 	public Collection<List<? extends Event<?>>> generateSequences(int length,
@@ -99,4 +108,6 @@
 	 * @param length
 	 * @return generated sequences
+	 * @throws InvalidParameterException
+	 *             thrown if length is less than or equal to 0
 	 */
 	public Collection<List<? extends Event<?>>> generateValidSequences(
Index: /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/PredictionByPartialMatch.java
===================================================================
--- /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/PredictionByPartialMatch.java	(revision 341)
+++ /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/PredictionByPartialMatch.java	(revision 342)
@@ -1,4 +1,5 @@
 package de.ugoe.cs.eventbench.models;
 
+import java.security.InvalidParameterException;
 import java.util.Collection;
 import java.util.LinkedList;
@@ -93,8 +94,18 @@
 	 * @param probEscape
 	 *            escape probability used by the model
+	 * @throws InvalidParameterException thrown if minOrder is less than 0 or greater than markovOrder or probEscape is not in the interval (0,1)
 	 */
 	public PredictionByPartialMatch(int markovOrder, int minOrder, Random r,
 			double probEscape) {
 		super(markovOrder, r);
+		if( minOrder< 0 ) {
+			throw new InvalidParameterException("minOrder must be greather than or equal to 0");
+		}
+		if( minOrder>markovOrder) {
+			throw new InvalidParameterException("minOrder must be less than or equal to markovOrder");
+		}
+		if( probEscape<=0.0 || probEscape>=1.0) {
+			throw new InvalidParameterException("probEscape must be in the interval (0,1)");
+		}
 		this.probEscape = probEscape;
 		this.minOrder = minOrder;
@@ -133,8 +144,17 @@
 	 * P_{MM^i} denotes the probability in an i-th order Markov model.
 	 * </p>
+	 * 
+	 * @see de.ugoe.cs.eventbench.models.IStochasticProcess#getProbability(java.util.List,
+	 *      de.ugoe.cs.eventbench.data.Event)
 	 */
 	@Override
 	public double getProbability(List<? extends Event<?>> context,
 			Event<?> symbol) {
+		if (context == null) {
+			throw new InvalidParameterException("context must not be null");
+		}
+		if (symbol == null) {
+			throw new InvalidParameterException("symbol must not be null");
+		}
 		double result = 0.0d;
 		double resultCurrentContex = 0.0d;
@@ -161,5 +181,5 @@
 			resultCurrentContex = (double) countSymbol / sumCountFollowers;
 		}
-		if (contextCopy.size() >= minOrder) {
+		if (contextCopy.size() > minOrder) {
 			resultCurrentContex *= (1 - probEscape);
 			contextCopy.remove(0);
Index: /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieBasedModel.java
===================================================================
--- /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieBasedModel.java	(revision 341)
+++ /trunk/EventBenchCore/src/de/ugoe/cs/eventbench/models/TrieBasedModel.java	(revision 342)
@@ -70,7 +70,18 @@
 	 *            random number generator used by probabilistic methods of the
 	 *            class
+	 * @throws InvalidParameterException
+	 *             thrown if markovOrder is less than 0 or the random number
+	 *             generator r is null
 	 */
 	public TrieBasedModel(int markovOrder, Random r) {
 		super();
+		if (markovOrder < 0) {
+			throw new InvalidParameterException(
+					"markov order must not be less than 0");
+		}
+		if (r == null) {
+			throw new InvalidParameterException(
+					"random number generator r must not be null");
+		}
 		this.trieOrder = markovOrder + 1;
 		this.r = r;
@@ -87,4 +98,6 @@
 	 * @param sequences
 	 *            training data
+	 * @throws InvalidParameterException
+	 *             thrown is sequences is null
 	 */
 	public void train(Collection<List<? extends Event<?>>> sequences) {
@@ -103,8 +116,10 @@
 	 * @param sequences
 	 *            training data
+	 * @throws InvalidParameterException
+	 *             thrown is sequences is null
 	 */
 	public void update(Collection<List<? extends Event<?>>> sequences) {
 		if (sequences == null) {
-			return;
+			throw new InvalidParameterException("sequences must not be null");
 		}
 		if (trie == null) {
@@ -129,13 +144,13 @@
 	public List<? extends Event<?>> randomSequence() {
 		List<Event<?>> sequence = new LinkedList<Event<?>>();
-		if( trie!=null ) {
+		if (trie != null) {
 			IncompleteMemory<Event<?>> context = new IncompleteMemory<Event<?>>(
 					trieOrder - 1);
 			context.add(Event.STARTEVENT);
-	
+
 			Event<?> currentState = Event.STARTEVENT;
-	
+
 			boolean endFound = false;
-	
+
 			while (!endFound) {
 				double randVal = r.nextDouble();
@@ -147,5 +162,6 @@
 						endFound = (symbol == Event.ENDEVENT);
 						if (!(symbol == Event.STARTEVENT || symbol == Event.ENDEVENT)) {
-							// only add the symbol the sequence if it is not START
+							// only add the symbol the sequence if it is not
+							// START
 							// or END
 							context.add(symbol);
@@ -344,11 +360,12 @@
 	@Override
 	public double getProbability(List<? extends Event<?>> sequence) {
+		if (sequence == null) {
+			throw new InvalidParameterException("sequence must not be null");
+		}
 		double prob = 1.0;
-		if (sequence != null) {
-			List<Event<?>> context = new LinkedList<Event<?>>();
-			for (Event<?> event : sequence) {
-				prob *= getProbability(context, event);
-				context.add(event);
-			}
+		List<Event<?>> context = new LinkedList<Event<?>>();
+		for (Event<?> event : sequence) {
+			prob *= getProbability(context, event);
+			context.add(event);
 		}
 		return prob;
