public void check(final Validation validation, Conversion thing) { //for thread safety (concurrency) we're using a new fetcher here rather than static one Fetcher fetcher = new Fetcher( SimpleEditorMap.L3, new Filter<PropertyEditor>() { //complex.component only public boolean filter(PropertyEditor editor) { return editor.getProperty().equals("component"); } }); Set<PhysicalEntity> left = new HashSet<PhysicalEntity>(getPEsRecursively(thing.getLeft(), fetcher)); //need a mutable set Set<PhysicalEntity> right = getPEsRecursively(thing.getRight(), fetcher); left.removeAll(right); int complexDiff = getComplexCount(thing.getLeft()) - getComplexCount(thing.getRight()); if( left.isEmpty() // when there are no modifications really, but different no. complexes or participants && (complexDiff != 0 || thing.getLeft().size() - thing.getRight().size() != 0 )) error(validation, thing, "wrong.conversion.class", false, thing.getModelInterface()); }
public void check(Conversion thing, boolean fix) { //for thread safety (concurrency) we're using a new fetcher here rather than static one Fetcher fetcher = new Fetcher( SimpleEditorMap.L3, new Filter<PropertyEditor>() { //complex.component only public boolean filter(PropertyEditor editor) { return editor.getProperty().equals("component"); } }); Set<PhysicalEntity> left = new HashSet<PhysicalEntity>(getPEsRecursively(thing.getLeft(), fetcher)); //need a mutable set Set<PhysicalEntity> right = getPEsRecursively(thing.getRight(), fetcher); left.removeAll(right); int complexDiff = getComplexCount(thing.getLeft()) - getComplexCount(thing.getRight()); if( left.isEmpty() // when there are no modifications really, but different no. complexes or participants && (complexDiff != 0 || thing.getLeft().size() - thing.getRight().size() != 0 )) error(thing, "wrong.conversion.class", false, thing.getModelInterface()); }