/** * Compose multiple restrictions where each Restriction can veto an * operation. */ public static Restriction concat(Restriction... restrictions) { switch (restrictions.length) { case 0: return UNRESTRICTED; case 1: return restrictions[0]; case 2: if (restrictions [0].isSubsumedBy(restrictions [1])) { return restrictions [1]; } if (restrictions [1].isSubsumedBy(restrictions [0])) { return restrictions [0]; } // Fall through for default behaviour default: return concat(asList(restrictions)); } }