public override Operation Coalesce()
 {
     Condition = (BooleanOperation)Condition.Coalesce();
     OnFalse = (Block)OnFalse.Coalesce();
     OnTrue = (Block)OnTrue.Coalesce();
     return this;
 }
예제 #2
0
파일: Block.cs 프로젝트: arnoldas/Operation
 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);
        }
예제 #5
0
파일: Loops.cs 프로젝트: arnoldas/Operation
 public DoWhileLoopOperation(Block body, BooleanOperation condition)
 {
     Add(body);
     Add(condition);
 }
예제 #6
0
파일: Loops.cs 프로젝트: arnoldas/Operation
        public WhileLoopOperation(BooleanOperation condition,
				Block body)
        {
            Add(condition);
            Add(body);
        }