public override void ExitSupset([NotNull] FormulaParser.SupsetContext context) { Console.WriteLine("ExitSupset start, stack count = " + stack.Count()); base.ExitSupset(context); Supset supset = new Supset(stack.Pop(), stack.Pop()); stack.Push(supset); }
private List <To> getResolutionByRightSupset(int rightIndex) { Supset supset = (Supset)currentEquation.getRight().getChildren()[rightIndex]; To nextEquation = (To)currentEquation.deepCopy(); nextEquation.getLeft().getChildren().Insert(0, supset.getLeft()); nextEquation.getRight().getChildren().RemoveAt(rightIndex); nextEquation.getRight().getChildren().Insert(rightIndex, supset.getRight()); return(new List <To>() { nextEquation }); }
private List <To> getResolutionByLeftSupset(int leftIndex) { Supset supset = (Supset)currentEquation.getLeft().getChildren()[leftIndex]; INode nextLeft = supset.getLeft(); INode nextRight = supset.getRight(); // In this case we have two children. To nextLeftEquation = (To)currentEquation.deepCopy(); nextLeftEquation.getLeft().getChildren().RemoveAt(leftIndex); nextLeftEquation.getRight().getChildren().Add(nextLeft); To nextRightEquation = (To)currentEquation.deepCopy(); nextRightEquation.getLeft().getChildren().RemoveAt(leftIndex); nextRightEquation.getLeft().getChildren().Insert(leftIndex, nextRight); return(new List <To>() { nextLeftEquation, nextRightEquation }); }