java.util.TreeMap.lowerEntry()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中java.util.TreeMap.lowerEntry()方法的一些代码示例,展示了TreeMap.lowerEntry()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreeMap.lowerEntry()方法的具体详情如下:
包路径:java.util.TreeMap
类名称:TreeMap
方法名:lowerEntry

TreeMap.lowerEntry介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

private static <K, V> V mappedValue(TreeMap<K, V> map, K key) {
  Entry<K, V> e = map.floorEntry(key);
  if (e != null && e.getValue() == null) {
    e = map.lowerEntry(key);
  }
  return e == null ? null : e.getValue();
}

代码示例来源:origin: robolectric/robolectric

@Implementation
protected void restat(String path) {
 Map.Entry<String, Stats> mapEntry = stats.floorEntry(path);
 for (;;) {
  // We will hit all matching paths, longest one first. We may hit non-matching paths before we
  // find the right one.
  if (mapEntry == null) {
   stat = DEFAULT_STATS;
   return;
  }
  String key = mapEntry.getKey();
  if (path.startsWith(key)) {
   stat = mapEntry.getValue();
   return;
  }
  mapEntry = stats.lowerEntry(key);
 }
}

代码示例来源:origin: alibaba/jstorm

@Override
public void emitBatch(TransactionAttempt tx, Object coordinatorMeta, BatchOutputCollector collector) {
  Map<Integer, Object> metas = new HashMap<>();
  _cachedMetas.put(tx.getTransactionId(), metas);
  int partitions = _emitter.numPartitions();
  Entry<BigInteger, Map<Integer, Object>> entry = _cachedMetas.lowerEntry(tx.getTransactionId());
  Map<Integer, Object> prevCached;
  if (entry != null) {
    prevCached = entry.getValue();
  } else {
    prevCached = new HashMap<>();
  }
  for (int i = _index; i < partitions; i += _numTasks) {
    RotatingTransactionalState state = _partitionStates.get(i);
    if (state == null) {
      state = new RotatingTransactionalState(_state, "" + i);
      _partitionStates.put(i, state);
    }
    state.removeState(tx.getTransactionId());
    Object lastMeta = prevCached.get(i);
    if (lastMeta == null)
      lastMeta = state.getLastState();
    Object meta = _emitter.emitPartitionBatch(tx, collector, i, lastMeta);
    metas.put(i, meta);
  }
}

代码示例来源:origin: alibaba/jstorm

