@Test(expected = IllegalStateException.class) public void decodePhenotyped() throws TerminationException { Injector injector = Guice.createInjector(new MockProblemModule()); IndividualFactory factory = injector.getInstance(IndividualFactory.class); Individual i1 = factory.create(); SequentialIndividualCompleter completer = injector.getInstance(SequentialIndividualCompleter.class); completer.decode(i1); completer.decode(i1); }
protected void decode(Individual individual) { State state = individual.getState(); if (state == State.GENOTYPED) { individual.setState(State.DECODING); Genotype genotype = individual.getGenotype(); Object phenotype = decoder.decode(genotype); individual.setPhenotype(phenotype); } else { throw new IllegalStateException("Cannot decode Individual, current state: " + state); } }
SequentialIndividualCompleter implements IndividualCompleter { protected void decode(Individual individual) { State state = individual.getState(); if (state == State.GENOTYPED) { individual.setState(State.DECODING); Genotype genotype = individual.getGenotype(); Object phenotype = decoder.decode(genotype); individual.setPhenotype(phenotype); } else { throw new IllegalStateException("Cannot decode Individual, current state: " + state); } } }
SequentialIndividualCompleter implements IndividualCompleter { protected void decode(Individual individual) { State state = individual.getState(); if (state == State.GENOTYPED) { individual.setState(State.DECODING); Genotype genotype = individual.getGenotype(); Object phenotype = decoder.decode(genotype); individual.setPhenotype(phenotype); } else { throw new IllegalStateException("Cannot decode Individual, current state: " + state); } } @Inject  SequentialIndividualCompleter(Control control, Decoder<Genotype, Object> decoder,
			Evaluator<Object> evaluator); }
SequentialIndividualCompleter implements IndividualCompleter { protected void decode(Individual individual) { State state = individual.getState(); if (state == State.GENOTYPED) { individual.setState(State.DECODING); Genotype genotype = individual.getGenotype(); Object phenotype = decoder.decode(genotype); individual.setPhenotype(phenotype); } else { throw new IllegalStateException("Cannot decode Individual, current state: " + state); } } @Inject  SequentialIndividualCompleter(Control control, Decoder<Genotype, Object> decoder,
			Evaluator<Object> evaluator); @Override void complete(Iterable<? extends Individual> iterable); @Override void complete(Individual... individuals); }
SequentialIndividualCompleter implements IndividualCompleter { protected void decode(Individual individual) { State state = individual.getState(); if (state == State.GENOTYPED) { individual.setState(State.DECODING); Genotype genotype = individual.getGenotype(); Object phenotype = decoder.decode(genotype); individual.setPhenotype(phenotype); } else { throw new IllegalStateException("Cannot decode Individual, current state: " + state); } } @Inject  SequentialIndividualCompleter(Control control, Decoder<Genotype, Object> decoder,
			Evaluator<Object> evaluator); @Override void complete(Iterable<? extends Individual> iterable); @Override void complete(Individual... individuals);  }