private Restriction build() { switch (restrictions.size()) { case 0: return UNRESTRICTED; case 1: return restrictions.iterator().next(); default: return new CompositeRestriction(restrictions); } } }
@Override public boolean isSubsumedBy(Restriction other) { if (other instanceof CompositeRestriction) { return isSubsumedBy((CompositeRestriction) other); } for (Restriction r : restrictions) { if (!r.isSubsumedBy(other)) { return false; } } return true; }
private boolean isSubsumedBy(CompositeRestriction other) { for (Restriction r : restrictions) { if (!other.subsumes(r)) { return false; } } return true; }