@Test public void testLists() { Permission p1, p2, p3; p1 = new Permission("one,two"); p2 = new Permission("one"); assertTrue(p1.implies(p2)); assertFalse(p2.implies(p1)); p1 = new Permission("one,two,three"); p2 = new Permission("one,three"); assertTrue(p1.implies(p2)); assertFalse(p2.implies(p1)); p1 = new Permission("one,two:one,two,three"); p2 = new Permission("one:three"); p3 = new Permission("one:two,three"); assertTrue(p1.implies(p2)); assertFalse(p2.implies(p1)); assertTrue(p1.implies(p3)); assertFalse(p2.implies(p3)); assertTrue(p3.implies(p2)); p1 = new Permission("one,two,three:one,two,three:one,two"); p2 = new Permission("one:three:two"); assertTrue(p1.implies(p2)); assertFalse(p2.implies(p1)); p1 = new Permission("one"); p2 = new Permission("one:two,three,four"); p3 = new Permission("one:two,three,four:five:six:seven"); assertTrue(p1.implies(p2)); assertTrue(p1.implies(p3)); assertFalse(p2.implies(p1)); assertFalse(p3.implies(p1)); assertTrue(p2.implies(p3)); }
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();  }