@Override public void add(int index, Outcrosser element) { if (index < males.size()) { if (element.isFemale()) throw new IllegalArgumentException( "Element in index " + index + " is a male, cannot be replaced by a female"); males.add(index, element); } else { if (!element.isFemale()) throw new IllegalArgumentException( "Element in index " + index + " is a female, cannot be replaced by a male"); females.add(index - males.size(), element); } }
@Override public boolean filter(Outcrosser o) { return o.getOutcrossingModifier() == FUbenchmark || o.getOutcrossingModifier() == UFbenchmark; }
@Override public boolean add(Outcrosser e) { if (e.isFemale()) return females.add(e); else return males.add(e); }