List of usage examples for java.util SortedMap entrySet
Set<Map.Entry<K, V>> entrySet();
From source file:org.apache.falcon.unit.LocalExtensionManager.java
APIResult deleteExtensionJob(String jobName) throws FalconException, IOException { ExtensionMetaStore metaStore = ExtensionStore.getMetaStore(); ExtensionJobsBean extensionJobsBean = metaStore.getExtensionJobDetails(jobName); SortedMap<EntityType, List<String>> entityMap = getJobEntities(extensionJobsBean); for (Map.Entry<EntityType, List<String>> entry : entityMap.entrySet()) { for (String entityName : entry.getValue()) { delete(entry.getKey().name(), entityName, null); }/*from w w w .j ava 2 s .co m*/ } ExtensionStore.getMetaStore().deleteExtensionJob(jobName); return new APIResult(APIResult.Status.SUCCEEDED, "Extension job " + jobName + " deleted successfully"); }
From source file:org.apache.falcon.unit.LocalExtensionManager.java
APIResult scheduleExtensionJob(String jobName, String coloExpr, String doAsUser) throws FalconException, IOException { checkIfExtensionIsEnabled(ExtensionStore.getMetaStore().getExtensionJobDetails(jobName).getExtensionName()); ExtensionMetaStore metaStore = ExtensionStore.getMetaStore(); ExtensionJobsBean extensionJobsBean = metaStore.getExtensionJobDetails(jobName); SortedMap<EntityType, List<String>> entityMap = getJobEntities(extensionJobsBean); for (Map.Entry<EntityType, List<String>> entry : entityMap.entrySet()) { for (String entityName : entry.getValue()) { scheduleInternal(entry.getKey().name(), entityName, true, null); }/* w w w . j a va 2 s . co m*/ } return new APIResult(APIResult.Status.SUCCEEDED, "Extension job " + jobName + " scheduled successfully"); }
From source file:org.sonar.test.i18n.BundleSynchronizedMatcher.java
private void print(String title, SortedMap<String, String> translations, StringBuilder to) { if (!translations.isEmpty()) { to.append(title);//from w w w .ja va 2 s . c o m for (Map.Entry<String, String> entry : translations.entrySet()) { to.append("\n").append(entry.getKey()).append("=").append(entry.getValue()); } } }
From source file:ratpack.codahale.metrics.internal.WebSocketReporter.java
private void writeTimers(JsonGenerator json, SortedMap<String, Timer> timers) throws IOException { json.writeArrayFieldStart("timers"); for (Map.Entry<String, Timer> entry : timers.entrySet()) { Timer timer = entry.getValue(); json.writeStartObject();// ww w.j av a 2s .c o m json.writeStringField("name", entry.getKey()); json.writeNumberField("count", timer.getCount()); json.writeNumberField("meanRate", convertRate(timer.getMeanRate())); json.writeNumberField("oneMinuteRate", convertRate(timer.getOneMinuteRate())); json.writeNumberField("fiveMinuteRate", convertRate(timer.getFiveMinuteRate())); json.writeNumberField("fifteenMinuteRate", convertRate(timer.getFifteenMinuteRate())); Snapshot snapshot = timer.getSnapshot(); json.writeNumberField("min", convertDuration(snapshot.getMin())); json.writeNumberField("max", convertDuration(snapshot.getMax())); json.writeNumberField("mean", convertDuration(snapshot.getMean())); json.writeNumberField("stdDev", convertDuration(snapshot.getStdDev())); json.writeNumberField("50thPercentile", convertDuration(snapshot.getMedian())); json.writeNumberField("75thPercentile", convertDuration(snapshot.get75thPercentile())); json.writeNumberField("95thPercentile", convertDuration(snapshot.get95thPercentile())); json.writeNumberField("98thPercentile", convertDuration(snapshot.get98thPercentile())); json.writeNumberField("99thPercentile", convertDuration(snapshot.get99thPercentile())); json.writeNumberField("999thPercentile", convertDuration(snapshot.get999thPercentile())); json.writeEndObject(); } json.writeEndArray(); }
From source file:org.apache.falcon.unit.LocalExtensionManager.java
APIResult suspendExtensionJob(String jobName, String coloExpr, String doAsUser) throws FalconException { ExtensionMetaStore metaStore = ExtensionStore.getMetaStore(); ExtensionJobsBean extensionJobsBean = metaStore.getExtensionJobDetails(jobName); SortedMap<EntityType, List<String>> entityMap = getJobEntities(extensionJobsBean); for (Map.Entry<EntityType, List<String>> entityTypeEntry : entityMap.entrySet()) { for (String entityName : entityTypeEntry.getValue()) { super.suspend(null, entityTypeEntry.getKey().name(), entityName, coloExpr); }/* ww w.j a va 2 s .co m*/ } return new APIResult(APIResult.Status.SUCCEEDED, "Extension job " + jobName + " suspended successfully"); }
From source file:org.apache.falcon.unit.LocalExtensionManager.java
APIResult resumeExtensionJob(String jobName, String coloExpr, String doAsUser) throws FalconException { ExtensionMetaStore metaStore = ExtensionStore.getMetaStore(); ExtensionJobsBean extensionJobsBean = metaStore.getExtensionJobDetails(jobName); SortedMap<EntityType, List<String>> entityMap = getJobEntities(extensionJobsBean); for (Map.Entry<EntityType, List<String>> entityTypeEntry : entityMap.entrySet()) { for (String entityName : entityTypeEntry.getValue()) { super.resume(null, entityTypeEntry.getKey().name(), entityName, coloExpr); }/*from w w w .j a v a2 s . com*/ } return new APIResult(APIResult.Status.SUCCEEDED, "Extension job " + jobName + " suspended successfully"); }
From source file:org.kalypso.optimize.SceIOHandler.java
public SceIOHandler(final Logger logger, final AutoCalibration calibration, final IOptimizingJob job) throws SimulationException { try {//ww w .jav a 2 s.com m_logger = logger; final SortedMap<Date, Double> measuredTS = job.getMeasuredTimeSeries(); if (CollectionUtils.isEmpty(measuredTS.entrySet())) { // FIXME: what to do: we cannot optimize // Should return with one normal calculation } m_errorFunction = ErrorFunctionFactory.createErrorFunction(measuredTS, calibration); final List<Parameter> parameterList = calibration.getParameterlist().getParameter(); m_parameterConf = parameterList.toArray(new Parameter[parameterList.size()]); m_job = job; } catch (final Exception e) { e.printStackTrace(); throw new SimulationException("Fehler beim Initialisieren der Optimierung", e); } }
From source file:org.apache.hadoop.hbase.security.visibility.VisibilityNewVersionBehaivorTracker.java
@Override public DeleteResult isDeleted(Cell cell) { try {/* w w w . j ava 2s . co m*/ long duplicateMvcc = prepare(cell); for (Map.Entry<Long, DeleteVersionsNode> e : delColMap.tailMap(cell.getSequenceId()).entrySet()) { VisibilityDeleteVersionsNode node = (VisibilityDeleteVersionsNode) e.getValue(); long deleteMvcc = Long.MAX_VALUE; SortedMap<Long, TagInfo> deleteVersionMvccs = node.deletesMap.get(cell.getTimestamp()); if (deleteVersionMvccs != null) { SortedMap<Long, TagInfo> tail = deleteVersionMvccs.tailMap(cell.getSequenceId()); for (Map.Entry<Long, TagInfo> entry : tail.entrySet()) { if (tagMatched(cell, entry.getValue())) { deleteMvcc = tail.firstKey(); break; } } } SortedMap<Long, SortedSet<Long>> subMap = node.mvccCountingMap.subMap(cell.getSequenceId(), true, Math.min(duplicateMvcc, deleteMvcc), true); for (Map.Entry<Long, SortedSet<Long>> seg : subMap.entrySet()) { if (seg.getValue().size() >= maxVersions) { return DeleteResult.VERSION_MASKED; } seg.getValue().add(cell.getSequenceId()); } if (deleteMvcc < Long.MAX_VALUE) { return DeleteResult.VERSION_DELETED; } if (cell.getTimestamp() <= node.ts && tagMatched(cell, node.tagInfo)) { return DeleteResult.COLUMN_DELETED; } } if (duplicateMvcc < Long.MAX_VALUE) { return DeleteResult.VERSION_MASKED; } } catch (IOException e) { LOG.error("Error in isDeleted() check! Will treat cell as not deleted", e); } return DeleteResult.NOT_DELETED; }
From source file:org.jactr.core.module.declarative.four.associative.ProceduralModuleListener.java
public void updateStatistics(SortedMap<String, IChunk> matchedChunks) { FastList<ISlot> slots = FastList.newInstance(); for (Map.Entry<String, IChunk> matchedEntry : matchedChunks.entrySet()) { IChunk matchedChunk = matchedEntry.getValue(); /*/*ww w .ja v a 2 s .c o m*/ * all chunks that were matched were needed.. */ ISubsymbolicChunk4 sscMatched = matchedChunk.getAdapter(ISubsymbolicChunk4.class); sscMatched.incrementTimesNeeded(1); /** * and in 4.0 the goal defines the context */ if (matchedEntry.getKey().equalsIgnoreCase(BOUND_GOAL)) { /* * the contents of the chunk define the context. Ideally we'd only use * those slots that were matched in the production. but for now, we'll * use everybody */ slots.clear(); for (ISlot slot : matchedChunk.getSymbolicChunk().getSlots(slots)) if (slot.getValue() instanceof IChunk) { IChunk jChunk = (IChunk) slot.getValue(); ISubsymbolicChunk4 sscJ = jChunk.getAdapter(ISubsymbolicChunk4.class); sscJ.incrementTimesInContext(1); /* * if J is in the context and there is a link between J and another * matched Chunk (i), then we need to strengthen that association * directly. */ for (Map.Entry<String, IChunk> iEntry : matchedChunks.tailMap(matchedEntry.getKey()) .entrySet()) { IChunk iChunk = iEntry.getValue(); // skip ourselves if (iChunk.equals(matchedChunk)) continue; // Link4 link = (Link4) sscJ.getIAssociation(iChunk); Link4 link = (Link4) ChunkListener.getAssociativeLink(jChunk, iChunk, true); /* * the link exists. It might not.. should we create one here? */ if (link != null) { if (LOGGER.isDebugEnabled()) LOGGER.debug(String.format("Incrementing F(Ni|Cj) for %s", link)); link.incrementFNICJ(); } } } } } FastList.recycle(slots); }
From source file:ratpack.codahale.metrics.internal.WebSocketReporter.java
private void writeHistograms(JsonGenerator json, SortedMap<String, Histogram> histograms) throws IOException { json.writeArrayFieldStart("histograms"); for (Map.Entry<String, Histogram> entry : histograms.entrySet()) { Histogram histogram = entry.getValue(); json.writeStartObject();// ww w . ja va 2s. c om json.writeStringField("name", entry.getKey()); json.writeNumberField("count", histogram.getCount()); Snapshot snapshot = histogram.getSnapshot(); json.writeNumberField("min", convertDuration(snapshot.getMin())); json.writeNumberField("max", convertDuration(snapshot.getMax())); json.writeNumberField("mean", convertDuration(snapshot.getMean())); json.writeNumberField("stdDev", convertDuration(snapshot.getStdDev())); json.writeNumberField("50thPercentile", convertDuration(snapshot.getMedian())); json.writeNumberField("75thPercentile", convertDuration(snapshot.get75thPercentile())); json.writeNumberField("95thPercentile", convertDuration(snapshot.get95thPercentile())); json.writeNumberField("98thPercentile", convertDuration(snapshot.get98thPercentile())); json.writeNumberField("99thPercentile", convertDuration(snapshot.get99thPercentile())); json.writeNumberField("999thPercentile", convertDuration(snapshot.get999thPercentile())); json.writeEndObject(); } json.writeEndArray(); }