public void visit(ChoiceV choiceV) { foreach (GrammarNodeV child in choiceV.Children) { child.accept(this); } }
public void visit(ChoiceV choiceV) { List<UserControl> children = new List<UserControl>(); foreach (GrammarNodeV child in choiceV.Children) { child.accept(this); children.Add(drawnItem); } drawnItem = new Choice(children, choiceV.Direction); children = null; }
public void AddReference(ChoiceV choiceV) { references.Add(choiceV); }
public void visit(ChoiceD choiceD) { List<GrammarNodeV> children = new List<GrammarNodeV>(); foreach (GrammarNodeD child in choiceD.Children) { // make children child.accept(this); children.Add(current); } ChoiceV choiceV = new ChoiceV(children, choiceD); choiceD.AddReference(choiceV); current = choiceV; }
public void visit(ChoiceV choiceV) { GrammarNodeV childToDelete = null; int position = -1; for (int i = 0; i < choiceV.Children.Count; i++) { GrammarNodeV child = choiceV.Children[i]; if (child.getReference() == target) { position = i; break; } child.accept(this); // assert child is a concatenationV if (!(child is ConcatenationV)) throw new Exception("Child is not of type concatenationV"); if ((child as ConcatenationV).Children.Count == 0) childToDelete = child; } if (childToDelete != null) { childToDelete.Dispose(); choiceV.Children.Remove(childToDelete); } if (position >= 0) { if (choiceV.Children.Count == 1) throw new Exception("Should not be removing the choice when only one choice remains, sharpen up!"); // much better, we're remvoing a choice choiceV.Children[position].Dispose(); choiceV.Children.RemoveAt(position); } }
public void visit(ChoiceV choiceV) { int initialCount = choiceV.Children.Count; for (int i = 0; i < initialCount; i++) { choiceV.Children[i].accept(this); } }