public boolean hasFlag( String flag ) { return flags.contains( flag ); }
@Override public boolean covers(TrackingToken other) { Assert.isTrue(other instanceof GapAwareTrackingToken, () -> "Incompatible token type provided."); GapAwareTrackingToken otherToken = (GapAwareTrackingToken) other; return otherToken.index <= this.index && !this.gaps.contains(otherToken.index) && otherToken.gaps.containsAll(this.gaps.headSet(otherToken.index)); }
public boolean passwordChangeRequired() { return flags.contains( PASSWORD_CHANGE_REQUIRED ); }
/** * @param hostPort hostPort of the server * @return true, if a server with hostPort is found */ public boolean containsServer(Address hostPort) { return servers.contains(hostPort); }
@Override public boolean contains(Object o) { return this.delegate.contains(o); }
public boolean containsTable(TableName table) { return tables.contains(table); }
private long calculateIndex(GapAwareTrackingToken otherToken, SortedSet<Long> mergedGaps) { long mergedIndex = Math.min(this.index, otherToken.index); while (mergedGaps.contains(mergedIndex)) { mergedIndex--; } return mergedIndex; }
public int indexOf(Object object) { if (this.delegate.contains(object)) { return this.delegate.headSet((T) object).size(); } return -1; }
public SortedSet<String> getGroupNamesForRole(GeoServerRole role) throws IOException { SortedSet<String> result = new TreeSet<String>(); for (Entry<String, SortedSet<GeoServerRole>> entry : group_roleMap.entrySet()) { if (entry.getValue().contains(role)) result.add(entry.getKey()); } return Collections.unmodifiableSortedSet(result); }
public void associateRoleToGroup(GeoServerRole role, String groupname) throws IOException { SortedSet<GeoServerRole> roles = helper.group_roleMap.get(groupname); if (roles == null) { roles = new TreeSet<GeoServerRole>(); helper.group_roleMap.put(groupname, roles); } if (roles.contains(role) == false) { // something changed ? roles.add(role); setModified(true); } }
public void associateRoleToUser(GeoServerRole role, String username) throws IOException { SortedSet<GeoServerRole> roles = helper.user_roleMap.get(username); if (roles == null) { roles = new TreeSet<GeoServerRole>(); helper.user_roleMap.put(username, roles); } if (roles.contains(role) == false) { // something changed roles.add(role); setModified(true); } }
public void disAssociateRoleFromUser(GeoServerRole role, String username) throws IOException { SortedSet<GeoServerRole> roles = helper.user_roleMap.get(username); if (roles != null && roles.contains(role)) { roles.remove(role); setModified(true); } }
public void disAssociateRoleFromGroup(GeoServerRole role, String groupname) throws IOException { SortedSet<GeoServerRole> roles = helper.group_roleMap.get(groupname); if (roles != null && roles.contains(role)) { roles.remove(role); setModified(true); } }
public synchronized boolean jobNamesContains(TopLevelItem item) { if (item == null) return false; return jobNames.contains(item.getRelativeNameFrom(getOwner().getItemGroup())); }
public void testExplicit_contains() { SortedSet<String> set = ImmutableSortedSet.orderedBy(STRING_LENGTH) .add("in", "the", "quick", "jumped", "over", "a") .build(); assertTrue(set.contains("quick")); assertTrue(set.contains("google")); assertFalse(set.contains("")); assertFalse(set.contains("california")); assertFalse(set.contains(null)); }
public void testIllegalAdd() { SortedSet set = makeTestSet(); String testString = "B"; try { set.add(testString); fail("Should fail string predicate."); } catch (IllegalArgumentException e) { // expected } assertTrue("Collection shouldn't contain illegal element", !set.contains(testString)); }
@SuppressWarnings("CollectionIncompatibleType") // testing incompatible types public void testExplicit_containsMismatchedTypes() { SortedSet<String> set = ImmutableSortedSet.orderedBy(STRING_LENGTH) .add("in", "the", "quick", "jumped", "over", "a") .build(); assertFalse(set.contains(3.7)); }
@Test public void setCollectionPropertyWithStringValueAndCustomEditor() { IndexedTestBean target = new IndexedTestBean(); AbstractPropertyAccessor accessor = createAccessor(target); accessor.registerCustomEditor(String.class, "set", new StringTrimmerEditor(false)); accessor.registerCustomEditor(String.class, "list", new StringTrimmerEditor(false)); accessor.setPropertyValue("set", "set1 "); accessor.setPropertyValue("sortedSet", "sortedSet1"); accessor.setPropertyValue("list", "list1 "); assertEquals(1, target.getSet().size()); assertTrue(target.getSet().contains("set1")); assertEquals(1, target.getSortedSet().size()); assertTrue(target.getSortedSet().contains("sortedSet1")); assertEquals(1, target.getList().size()); assertTrue(target.getList().contains("list1")); accessor.setPropertyValue("list", Collections.singletonList("list1 ")); assertTrue(target.getList().contains("list1")); }
/** * Test of getFiles method, of class HistoryEntry. */ @Test public void getFiles() { String fileName = "test.file"; instance.addFile(fileName); assertTrue(instance.getFiles().contains(fileName)); assertEquals(1, instance.getFiles().size()); instance.addFile("other.file"); assertEquals(2, instance.getFiles().size()); }
/** * Test of addFile method, of class HistoryEntry. */ @Test public void addFile() { String fileName = "test.file"; HistoryEntry instance = new HistoryEntry(); assertFalse( new History(Collections.singletonList(instance)).hasFileList()); instance.addFile(fileName); assertTrue(instance.getFiles().contains(fileName)); assertTrue( new History(Collections.singletonList(instance)).hasFileList()); }