Created
August 10, 2016 07:30
-
-
Save c0rp-aubakirov/07eaaf7a97eb45144971dd1ffc481333 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CrossoverFactory extends AbstractFactory{ | |
public static ICrossover createCrossover(CrossoverType type) { | |
report(type.name(), "Crossover"); | |
switch (type) { | |
case ONE_POINT_CROSSOVER: | |
return new OnePointCrossover(); | |
case TWO_POINT_CROSSOVER: | |
return new TwoPointCrossover(); | |
case UNIFORM_CROSSOVER: | |
return new UniformCrossover(); | |
case VAR_TO_VAR_CROSSOVER: | |
return new VarToVarCrossover(); | |
default: throw new FactoryException("ICrossover for type:" + type + " is not implemented"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment