GEGrammar extends ContextFreeGrammar implements ParameterI { @Override public boolean equals(Object obj) { if (obj == null || getClass() != obj.getClass()) { return false; } final GEGrammar that = (GEGrammar) obj; if (name != that.name && (name == null || name.equals(that.name) == false)) { return false; } return true; } GEGrammar();  GEGrammar(String file);  GEGrammar(StringBuilder bnfGrammar);  GEGrammar(Properties p);  GEGrammar(GEGrammar copy); void setProperties(Properties p); void setProperties(Properties p, boolean reloadFromFile); boolean genotype2Phenotype(); boolean phenotype2Genotype(); void generatePRC(); void clear(); @SuppressWarnings({"UnusedAssignment"}) boolean genotype2Phenotype(boolean b); static GEGrammar getGrammar(final GEGrammar g); int getMaxCurrentTreeDepth(); void setMaxCurrentTreeDepth(int maxCurrentTreeDepth); int getMaxWraps(); void setMaxWraps(int i); void setGenotype(GEChromosome genotype); void setPhenotype(Phenotype phenotype); Phenotype getPhenotype(); GEChromosome getGenotype(); void setPhenotype(Object p); void setGenotype(Object g); int getUsedCodons(); int getUsedWraps(); int getMaxDerivationTreeDepth(); void setMaxDerivationTreeDepth(int maxDerivationTreeDepth); void setDerivationTree(DerivationTree dT); DerivationTree getDerivationTree(); int getMaxChromosomeLengthByDepth(); String getName(); @Override boolean equals(Object obj); @Override int hashCode(); int getDTNodeCount(); void setDerivationTreeType(String derivationTreeType); @Override String getDerivationString();  }
@Test public void testEquals() { System.out.println("* GEGrammarTest: equals"); Object obj = null; GEGrammar instance = new GEGrammar(); boolean expResult = false; boolean result = instance.equals(obj); assertEquals(expResult, result); ContextFreeGrammar cfg = new ContextFreeGrammarMock(); assertEquals(false, geg.equals(cfg)); instance = new GEGrammar(geg); instance.setPhenotype(new Phenotype()); int[] ia = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; GEChromosome chrom = new GEChromosome(10, ia); chrom.setMaxChromosomeLength(10); instance.setGenotype(chrom); geg.genotype2Phenotype(true); instance.genotype2Phenotype(true); assertEquals(true, geg.equals(instance)); assertEquals(false, geg.getName() == instance.getName()); instance = new GEGrammar(geg); instance.setPhenotype(new Phenotype()); ia[0] = 1; chrom = new GEChromosome(10, ia); chrom.setMaxChromosomeLength(10); instance.setGenotype(chrom); geg.genotype2Phenotype(true); instance.genotype2Phenotype(true); assertEquals(false, geg.equals(instance)); instance = new GEGrammar(geg); assertEquals(true, instance.equals(geg)); assertNotSame(instance, geg); }