ContextualDerivationTree extends DerivationTree { @Override boolean growNode(DerivationNode t) { Symbol s = t.getData(); boolean found = false; for(Symbol NTSymbol : nonTerminalRules) { if(s.equals(NTSymbol)) { this.structCodonList.add(this.geneCnt); found = true; } } Rule r = this.grammy.findRule(s); boolean usedCodon = false; if(r!=null && found == false) { if(r.size()>1 || r.get(0).get(0).getSymbolString().startsWith(Constants.GE_CODON_VALUE_PARSING)) { usedCodon = true; } } if(usedCodon) { for(Symbol TSymbol : terminalRules) { if(s.equals(TSymbol)) { this.nodeCodonList.add(this.geneCnt); } } } boolean result = super.growNode(t); return result; } ContextualDerivationTree(GEGrammar gram, GEChromosome gen);  ContextualDerivationTree(ContextualDerivationTree copy); ArrayList<Integer> getStructCodonList(); ArrayList<Integer> getNodeCodonList();  }
@Test public void testGrowNode() { System.out.println("* DerivationTreeTest: DerivationTree"); ContextualDerivationTree dt2 = new ContextualDerivationTree(geg, chrom); DerivationNode dn = new DerivationNode(); dn.setData(new Symbol("<string>", Enums.SymbolType.NTSymbol)); String msg = dt2.getRoot().toString() + " " + dn.toString(); assertEquals( msg, true, dn.toString().equals(dt2.getRoot().toString())); assertEquals(1, dt2.getWrapCount()); assertEquals(0, dt2.getGeneCnt()); }