public BooleanPermutationBranchingProgram negate(Permutation permutation) { BooleanPermutationBranchingProgram result = new BooleanPermutationBranchingProgram(); result.addProgram(this); int indexLast = getLength() - 1; result.leftPerms.add(new DefaultPermutation(result.leftPerms.remove(indexLast), permutation)); result.rightPerms.add(new DefaultPermutation(result.rightPerms.remove(indexLast), permutation)); return result; }
public BooleanPermutationBranchingProgram applyPerm(Permutation perm) { BooleanPermutationBranchingProgram result = new BooleanPermutationBranchingProgram(); Permutation permInverse = perm.getInverse(); for (int i = 0; i < getLength(); i++) { result.addInstruction( vars.get(i), new DefaultPermutation(perm, leftPerms.get(i), permInverse), new DefaultPermutation(perm, rightPerms.get(i), permInverse)); } return result; }
public void addProgram(BooleanPermutationBranchingProgram pbp) { for (int i = 0; i < pbp.getLength(); i++) { addInstruction(pbp.vars.get(i), pbp.leftPerms.get(i), pbp.rightPerms.get(i)); } }