ConstructiveIndividual extends Individual implements Iterable<T> { public boolean repOK() { return P_DEFAULTBASE != null && !P_DEFAULTBASE.isEmpty() && components != null && !Misc.containsNulls(components) && componentsSet.size() == new HashSet<T>(components).size() && componentsSet.equals(new HashSet<T>(components)); }  T get(final int i); @Override Parameter defaultBase(); @Override Object clone(); List<T> getComponents(); void setComponents(final EvolutionState state, final Collection<T> newComponents); void add(final EvolutionState state, final T component); boolean contains(final T component); @Override Iterator<T> iterator(); boolean isEmpty(); @Override long size(); @Override boolean equals(final Object ind); @Override int hashCode(); @Override String toString(); @Override void writeGenotype(final EvolutionState state, final DataOutput dataOutput); @Override void readGenotype(final EvolutionState state, final DataInput dataInput); boolean repOK(); static final String P_DEFAULTBASE; }
@Test public void testIterator2() { final ConstructiveIndividual<KnapsackComponent> instance = new ConstructiveIndividual<KnapsackComponent>(); for (final KnapsackComponent c : instance) fail("Non-empty iterator for empty individual"); assertTrue(instance.repOK()); }