GEIndividual extends AbstractIndividual { public void map(int map) { if (!this.mapped) { this.phenotype.clear(); this.valid = this.grammar.genotype2Phenotype(true); this.previouslyValid = this.valid; this.mapped = true; this.dT = this.grammar.getDerivationTree(); this.usedCodons = this.grammar.getUsedCodons(); this.usedWraps = this.grammar.getUsedWraps(); } } GEIndividual();  GEIndividual(GEGrammar g, Phenotype p, Genotype gen, Fitness f); private  GEIndividual(GEIndividual i); static GEIndividual getIndividual(final GEGrammar grammar, final Phenotype phen, final Genotype genotype, final Fitness fitness); void revalidate(GEIndividual ind); void invalidate(); boolean isMapped(); void setMapped(boolean mapped); boolean isValid(); void setValid(boolean b); boolean wasPreviouslyValid(); void setUsedCodons(int usedCodons); void setUsedWraps(int usedWraps); void map(int map); String getPhenotypeString(int map); Genotype getGenotype(); Mapper getMapper(); void setMapper(Mapper m); void setGenotype(Genotype g); void setPhenotype(Phenotype p); Phenotype getPhenotype(); Individual clone(); @Override String toString(); int getUsedCodons(); void setPreviouslyUsedCodons(int previouslyUsedCodons); int getPreviouslyUsedCodons(); int getUsedWraps(); int[] getCrossoverPoints(); int[] getMutationPoints(); ArrayList<Fitness> getParents(); void setCrossoverPoints(int[] crossoverPoints); void setMutationPoints(int[] mutationPoints); void setParents(ArrayList<Fitness> parents);  }
@Test public void testMap() { System.out.println("* GEIndividualTest: map"); int map = 0; ((GEGrammar)gei.getMapper()).setDerivationTreeType(null); try { gei.map(map); } catch(NullPointerException e) { assertTrue(true); } gei = IndividualMaker.makeIndividual(); gei.map(map); assertEquals(true, gei.isMapped()); assertEquals(true, gei.isValid()); assertEquals(3, gei.getUsedCodons()); assertEquals(1, gei.getUsedWraps()); assertEquals(true, gei.getPhenotype().getStringNoSpace().equals("a")); gei = IndividualMaker.makeIndividual(); gei.map(Integer.MIN_VALUE); assertEquals(true, gei.isMapped()); assertEquals(true, gei.isValid()); assertEquals(3, gei.getUsedCodons()); assertEquals(1, gei.getUsedWraps()); assertEquals(true, gei.getPhenotype().getStringNoSpace().equals("a")); gei = IndividualMaker.makeIndividual(); gei.setMapped(true); gei.map(0); assertEquals(false, gei.isValid()); assertEquals(true, gei.isMapped()); }