Index: trunk/sources/HeuristicLab.Operators/3.3/StochasticBranch.cs
===================================================================
--- trunk/sources/HeuristicLab.Operators/3.3/StochasticBranch.cs	(revision 1670)
+++ trunk/sources/HeuristicLab.Operators/3.3/StochasticBranch.cs	(revision 2773)
@@ -23,44 +23,55 @@
 using System.Collections.Generic;
 using System.Text;
+using System.Xml;
 using HeuristicLab.Core;
 using HeuristicLab.Data;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
 
 namespace HeuristicLab.Operators {
   /// <summary>
-  /// Branch of (one or) two operators that have different probabilities to get executed.
+  /// A branch of two operators which are executed with a specified probability.
   /// </summary>
-  public class StochasticBranch : OperatorBase {
-    /// <inheritdoc select="summary"/>
-    public override string Description {
-      get { return @"TODO\r\nOperator description still missing ..."; }
+  [Item("StochasticBranch", "A branch of two operators which are executed with a specified probability.")]
+  [Creatable("Test")]
+  [EmptyStorableClass]
+  public class StochasticBranch : SingleSuccessorOperator {
+    public LookupParameter<IRandom> RandomParameter {
+      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
+    }
+    public ValueLookupParameter<DoubleData> ProbabilityParameter {
+      get { return (ValueLookupParameter<DoubleData>)Parameters["Probability"]; }
+    }
+    protected OperatorParameter FirstBranchParameter {
+      get { return (OperatorParameter)Parameters["FirstBranch"]; }
+    }
+    protected OperatorParameter SecondBranchParameter {
+      get { return (OperatorParameter)Parameters["SecondBranch"]; }
+    }
+    public IOperator FirstBranch {
+      get { return FirstBranchParameter.Value; }
+      set { FirstBranchParameter.Value = value; }
+    }
+    public IOperator SecondBranch {
+      get { return SecondBranchParameter.Value; }
+      set { SecondBranchParameter.Value = value; }
     }
 
-    /// <summary>
-    /// Initializes a new instance of <see cref="StochasticBranch"/> with two variable infos
-    /// (<c>Random</c> and <c>Probability</c>).
-    /// </summary>
     public StochasticBranch()
       : base() {
-      AddVariableInfo(new VariableInfo("Random", "Pseudo random number generator", typeof(IRandom), VariableKind.In));
-      AddVariableInfo(new VariableInfo("Probability", "Probability to choose first branch", typeof(DoubleData), VariableKind.In));
+      Parameters.Add(new LookupParameter<IRandom>("Random", "A pseudo random number generator."));
+      Parameters.Add(new ValueLookupParameter<DoubleData>("Probability", "The probability to execute the first branch."));
+      Parameters.Add(new OperatorParameter("FirstBranch", "The operator which is executed with the given probability."));
+      Parameters.Add(new OperatorParameter("SecondBranch", "The operator which is executed if the first branch is not executed."));
     }
 
-    /// <summary>
-    /// Applies the operator of branch one with a specific probability on the given 
-    /// <paramref name="scope"/>, or - if existent - with another probability operator of branch two.  
-    /// </summary>
-    /// <param name="scope">The scope to apply the operators on.</param>
-    /// <returns>A new <see cref="AtomicOperation"/> with either operator 1 or operator 2 applied
-    /// to the given <paramref name="scope"/> or <c>null</c>.</returns>
-    public override IOperation Apply(IScope scope) {
-      IRandom random = GetVariableValue<IRandom>("Random", scope, true);
-      DoubleData probability = GetVariableValue<DoubleData>("Probability", scope, true);
-
-      bool result = random.NextDouble() < probability.Data;
-      if ((result) && (SubOperators.Count > 0) && (SubOperators[0] != null))
-        return new AtomicOperation(SubOperators[0], scope);
-      else if ((!result) && (SubOperators.Count > 1) && (SubOperators[1] != null))
-        return new AtomicOperation(SubOperators[1], scope);
-      return null;
+    public override IExecutionSequence Apply() {
+      ExecutionContextCollection next = new ExecutionContextCollection(base.Apply());
+      if (RandomParameter.ActualValue.NextDouble() < ProbabilityParameter.ActualValue.Value) {
+        if (FirstBranch != null) next.Insert(0, new ExecutionContext(ExecutionContext.Parent, FirstBranch, ExecutionContext.Scope));
+      } else {
+        if (SecondBranch != null) next.Insert(0, new ExecutionContext(ExecutionContext.Parent, SecondBranch, ExecutionContext.Scope));
+      }
+      return next;
     }
   }
