List of usage examples for java.util SortedSet isEmpty
boolean isEmpty();
From source file:org.dbmaintain.script.executedscriptinfo.impl.DefaultExecutedScriptInfoSourceMarkErrorScriptsAsSuccessfulTest.java
@Test public void noScripts() throws Exception { SortedSet<ExecutedScript> before = executedScriptInfoSource.getExecutedScripts(); assertTrue(before.isEmpty()); executedScriptInfoSource.markErrorScriptsAsSuccessful(); SortedSet<ExecutedScript> after = executedScriptInfoSource.getExecutedScripts(); assertTrue(after.isEmpty());//ww w. jav a 2 s .c o m }
From source file:org.dbmaintain.script.executedscriptinfo.impl.DefaultExecutedScriptInfoSourceRemoveErrorScriptsTest.java
@Test public void failedScripts() throws Exception { registerFailedScripts();/*from w w w . ja v a 2 s .co m*/ SortedSet<ExecutedScript> before = executedScriptInfoSource.getExecutedScripts(); assertPropertyLenientEquals("successful", asList(false, false, false), before); executedScriptInfoSource.removeErrorScripts(); SortedSet<ExecutedScript> after = executedScriptInfoSource.getExecutedScripts(); assertTrue(after.isEmpty()); }
From source file:org.dbmaintain.script.executedscriptinfo.impl.DefaultExecutedScriptInfoSourceRemoveErrorScriptsTest.java
@Test public void noScripts() throws Exception { SortedSet<ExecutedScript> before = executedScriptInfoSource.getExecutedScripts(); assertTrue(before.isEmpty()); executedScriptInfoSource.removeErrorScripts(); SortedSet<ExecutedScript> after = executedScriptInfoSource.getExecutedScripts(); assertTrue(after.isEmpty());/*from w w w . j av a 2s .c o m*/ }
From source file:org.cloudata.core.parallel.hadoop.KeyRangePartitioner.java
@Override public int getPartition(WritableComparable key, Writable value, int numPartitions) { if (confException != null) { LOG.error(confException.getMessage(), confException); return -1; }/*from w ww . j a v a2 s . c om*/ if (tabletInfoSet.isEmpty()) { LOG.error("tablet partition size is zero"); return -1; } int partitionNumber = 0; Row.Key rowKey = new Row.Key(key.toString()); SortedSet<RowKeyItem> tailSet = tabletInfoSet.tailSet(new RowKeyItem(rowKey, 0)); if (!tailSet.isEmpty()) { partitionNumber = tailSet.first().index; } else { partitionNumber = tabletInfoSet.last().index; } if (partitionNumber >= numPartitions) { LOG.info("Partition Number is : " + partitionNumber + ", numPartitions : " + numPartitions + ", Row.Key : " + key.toString()); partitionNumber = numPartitions - 1; } count++; return partitionNumber; }
From source file:org.jahia.services.render.filter.cache.PrincipalAcl.java
private void fillValidRoles(String nodePath, Map<String, SortedSet<String>> roles, Set<String> validRoles) { for (Map.Entry<String, SortedSet<String>> entry : roles.entrySet()) { if (entry.getValue() == null) { // No path denied validRoles.add(entry.getKey()); } else if (entry.getValue().contains(nodePath)) { // Current node path is explicitely denied } else {/* w ww.j a va 2 s . co m*/ // Look for a possible denied parent path SortedSet<String> s = entry.getValue().headSet(nodePath); if (s.isEmpty() || !nodePath.startsWith(s.last())) { validRoles.add(entry.getKey()); } } } }
From source file:org.trellisldp.file.FileMementoService.java
@Override public CompletionStage<Resource> get(final IRI identifier, final Instant time) { return supplyAsync(() -> { final Instant mementoTime = time.truncatedTo(SECONDS); final File resourceDir = FileUtils.getResourceDirectory(directory, identifier); final File file = FileUtils.getNquadsFile(resourceDir, mementoTime); if (file.exists()) { return new FileResource(identifier, file); }/*w w w . j a va2 s .c om*/ final SortedSet<Instant> possible = listMementos(identifier).headSet(mementoTime); if (possible.isEmpty()) { return MISSING_RESOURCE; } return new FileResource(identifier, FileUtils.getNquadsFile(resourceDir, possible.last())); }); }
From source file:net.sourceforge.fenixedu.presentationTier.docs.academicAdministrativeOffice.ApprovementInfoForEquivalenceProcess.java
static private void reportCycles(final StringBuilder result, final SortedSet<ICurriculumEntry> entries, final Map<Unit, String> academicUnitIdentifiers, final Registration registration) { final Collection<CycleCurriculumGroup> cycles = new TreeSet<CycleCurriculumGroup>( CycleCurriculumGroup.COMPARATOR_BY_CYCLE_TYPE_AND_ID); cycles.addAll(registration.getLastStudentCurricularPlan().getInternalCycleCurriculumGrops()); CycleCurriculumGroup lastReported = null; for (final CycleCurriculumGroup cycle : cycles) { if (!cycle.isConclusionProcessed() || isDEARegistration(registration)) { // final ApprovementCertificateRequest request = // ((ApprovementCertificateRequest) getDocumentRequest()); final Curriculum curriculum = cycle.getCurriculum(); filterEntries(entries, curriculum); if (!entries.isEmpty()) { if (lastReported == null) { lastReported = cycle; } else { result.append(LINE_BREAK); }/*from w w w . jav a2 s . c o m*/ result.append(getMLSTextContent(cycle.getName())).append(":").append(LINE_BREAK); reportEntries(result, entries, academicUnitIdentifiers, registration); } entries.clear(); } } }
From source file:org.jitsi.videobridge.simulcast.messages.SimulcastMessagesMapper.java
public String toJson(SortedSet<SimulcastStream> simulcastStreams) { if (simulcastStreams == null || simulcastStreams.isEmpty()) { return ""; }//from w ww . jav a2s . co m StringBuilder b = new StringBuilder("["); for (SimulcastStream simulcastStream : simulcastStreams) { toJson(b, simulcastStream); } b.append("]"); return b.toString(); }
From source file:io.wcm.devops.conga.tooling.maven.plugin.DefinitionValidateMojo.java
private void validateFiles(ResourceCollection sourceDir, ResourceCollection rootSourceDir, DefinitionValidator validator) throws MojoFailureException { if (!sourceDir.exists()) { return;//from w ww .ja v a 2s . c om } SortedSet<Resource> files = sourceDir.getResources(); SortedSet<ResourceCollection> dirs = sourceDir.getResourceCollections(); if (files.isEmpty() && dirs.isEmpty()) { return; } for (Resource file : files) { validator.validate(file, getPathForLog(rootSourceDir, file)); } for (ResourceCollection dir : dirs) { validateFiles(dir, rootSourceDir, validator); } }
From source file:org.eel.kitchen.jsonschema.keyword.DependenciesKeywordValidator.java
private void computeSimpleDep(final String field, final Set<String> fields, final ValidationReport report) { final Set<String> expected = simple.get(field); final SortedSet<String> missing = Sets.newTreeSet(expected); missing.removeAll(fields);/*from ww w.j a v a2 s . c om*/ if (missing.isEmpty()) return; final Message.Builder msg = newMsg().setMessage("missing property dependencies").addInfo("property", field) .addInfo("missing", missing).addInfo("expected", Sets.newTreeSet(expected)); report.addMessage(msg.build()); }