@Test public void optimise_circularDependency() { ConstraintNode original = constraintNode() .withDecision( constraintNode() .where(A).isNull() .where(B).isNull(), constraintNode() .where(A).isNotNull()) .withDecision( constraintNode() .where(B).isNull() .where(A).isNull(), constraintNode() .where(B).isNotNull()) .build(); ConstraintNode actual = optimiser.optimiseTree(new DecisionTree(original, new ProfileFields(Collections.EMPTY_LIST))) .getRootNode(); assertThat(actual, sameBeanAs(original)); }
public DecisionTree optimiseTree(DecisionTree tree){ ConstraintNode newRootNode = optimiseLevelOfTree(tree.getRootNode()); return new DecisionTree(newRootNode, tree.getFields()); }
DecisionTreeOptimiser { public DecisionTree optimiseTree(DecisionTree tree){ ConstraintNode newRootNode = optimiseLevelOfTree(tree.getRootNode()); return new DecisionTree(newRootNode, tree.getFields()); } }
DecisionTreeOptimiser { public DecisionTree optimiseTree(DecisionTree tree){ ConstraintNode newRootNode = optimiseLevelOfTree(tree.getRootNode()); return new DecisionTree(newRootNode, tree.getFields()); }  }
DecisionTreeOptimiser { public DecisionTree optimiseTree(DecisionTree tree){ ConstraintNode newRootNode = optimiseLevelOfTree(tree.getRootNode()); return new DecisionTree(newRootNode, tree.getFields()); }  DecisionTree optimiseTree(DecisionTree tree); }
DecisionTreeOptimiser { public DecisionTree optimiseTree(DecisionTree tree){ ConstraintNode newRootNode = optimiseLevelOfTree(tree.getRootNode()); return new DecisionTree(newRootNode, tree.getFields()); }  DecisionTree optimiseTree(DecisionTree tree);  }