public void visit(ConcatenationV concatenationV) { int position = -1; for (int i = 0; i < concatenationV.Children.Count; i++) { GrammarNodeV child = concatenationV.Children[i]; if (child.getReference() == target) { position = i; break; } child.accept(this); } if (position >= 0) { int theLevel = (concatenationV.Children[position] as SymbolV).Level; concatenationV.Children[position].Dispose(); concatenationV.Children.RemoveAt(position); if (concatenationV.Children.Count == 0) { // we add the undefined that should have been added by the Model.Function.Delete method UndefinedD undefinedD = concatenationV.Reference.Children[0] as UndefinedD; concatenationV.appendChildV(new UndefinedV(undefinedD, theLevel)); } } }
public void visit(ConcatenationV concatenationV) { List<UserControl> children = new List<UserControl>(); foreach (GrammarNodeV child in concatenationV.Children) { child.accept(this); children.Add(drawnItem); } drawnItem = new Concatenation(children, concatenationV.Direction); children = null; }
public void visit(ConcatenationV concatenationV) { int position = -1; for (int i = 0; i < concatenationV.Children.Count; i++) { GrammarNodeV child = concatenationV.Children[i]; if (child.getReference() == target) position = i; child.accept(this); } if (position >= 0) { int theLevel = (concatenationV.Children[position] as SymbolV).Level; ChoiceV choiceV = concatenationV.getParent() as ChoiceV; if (choiceV == null) throw new Exception("The concatV parent was not of type choiceV"); // assert that a new choice has been added to the concatD ChoiceD choiceD = concatenationV.Reference.Parent as ChoiceD; if (choiceD == null) throw new Exception("The concatV.Ref.Parent is not of type choiceD"); if (choiceD.Children.Count < 2) throw new Exception("A new choice has not been added to the choiceD grammar."); // assuming that the last choice to be added is the new one. ConcatenationD concatDadded = choiceD.Children[choiceD.Children.Count - 1] as ConcatenationD; if (concatDadded == null) throw new Exception("The choiceD children are not of type concatD"); // assert that the new concatD has one child of type UndefinedD if (concatDadded.Children.Count > 1) throw new Exception("ConcatD is new and does not have one child of type UndefinedD"); UndefinedD undefinedD = concatDadded.Children[0] as UndefinedD; if (undefinedD == null) throw new Exception("ConcatD is new and does not have one child of type UndefinedD"); ConcatenationV newConcat = new ConcatenationV(concatDadded); UndefinedV newUndefinedV = new UndefinedV(undefinedD, theLevel); newConcat.appendChildV(newUndefinedV); choiceV.appendChildV(newConcat); } }
public void visit(ConcatenationV concatenationV) { for (int i = 0; i < concatenationV.Children.Count; i++) { GrammarNodeV child = concatenationV.Children[i]; if (child.getReference() == target) { level = (child as SymbolV).Level; child.Dispose(); child = concatenationV.Children[i] = newVisual(); } child.accept(this); } }
public void visit(ConcatenationV concatenationV) { int i = 0; int position = -1; foreach (GrammarNodeV child in concatenationV.Children) { if (child.getReference() == target.getReference()) position = i; child.accept(this); i++; } if (position > -1) { int curLevel = (concatenationV.Children[0] as SymbolV).Level; concatenationV.insertChildV(position, newVisual(curLevel)); } }
public void visit(ConcatenationD concatenationD) { List<GrammarNodeV> children = new List<GrammarNodeV>(); foreach (GrammarNodeD child in concatenationD.Children) { // make children child.accept(this); children.Add(current); } ConcatenationV concatenationV = new ConcatenationV(children, concatenationD); concatenationD.AddReference(concatenationV); current = concatenationV; }
//internal override GrammarNodeV CreateVisual(Boolean updateRef) //{ // // create the visual node // ConcatenationV returnVal = new ConcatenationV(this); // if (updateRef) // references.Add(returnVal); // // as a concatenatin should have at least 1 child, add // foreach (GrammarNodeD child in Children) // { // GrammarNodeV vNode = child.CreateVisual(updateRef); // returnVal.Children.Add(vNode); // } // return returnVal; //} public void AddReference(ConcatenationV refIn) { references.Add(refIn); }