private static String prettyPrintPartitions(UnionFind<Variable> unionFind) { StringBuilder result = new StringBuilder(); for (Set<Variable> partition : unionFind.getPartitions()) { result.append("["); result.append(partition.stream().map(Variable::getName).collect(Collectors.joining(", "))); result.append("]"); } return result.toString(); }
/** * Returns a copy of this with the given value removed. The given value does not have to be a set's root node. */ private static <V> UnionFind<V> copyAndRemove(UnionFind<V> unionFind, V element) { UnionFind<V> result = new UnionFind<>(); for (Set<V> partition : unionFind.getPartitions()) { Set<V> filteredPartition = new HashSet<>(partition); filteredPartition.remove(element); result.makeSet(filteredPartition); } return result; }
individualRefCounters.put(var, new VariableReferenceCount(Collections.singleton(var), isParameter)); for (Set<Variable> partition : variableUnions.getPartitions()) { boolean isParameter = false; for (Variable var : partition) {
if (generalUnionFindForVariables.getPartitions().size() > 1) { } else if (justPositiveUnionFindForVariables.getPartitions().size() > 1) {