Grammar implements Mapper { @SuppressWarnings({"UnusedReturnValue", "SameParameterValue"}) boolean setStartSymbol(int index) { if (index < rules.size() && index >= 0) { startSymbol_index = index; genotype2Phenotype(); return true; } return false; } Grammar();   Grammar(Grammar copy); abstract boolean genotype2Phenotype(); abstract boolean phenotype2Genotype(); abstract String getDerivationString(); abstract void clear(); Symbol getStartSymbol(); boolean setStartSymbol(Symbol newStartSymbol); boolean setStartSymbol(String newStartSymbol); Rule getStartRule(); ArrayList<Rule> getRules(); int getProductionCount(); void setRules(ArrayList<Rule> newRules); ArrayList<Symbol> getTerminals(); ArrayList<String> getTerminalStrings();  }
@Test public void testSetStartSymbol_Symbol() { System.out.println("* GrammarTest: setStartSymbol_Symbol"); assertEquals(true, g.setStartSymbol(startSymbol)); boolean result = true; result = g.setStartSymbol(new Symbol("fake", Enums.SymbolType.NTSymbol)); assertEquals(false, result); result = true; result = g.setStartSymbol(new Symbol("lhs", Enums.SymbolType.TSymbol)); assertTrue(true); assertEquals(false, result); }
@Test public void testSetStartSymbol_String() { System.out.println("* GrammarTest: setStartSymbol_String"); assertEquals(true, g.setStartSymbol("lhs")); boolean result = true; result = g.setStartSymbol("testT"); assertEquals(false, result); }