public override Operation Coalesce()
 {
     Condition = (BooleanOperation)Condition.Coalesce();
     OnFalse = (Block)OnFalse.Coalesce();
     OnTrue = (Block)OnTrue.Coalesce();
     return this;
 }
Exemple #2
0
 public override Operation Coalesce()
 {
     Block outputBlock = new Block();
     outputBlock.OnTrueHook = OnTrueHook;
     outputBlock.OnFalseHook = OnFalseHook;
     int amountSeen = 0;
     foreach(var v in this)
     {
         if(v is StandardOperation)
         {
             amountSeen++;
         }
         else
         {
             if(amountSeen > 0)
             {
                 outputBlock.Add(new StandardOperation());
                 amountSeen = 0;
             }
             outputBlock.Add(v.Coalesce());
         }
     }
     if(amountSeen > 0) //final list of operations
         outputBlock.Add(new StandardOperation());
     return outputBlock;
 }
 public IfThenStatement(BooleanOperation condition, Block onTrue)
 {
     Add(condition);
     Add(onTrue);
 }
        public IfThenElseStatement(BooleanOperation condition, 
				Block onTrue, Block onFalse)
            : base(condition, onTrue)
        {
            Add(onFalse);
        }
Exemple #5
0
 public DoWhileLoopOperation(Block body, BooleanOperation condition)
 {
     Add(body);
     Add(condition);
 }
Exemple #6
0
        public WhileLoopOperation(BooleanOperation condition,
				Block body)
        {
            Add(condition);
            Add(body);
        }