throw new RuntimeException(String.format("Gene Type \"%s\" is not recognised.", type));
}
}
public static ClusterHead convertInstructionGene(List<InstructionGene> program, ClusterHead originalTree) {
VecInterpreter interp = new VecInterpreter(new ArrayList<VecInstruction>(), originalTree.deepCopy());
int size = originalTree.getSize();
VecInstruction inst = null;
for (int i = 0; i < program.size(); i++) {
Gene g = program.get(i);
if (g instanceof IntegerGene) {
IntegerGene ig = (IntegerGene) g;
inst = IntegerInstructionGene.getInstruction(ig.intValue(),
size);
} else if (g instanceof InstructionGene) {
inst = ((InstructionGene) g).getInstruction();
}
interp.execute(inst);
}
return interp.getTree();
}