public GrammarNodeD AddAfter(NonterminalHeadD nonterminalHeadD, GrammarNodeV target, VADG.Global.SymbolType symbolType)
        {
            GrammarNodeDAddAfterVisitor visitor = new GrammarNodeDAddAfterVisitor();
            visitor.Target = target.getReference();
            visitor.SymbolType = symbolType;

            visitor.visit(nonterminalHeadD);

            return visitor.Item;
        }
        public GrammarNodeD AddBefore(NonterminalHeadD nonterminalHeadD, GrammarNodeV grammarNodeV, VADG.Global.SymbolType symbolType)
        {
            GrammarNodeDAddBeforeVisitor visitor = new GrammarNodeDAddBeforeVisitor();
            visitor.Target = grammarNodeV.getReference();
            visitor.SymbolType = symbolType;

            visitor.visit(nonterminalHeadD);

            return visitor.Item;
        }
        private void Delete(GrammarNodeV itemToDelete)
        {
            model.Functions.Delete(itemToDelete.getReference());

            // if deleting a rule, check it's not the last time it's ever used (poor rule :( )
            GrammarNodeD grammarNodeD = itemToDelete.getReference();
            if (grammarNodeD is NonterminalTailD)
            {
                NonterminalTailD nontTail = grammarNodeD as NonterminalTailD;
                String ruleName = nontTail.Reference.Name;

                // traverse from the startsymbol through the grammar
                // if we never find this rule used, offer to remove the rule from the definitive grammar
                GrammarNodeDExistsVisitor visitor = new GrammarNodeDExistsVisitor(ruleName, VADG.Global.SymbolType.Nonterminal);
                model.DefinitiveGrammar.StartSymbol.accept(visitor);

                if (!visitor.Found)
                {
                    if (OfferDeleteRule != null)
                        OfferDeleteRule(nontTail.Reference);
                }
            }

            view.Functions.Delete(itemToDelete);

            ReDraw();
        }
        public void Delete(GrammarNodeV itemToDelete)
        {
            GrammarNodeVDeleteVisitor visitor = new GrammarNodeVDeleteVisitor(itemToDelete.getReference());

            startSymbol.accept(visitor);
        }