示例#1
0
文件: Block.cs 项目: dbremner/Cortex
 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;
 }
示例#2
0
文件: Loops.cs 项目: dbremner/Cortex
 public DoWhileLoopOperation(Block body, BooleanOperation condition)
 {
     Add(body);
       Add(condition);
 }
示例#3
0
文件: Loops.cs 项目: dbremner/Cortex
 public WhileLoopOperation(BooleanOperation condition,
 Block body)
 {
     Add(condition);
       Add(body);
 }
示例#4
0
 public override Operation Coalesce()
 {
     Condition = (BooleanOperation)Condition.Coalesce();
       OnFalse = (Block)OnFalse.Coalesce();
       OnTrue = (Block)OnTrue.Coalesce();
       return this;
 }
示例#5
0
 public IfThenElseStatement(BooleanOperation condition, 
 Block onTrue, Block onFalse)
     : base(condition, onTrue)
 {
     Add(onFalse);
 }
示例#6
0
 public IfThenStatement(BooleanOperation condition, Block onTrue)
 {
     Add(condition);
       Add(onTrue);
 }