public boolean canCheck(Object thing) { return thing instanceof BindingFeature && ((BindingFeature)thing).getBindsTo() != null; }
public boolean canCheck(Object thing) { return thing instanceof BindingFeature && ((BindingFeature)thing).getBindsTo() != null; }
@Override public boolean match(BindingFeature a, BindingFeature b) { boolean ab = a.getBindsTo() != null && b.getBindsTo() != null && a.getBindsTo().isEquivalent(b.getBindsTo()); return !a.isEquivalent(b) && ab; } };
@Override public boolean match(BindingFeature a, BindingFeature b) { boolean ab = a.getBindsTo() != null && b.getBindsTo() != null && a.getBindsTo().isEquivalent(b.getBindsTo()); return !a.isEquivalent(b) && ab; } };
public void check(BindingFeature thing, boolean fix) { BindingFeature to = thing.getBindsTo(); if (to != null) { if (to.getBindsTo() == null || !thing.equals(to.getBindsTo())) { error(thing, "symmetric.violated", fix, "bindsTo", thing.getBindsTo()); if(fix) { to.setBindsTo(thing); } } } }
public void check(final Validation validation, BindingFeature thing) { BindingFeature to = thing.getBindsTo(); if (to != null) { if (to.getBindsTo() == null || !thing.equals(to.getBindsTo())) { error(validation, thing, "symmetric.violated", validation.isFix(), "bindsTo", thing.getBindsTo()); if(validation.isFix()) { to.setBindsTo(thing); } } } }
public void check(final Validation validation, Model model) { Set<BindingFeature> bfs = new HashSet<BindingFeature>( model.getObjects(BindingFeature.class)); Cluster<BindingFeature> groupping = new Cluster<BindingFeature>() { @Override public boolean match(BindingFeature a, BindingFeature b) { boolean ab = a.getBindsTo() != null && b.getBindsTo() != null && a.getBindsTo().isEquivalent(b.getBindsTo()); return !a.isEquivalent(b) && ab; } }; Set<Set<BindingFeature>> violations = groupping.cluster(bfs, Integer.MAX_VALUE); // report the error once for each cluster >1 for (Set<BindingFeature> s : violations) { if(s.size() > 1) { BindingFeature a = s.iterator().next(); error(validation, a, "inverse.functional.violated", false, "bindsTo", a.getBindsTo(), s); } } }
public void check(Model model, boolean fix) { Set<BindingFeature> bfs = new HashSet<BindingFeature>( model.getObjects(BindingFeature.class)); Cluster<BindingFeature> groupping = new Cluster<BindingFeature>() { @Override public boolean match(BindingFeature a, BindingFeature b) { boolean ab = a.getBindsTo() != null && b.getBindsTo() != null && a.getBindsTo().isEquivalent(b.getBindsTo()); return !a.isEquivalent(b) && ab; } }; Set<Set<BindingFeature>> violations = groupping.cluster(bfs, Integer.MAX_VALUE); // report the error once for each cluster >1 for (Set<BindingFeature> s : violations) { if(violations.size() > 1) { BindingFeature a = s.iterator().next(); error(a, "inverse.functional.violated", false, "bindsTo", a.getBindsTo(), BiopaxValidatorUtils.getIdListAsString(s)); } } }
private boolean isBound(Set<PhysicalEntity> participants) { for(PhysicalEntity pe : participants) { //if(pe instanceof Complex) continue; // it's impossible as far isBound called from where it is called if(pe.getFeature() != null && pe.getFeature() instanceof BindingFeature) { BindingFeature bf1 = (BindingFeature) pe.getFeature(); BindingFeature bf2 = bf1.getBindsTo(); if(bf2 != null) { Set<PhysicalEntity> bf2Of = bf2.getFeatureOf(); //if these phys. entities are (same side) participants as well if(!Collections.disjoint(participants, bf2Of)) return true; } } } return false; }
private boolean isBound(Set<PhysicalEntity> participants) { for(PhysicalEntity pe : participants) { //if(pe instanceof Complex) continue; // it's impossible as far isBound called from where it is called if(pe.getFeature() != null && pe.getFeature() instanceof BindingFeature) { BindingFeature bf1 = (BindingFeature) pe.getFeature(); BindingFeature bf2 = bf1.getBindsTo(); if(bf2 != null) { Set<PhysicalEntity> bf2Of = bf2.getFeatureOf(); //if these phys. entities are (same side) participants as well if(!Collections.disjoint(participants, bf2Of)) return true; } } } return false; }