本文整理了Java中java.util.TreeMap.higherKey()
方法的一些代码示例,展示了TreeMap.higherKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreeMap.higherKey()
方法的具体详情如下:
包路径:java.util.TreeMap
类名称:TreeMap
方法名:higherKey
暂无
代码示例来源:origin: stanfordnlp/CoreNLP
int getSeparatorCount(Tree right, Tree left) {
if (right == null || left == null) {
return 0;
}
int leftHead = ShiftReduceUtils.headIndex(left);
int rightHead = ShiftReduceUtils.headIndex(right);
Integer nextSeparator = separators.higherKey(leftHead);
int count = 0;
while (nextSeparator != null && nextSeparator < rightHead) {
++count;
nextSeparator = separators.higherKey(nextSeparator);
}
return count;
}
代码示例来源:origin: stackoverflow.com
TreeMap<Integer,String> map = new TreeMap<Integer,String>();
map.put(33, "Three");
map.put(44, "Four");
map.put(11, "One");
map.put(22, "Two");
int thirdKey = map.higherKey(map.higherKey(map.firstKey()));
System.out.println(thirdKey); // prints "33"
代码示例来源:origin: worstcase/gumshoe
public Long getPositionAtOrAfter(Long position) {
if(timeByPosition.isEmpty()) { return null; }
if(position==null) {
return timeByPosition.firstKey();
}
if(timeByPosition.containsKey(position)) {
return position;
}
return timeByPosition.higherKey(position);
}
}
代码示例来源:origin: testwhat/SmaliEx
private String formatAnnotation(int offset, String annotationMsg) {
Integer endOffset = annotatations.higherKey(offset);
return formatAnnotation(offset, endOffset, annotationMsg);
}
代码示例来源:origin: org.smali/dexlib2
private String formatAnnotation(int offset, String annotationMsg) {
Integer endOffset = annotatations.higherKey(offset);
return formatAnnotation(offset, endOffset, annotationMsg);
}
代码示例来源:origin: edu.stanford.nlp/stanford-parser
int getSeparatorCount(Tree right, Tree left) {
if (right == null || left == null) {
return 0;
}
int leftHead = ShiftReduceUtils.headIndex(left);
int rightHead = ShiftReduceUtils.headIndex(right);
Integer nextSeparator = separators.higherKey(leftHead);
int count = 0;
while (nextSeparator != null && nextSeparator < rightHead) {
++count;
nextSeparator = separators.higherKey(nextSeparator);
}
return count;
}
代码示例来源:origin: CvvT/AppTroy
private String formatAnnotation(int offset, String annotationMsg) {
Integer endOffset = annotatations.higherKey(offset);
return formatAnnotation(offset, endOffset, annotationMsg);
}
代码示例来源:origin: edu.stanford.nlp/stanford-corenlp
int getSeparatorCount(Tree right, Tree left) {
if (right == null || left == null) {
return 0;
}
int leftHead = ShiftReduceUtils.headIndex(left);
int rightHead = ShiftReduceUtils.headIndex(right);
Integer nextSeparator = separators.higherKey(leftHead);
int count = 0;
while (nextSeparator != null && nextSeparator < rightHead) {
++count;
nextSeparator = separators.higherKey(nextSeparator);
}
return count;
}
代码示例来源:origin: KB5201314/ZjDroid
private String formatAnnotation(int offset, String annotationMsg) {
Integer endOffset = annotatations.higherKey(offset);
return formatAnnotation(offset, endOffset, annotationMsg);
}
代码示例来源:origin: com.guokr/stan-cn-com
int getSeparatorCount(Tree right, Tree left) {
if (right == null || left == null) {
return 0;
}
int leftHead = ShiftReduceUtils.headIndex(left);
int rightHead = ShiftReduceUtils.headIndex(right);
Integer nextSeparator = separators.higherKey(leftHead);
int count = 0;
while (nextSeparator != null && nextSeparator < rightHead) {
++count;
nextSeparator = separators.higherKey(nextSeparator);
}
return count;
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) throws Exception {
int arrayOne[] = {1, 50, 100, 50, 100, 22, 23, 26};
int arrayTwo[] = {1, 45, 22, 23, 52, 90, 100, 99};
TreeMap<Integer, Integer> map = new TreeMap<Integer, Integer>();
for (int i = 0; i < arrayTwo.length; i++)
if (!map.containsKey(arrayTwo[i])) // if you want it to choose the first
map.put(arrayTwo[i], i);
int arrayThree[] = new int[arrayOne.length];
for (int i = 0; i < arrayThree.length; i++) {
int v = arrayOne[i];
Integer h = map.higherKey(v - 1);
Integer l = map.lowerKey(v);
arrayThree[i] = map.get(l !=null && (h ==null || v - l < h - v) ? l : h);
}
System.out.println(Arrays.toString(arrayThree));
}
代码示例来源:origin: fenix-framework/fenix-framework
private TreeMap<Comparable, AbstractNode> justInsert(Comparable middleKey, AbstractNode subLeftNode, AbstractNode subRightNode) {
TreeMap<Comparable, AbstractNode> newMap = duplicateMap();
// find smallest key greater than middleKey
Comparable keyJustAfterMiddleKey = newMap.higherKey(middleKey);
newMap.put(keyJustAfterMiddleKey, subRightNode); // this replaces the previous mapping
newMap.put(middleKey, subLeftNode); // this adds the new split
setSubNodes(newMap);
return newMap;
}
代码示例来源:origin: org.neo4j/neo4j-causal-clustering
ValueRange<K,V> lookup( K at )
{
if ( endKey != null && endKey.compareTo( at ) <= 0 )
{
return new ValueRange<>( null, endValue );
}
Map.Entry<K,V> entry = tree.floorEntry( at );
return new ValueRange<>( tree.higherKey( at ), entry != null ? entry.getValue() : null );
}
代码示例来源:origin: org.neo4j/neo4j-core-edge
ValueRange<K,V> lookup( K at )
{
if ( endKey != null && endKey.compareTo( at ) <= 0 )
{
return new ValueRange<>( null, endValue );
}
Map.Entry<K,V> entry = tree.floorEntry( at );
return new ValueRange<>( tree.higherKey( at ), entry != null ? entry.getValue() : null );
}
代码示例来源:origin: MSGFPlus/msgfplus
public String getMatchingEntry(String name) {
String key = this.header2ends.ceilingKey(name);
if (key == null || !key.startsWith(name)) return null;
int position = this.header2ends.get(key) - 1;
Integer start = annotations.floorKey(position); // always "_" at start
Integer end = annotations.higherKey(position); // exclusive
if (start == null) start = 0;
if (end == null) end = (int) this.getSize();
while (!isValid(end - 1)) end--; // ensure that the last character is valid (exclusive)
return this.getSubsequence(start + 1, end);
}
代码示例来源:origin: MSGFPlus/msgfplus
public String getMatchingEntry(long position) {
Integer start = annotations.floorKey((int) position); // always "_" at start
Integer end = annotations.higherKey((int) position); // exclusive
if (start == null) start = 0;
if (end == null) end = (int) this.getSize();
while (!isValid(end - 1)) end--; // ensure that the last character is valid (exclusive)
return this.getSubsequence(start + 1, end);
}
代码示例来源:origin: MSGFPlus/msgfplus
public String getMatchingEntry(long position) {
Integer start = annotations.floorKey((int) position); // always "_" at start
Integer end = annotations.higherKey((int) position); // exclusive
if (start == null) start = 0;
if (end == null) end = (int) this.getSize();
while (!isValid(end - 1)) end--; // ensure that the last character is valid (exclusive)
return this.getSubsequence(start + 1, end);
}
代码示例来源:origin: MSGFPlus/msgfplus
public List<Pair<Integer, Float>> getXIC(int scanNum, float mz, Tolerance tol) {
ArrayList<Pair<Integer, Float>> xic = new ArrayList<Pair<Integer, Float>>();
Peak p;
// Move down
Integer curScanNum = scanNum;
while (curScanNum != null && scanNum > 0) {
curScanNum = ms1SpecMap.lowerKey(curScanNum);
if ((p = getMS1Peak(curScanNum, mz, tol)) != null)
xic.add(new Pair<Integer, Float>(curScanNum, p.getIntensity()));
else
break;
}
// Move up
curScanNum = scanNum;
while (curScanNum != null && curScanNum < 100000) {
curScanNum = ms1SpecMap.higherKey(curScanNum);
if ((p = getMS1Peak(curScanNum, mz, tol)) != null)
xic.add(new Pair<Integer, Float>(curScanNum, p.getIntensity()));
else
break;
}
Collections.sort(xic, new Pair.PairComparator<Integer, Float>());
return xic;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
curr = null;
} else {
curr = (CodepointMatchKey) index.higherKey(curr);
代码示例来源:origin: net.sf.saxon/Saxon-HE
curr = null;
} else {
curr = (CodepointMatchKey) index.higherKey(curr);
内容来源于网络,如有侵权,请联系作者删除!