_cachedMetas.put(tx.getTransactionId(), metas);
Entry<Long, Map<String, Object>> entry = _cachedMetas.lowerEntry(tx.getTransactionId());
Map<String, Object> prevCached;
if(entry!=null) {

代码示例来源:origin: apache/storm

_cachedMetas.put(tx.getTransactionId(), metas);
Entry<Long, Map<String, Object>> entry = _cachedMetas.lowerEntry(tx.getTransactionId());
Map<String, Object> prevCached;
if (entry != null) {

代码示例来源:origin: jordw/heftydb

@Override
  protected Map.Entry nextEntry(Key key) {
    return tuples.lowerEntry(key);
  }
}

代码示例来源:origin: y20k/transistor

public MediaMetadataCompat getStationBefore(String stationId) {
  Map.Entry<String, MediaMetadataCompat> entry = mStationListById.lowerEntry(stationId);
  if (entry != null) {
    return entry.getValue();
  }
  return null;
}

代码示例来源:origin: openimaj/openimaj

private void addBefore(LinkedList<Long> timeList, LinkedList<DATA> dataList, long time, int nbefore) {
  Entry<Long, DATA> floorEntry = null;
  int seen = 0;
  long currentTime = time;
  while ((floorEntry = this.timeSeries.lowerEntry(currentTime)) != null) {
    currentTime = floorEntry.getKey();
    if (seen < nbefore) {
      dataList.addFirst(floorEntry.getValue());
      timeList.addFirst(currentTime);
      seen++;
    } else {
      break;
    }
  }// The entry was either null (didn't exist) or was beyond the threshold
  return;
}

代码示例来源:origin: openimaj/openimaj

private void addBefore(LinkedList<Long> timeList,LinkedList<DATA> dataList, long time, long threshbefore) {
  Entry<Long, DATA> floorEntry = null;
  long minTime = time - threshbefore;
  long currentTime = time;
  while ((floorEntry = this.timeSeries.lowerEntry(currentTime)) != null) {
    currentTime = floorEntry.getKey();
    if (currentTime >= minTime) {
      dataList.addFirst(floorEntry.getValue());
      timeList.addFirst(currentTime);
    } else {
      break;
    }
  }// The entry was either null (didn't exist) or was beyond the threshold
  return;
}

代码示例来源:origin: org.integratedmodelling/klab-engine

@Override
public T getPrior(ITimeInstant time) {
  Entry<ITimeInstant, WrappedObject> entry = collection.lowerEntry(time);
  if (entry == null) {
    return null;
  }
  if (entry.getValue().timePeriod.contains(time)) {
    entry = collection.lowerEntry(entry.getKey());
  }
  if (entry == null) {
    return null;
  }
  return entry.getValue().item;
}

代码示例来源:origin: MSGFPlus/msgfplus

public float getPepFDR(float score) {
  float fdr;
  if (isGreaterBetter)
    fdr = pepLevelFDRMap.lowerEntry(score).getValue();
  else
    fdr = pepLevelFDRMap.higherEntry(score).getValue();
  return fdr;
}

代码示例来源:origin: mayconbordin/streaminer

@Override
public Bin<T> lower(double p) {
 return binFromEntry(_bins.lowerEntry(p));
}

代码示例来源:origin: MSGFPlus/msgfplus

public float getPSMQValue(float score) {
  float fdr;
  if (isGreaterBetter)
    fdr = psmLevelFDRMap.lowerEntry(score).getValue();
  else
    fdr = psmLevelFDRMap.higherEntry(score).getValue();
  return fdr;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

private boolean isSameAsPrevious(Long key, Resource capacity) {
 Entry<Long, Resource> previous = cumulativeCapacity.lowerEntry(key);
 return (previous != null && previous.getValue().equals(capacity));
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

private boolean isSameAsPrevious(Long key, Resource capacity) {
 Entry<Long, Resource> previous = cumulativeCapacity.lowerEntry(key);
 return (previous != null && previous.getValue().equals(capacity));
}

代码示例来源:origin: org.integratedmodelling/klab-engine

private WrappedObject getWrappedObjectAtTime(ITimeInstant time) {
  Entry<ITimeInstant, WrappedObject> latestPriorEntry = collection.lowerEntry(time);
  if (latestPriorEntry == null) {
    // no intervals exist which start before the query time.
    return null;
  }
  WrappedObject latestPrior = latestPriorEntry.getValue();
  if (!latestPrior.timePeriod.contains(time)) {
    // the latest-starting interval prior to the query time expires before the query time,
    // so there is no matching interval for this query time.
    return null;
  }
  // the interval contains the time, so return the enclosed value.
  return latestPrior;
}

代码示例来源:origin: biojava/biojava

/**
 * @param chainId
 * @return The last {@link ResidueNumber} of the specified chain (the one farthest down in the PDB file)
 */
public ResidueNumber getLast(String chainId) {
  Map.Entry<ResidueNumber,Integer> entry = treeMap.lastEntry();
  while (true) {
    if (entry.getKey().getChainName().equals(chainId)) return entry.getKey();
    entry = treeMap.lowerEntry(entry.getKey());
    if (entry == null) return null;
  }
}

代码示例来源:origin: org.robolectric/shadows-framework

@Implementation
protected void restat(String path) {
 Map.Entry<String, Stats> mapEntry = stats.floorEntry(path);
 for (;;) {
  // We will hit all matching paths, longest one first. We may hit non-matching paths before we
  // find the right one.
  if (mapEntry == null) {
   stat = DEFAULT_STATS;
   return;
  }
  String key = mapEntry.getKey();
  if (path.startsWith(key)) {
   stat = mapEntry.getValue();
   return;
  }
  mapEntry = stats.lowerEntry(key);
 }
}

代码示例来源:origin: com.n3twork.storm/storm-core

@Override
public void emitBatch(TransactionAttempt tx, Object coordinatorMeta, BatchOutputCollector collector) {
  Map<Integer, Object> metas = new HashMap<Integer, Object>();
  _cachedMetas.put(tx.getTransactionId(), metas);
  int partitions = _emitter.numPartitions();
  Entry<BigInteger, Map<Integer, Object>> entry = _cachedMetas.lowerEntry(tx.getTransactionId());
  Map<Integer, Object> prevCached;
  if(entry!=null) {
    prevCached = entry.getValue();
  } else {
    prevCached = new HashMap<Integer, Object>();
  }
  
  for(int i=_index; i < partitions; i+=_numTasks) {
    RotatingTransactionalState state = _partitionStates.get(i);
    if(state==null) {
      state = new RotatingTransactionalState(_state, "" + i);
      _partitionStates.put(i, state);
    }
    state.removeState(tx.getTransactionId());
    Object lastMeta = prevCached.get(i);
    if(lastMeta==null) lastMeta = state.getLastState();
    Object meta = _emitter.emitPartitionBatch(tx, collector, i, lastMeta);
    metas.put(i, meta);
  }
}

代码示例来源:origin: org.apache.storm/storm-core

@Override
public void emitBatch(TransactionAttempt tx, Object coordinatorMeta, BatchOutputCollector collector) {
  Map<Integer, Object> metas = new HashMap<>();
  _cachedMetas.put(tx.getTransactionId(), metas);
  int partitions = _emitter.numPartitions();
  Entry<BigInteger, Map<Integer, Object>> entry = _cachedMetas.lowerEntry(tx.getTransactionId());
  Map<Integer, Object> prevCached;
  if(entry!=null) {
    prevCached = entry.getValue();
  } else {
    prevCached = new HashMap<>();
  }
  
  for(int i=_index; i < partitions; i+=_numTasks) {
    RotatingTransactionalState state = _partitionStates.get(i);
    if(state==null) {
      state = new RotatingTransactionalState(_state, "" + i);
      _partitionStates.put(i, state);
    }
    state.removeState(tx.getTransactionId());
    Object lastMeta = prevCached.get(i);
    if(lastMeta==null) lastMeta = state.getLastState();
    Object meta = _emitter.emitPartitionBatch(tx, collector, i, lastMeta);
    metas.put(i, meta);
  }
}

相关文章