}
@Override
public void applyMutation(int index, double percentage) {
StackInstruction toMutate = inst;
double pc = percentage;
percentage = Math.abs(percentage);
if (pc >= 0) {
double operand = toMutate.getOperand() + graphSize * pc;
operand = operand % graphSize + 1;
toMutate.setOperand((int) Math.round(operand));
if (toMutate.getOperand() > graphSize)
toMutate.setOperand((int) (toMutate.getOperand() % (double) graphSize));
}else{
double places = (symbols.length - 1) * percentage;
switch (toMutate.getType()) {
case PUSH:
places++;
case CLUSTER:
places++;
case NOP:
places++;
}
places = Math.round(places) % (symbols.length);
toMutate.setType(symbols[(int) places]);
}