@Test public void testNamed() { Permission p1, p2; p1 = new Permission("something"); p2 = new Permission("something"); assertTrue(p1.implies(p2)); assertTrue(p2.implies(p1)); p1 = new Permission("something"); p2 = new Permission("SOMETHING"); assertTrue(p1.implies(p2)); assertTrue(p2.implies(p1)); p1 = new Permission("something"); p2 = new Permission("else"); assertFalse(p1.implies(p2)); assertFalse(p2.implies(p1)); p1 = new Permission("BLAHBLAH", false); p2 = new Permission("BLAHBLAH", false); assertTrue(p1.implies(p2)); assertTrue(p2.implies(p1)); p1 = new Permission("BLAHBLAH", false); p2 = new Permission("bLAHBLAH", false); assertTrue(p1.implies(p2)); assertTrue(p2.implies(p1)); p1 = new Permission("BLAHBLAH", false); p2 = new Permission("whatwhat", false); assertFalse(p1.implies(p2)); assertFalse(p2.implies(p1)); }
public boolean implies(Permission p) { List<Set<String>> otherParts = p.getParts(); int i = 0; for (Set<String> otherPart : otherParts) { if (getParts().size() - 1 < i) { return true; } else { Set<String> part = getParts().get(i); if (!part.contains(WILDCARD_TOKEN) && !part.containsAll(otherPart)) { return false; } i++; } } for (; i < getParts().size(); i++) { Set<String> part = getParts().get(i); if (!part.contains(WILDCARD_TOKEN)) { return false; } } return true; }
Permission implements Serializable { public boolean implies(Permission p) { List<Set<String>> otherParts = p.getParts(); int i = 0; for (Set<String> otherPart : otherParts) { if (getParts().size() - 1 < i) { return true; } else { Set<String> part = getParts().get(i); if (!part.contains(WILDCARD_TOKEN) && !part.containsAll(otherPart)) { return false; } i++; } } for (; i < getParts().size(); i++) { Set<String> part = getParts().get(i); if (!part.contains(WILDCARD_TOKEN)) { return false; } } return true; } }
Permission implements Serializable { public boolean implies(Permission p) { List<Set<String>> otherParts = p.getParts(); int i = 0; for (Set<String> otherPart : otherParts) { if (getParts().size() - 1 < i) { return true; } else { Set<String> part = getParts().get(i); if (!part.contains(WILDCARD_TOKEN) && !part.containsAll(otherPart)) { return false; } i++; } } for (; i < getParts().size(); i++) { Set<String> part = getParts().get(i); if (!part.contains(WILDCARD_TOKEN)) { return false; } } return true; } protected  Permission();  Permission(String wildcardString);  Permission(String wildcardString, boolean caseSensitive); }
Permission implements Serializable { public boolean implies(Permission p) { List<Set<String>> otherParts = p.getParts(); int i = 0; for (Set<String> otherPart : otherParts) { if (getParts().size() - 1 < i) { return true; } else { Set<String> part = getParts().get(i); if (!part.contains(WILDCARD_TOKEN) && !part.containsAll(otherPart)) { return false; } i++; } } for (; i < getParts().size(); i++) { Set<String> part = getParts().get(i); if (!part.contains(WILDCARD_TOKEN)) { return false; } } return true; } protected  Permission();  Permission(String wildcardString);  Permission(String wildcardString, boolean caseSensitive); boolean implies(Permission p); @Override String toString(); boolean equals(Object o); int hashCode(); }
Permission implements Serializable { public boolean implies(Permission p) { List<Set<String>> otherParts = p.getParts(); int i = 0; for (Set<String> otherPart : otherParts) { if (getParts().size() - 1 < i) { return true; } else { Set<String> part = getParts().get(i); if (!part.contains(WILDCARD_TOKEN) && !part.containsAll(otherPart)) { return false; } i++; } } for (; i < getParts().size(); i++) { Set<String> part = getParts().get(i); if (!part.contains(WILDCARD_TOKEN)) { return false; } } return true; } protected  Permission();  Permission(String wildcardString);  Permission(String wildcardString, boolean caseSensitive); boolean implies(Permission p); @Override String toString(); boolean equals(Object o); int hashCode();  }