public override Operation Coalesce() { Condition = (BooleanOperation)Condition.Coalesce(); OnFalse = (Block)OnFalse.Coalesce(); OnTrue = (Block)OnTrue.Coalesce(); return this; }
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); }
public DoWhileLoopOperation(Block body, BooleanOperation condition) { Add(body); Add(condition); }
public WhileLoopOperation(BooleanOperation condition, Block body) { Add(condition); Add(body); }