本文整理了Java中java.util.TreeSet.ceiling()
方法的一些代码示例,展示了TreeSet.ceiling()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TreeSet.ceiling()
方法的具体详情如下:
包路径:java.util.TreeSet
类名称:TreeSet
方法名:ceiling
暂无
代码示例来源:origin: kevin-wayne/algs4
/**
* Returns the smallest key in this set greater than or equal to {@code key}.
*
* @param key the key
* @return the smallest key in this set greater than or equal to {@code key}
* @throws IllegalArgumentException if {@code key} is {@code null}
* @throws NoSuchElementException if there is no such key
*/
public Key ceiling(Key key) {
if (key == null) throw new IllegalArgumentException("called ceiling() with a null key");
Key k = set.ceiling(key);
if (k == null) throw new NoSuchElementException("all keys are less than " + key);
return k;
}
代码示例来源:origin: atomix/atomix
@Override
public E ceiling(E e) {
return set().ceiling(e);
}
代码示例来源:origin: oracle/opengrok
@Override
public void processStream(InputStream input) throws IOException {
try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) {
String line;
while ((line = in.readLine()) != null) {
String parts[] = line.split(" *");
if (parts.length < 2) {
throw new IOException("Tag line contains more than 2 columns: " + line);
}
// Grrr, how to parse tags with spaces inside?
// This solution will loose multiple spaces;-/
String tag = parts[0];
for (int i = 1; i < parts.length - 1; ++i) {
tag += " " + parts[i];
}
TagEntry tagEntry = new BazaarTagEntry(Integer.parseInt(parts[parts.length - 1]), tag);
// Bazaar lists multiple tags on more lines. We need to merge those into single TagEntry
TagEntry higher = entries.ceiling(tagEntry);
if (higher != null && higher.equals(tagEntry)) {
// Found in the tree, merge tags
entries.remove(higher);
tagEntry.setTags(higher.getTags() + ", " + tag);
}
entries.add(tagEntry);
}
}
}
}
代码示例来源:origin: google/ExoPlayer
private void mergeSpan(CacheSpan span) {
Region newRegion = new Region(span.position, span.position + span.length);
Region floorRegion = regions.floor(newRegion);
Region ceilingRegion = regions.ceiling(newRegion);
boolean floorConnects = regionsConnect(floorRegion, newRegion);
boolean ceilingConnects = regionsConnect(newRegion, ceilingRegion);
代码示例来源:origin: google/ExoPlayer
/**
* Returns the span containing the position. If there isn't one, it returns a hole span
* which defines the maximum extents of the hole in the cache.
*/
public SimpleCacheSpan getSpan(long position) {
SimpleCacheSpan lookupSpan = SimpleCacheSpan.createLookup(key, position);
SimpleCacheSpan floorSpan = cachedSpans.floor(lookupSpan);
if (floorSpan != null && floorSpan.position + floorSpan.length > position) {
return floorSpan;
}
SimpleCacheSpan ceilSpan = cachedSpans.ceiling(lookupSpan);
return ceilSpan == null ? SimpleCacheSpan.createOpenHole(key, position)
: SimpleCacheSpan.createClosedHole(key, position, ceilSpan.position - position);
}
代码示例来源:origin: wdullaer/MaterialDateTimePicker
if (!selectableDays.isEmpty()) {
Calendar newCalendar = null;
Calendar higher = selectableDays.ceiling(calendar);
Calendar lower = selectableDays.lower(calendar);
代码示例来源:origin: wdullaer/MaterialDateTimePicker
Timepoint ceil = exclusiveSelectableTimes.ceiling(current);
Timepoint floor = exclusiveSelectableTimes.floor(current);
return !(current.equals(ceil, Timepoint.TYPE.HOUR) || current.equals(floor, Timepoint.TYPE.HOUR));
Timepoint ceil = mDisabledTimes.ceiling(current);
Timepoint floor = mDisabledTimes.floor(current);
return current.equals(ceil, Timepoint.TYPE.HOUR) || current.equals(floor, Timepoint.TYPE.HOUR);
Timepoint ceil = exclusiveSelectableTimes.ceiling(current);
Timepoint floor = exclusiveSelectableTimes.floor(current);
return !(current.equals(ceil, Timepoint.TYPE.MINUTE) || current.equals(floor, Timepoint.TYPE.MINUTE));
Timepoint ceil = mDisabledTimes.ceiling(current);
Timepoint floor = mDisabledTimes.floor(current);
boolean ceilExclude = current.equals(ceil, Timepoint.TYPE.MINUTE);
代码示例来源:origin: wdullaer/MaterialDateTimePicker
Timepoint forwardCeil = mDisabledTimes.ceiling(forward);
Timepoint forwardFloor = mDisabledTimes.floor(forward);
if (!forward.equals(forwardCeil, resolution) && !forward.equals(forwardFloor, resolution))
Timepoint backwardCeil = mDisabledTimes.ceiling(backward);
Timepoint backwardFloor = mDisabledTimes.floor(backward);
if (!backward.equals(backwardCeil, resolution) && !backward.equals(backwardFloor, resolution))
代码示例来源:origin: apache/kylin
try {
int id = dict.getIdFromValue(query, 1);
assertEquals(set.ceiling(query), dict.getValueFromId(id));
} catch (IllegalArgumentException e) {
assertNull(set.ceiling(query));
代码示例来源:origin: apache/kylin
try {
int id = dict.getIdFromValue(query, 1);
assertEquals(set.ceiling(query), dict.getValueFromId(id));
} catch (IllegalArgumentException e) {
assertNull(set.ceiling(query));
代码示例来源:origin: wdullaer/MaterialDateTimePicker
Timepoint ceil = exclusiveSelectableTimes.ceiling(time);
Timepoint ceil = mDisabledTimes.ceiling(time);
Timepoint floor = mDisabledTimes.floor(time);
boolean ceilDisabled = time.equals(ceil, Timepoint.TYPE.MINUTE);
Timepoint ceil = mDisabledTimes.ceiling(time);
Timepoint floor = mDisabledTimes.floor(time);
boolean ceilDisabled = time.equals(ceil, Timepoint.TYPE.HOUR);
代码示例来源:origin: apache/kylin
assertEquals(set.ceiling(query), dict.getValueFromId(id));
} catch (IllegalArgumentException e) {
assertNull(set.ceiling(query));
代码示例来源:origin: apache/cloudstack
public NetworkPolicyModel lookupNetworkPolicy(String uuid) {
NetworkPolicyModel vmKey = new NetworkPolicyModel(uuid, null);
NetworkPolicyModel current = _policyTable.ceiling(vmKey);
if (current != null && current.getUuid().equals(uuid)) {
return current;
}
return null;
}
}
代码示例来源:origin: apache/cloudstack
public ServiceInstanceModel lookupServiceInstance(String fqn) {
ServiceInstanceModel siKey = new ServiceInstanceModel(fqn);
ServiceInstanceModel current = _serviceInstanceTable.ceiling(siKey);
if (current != null && current.getQualifiedName().equals(fqn)) {
return current;
}
return null;
}
代码示例来源:origin: apache/cloudstack
public VirtualMachineModel lookupVirtualMachine(String uuid) {
VirtualMachineModel vmKey = new VirtualMachineModel(null, uuid);
VirtualMachineModel current = _vmTable.ceiling(vmKey);
if (current != null && current.getUuid().equals(uuid)) {
return current;
}
return null;
}
代码示例来源:origin: apache/cloudstack
public VirtualNetworkModel lookupVirtualNetwork(String uuid, String name, TrafficType ttype) {
VirtualNetworkModel vnKey = new VirtualNetworkModel(null, uuid, name, ttype);
VirtualNetworkModel current = _vnTable.ceiling(vnKey);
if (current != null) {
if (ttype == TrafficType.Management || ttype == TrafficType.Storage || ttype == TrafficType.Control) {
if (current.getName().equals(name)) {
return current;
}
} else if (current.getUuid().equals(uuid)) {
return current;
}
}
return null;
}
代码示例来源:origin: apache/cloudstack
public FloatingIpModel getFloatingIpModel(String uuid) {
TreeSet<ModelObject> tree = successors();
FloatingIpModel fipKey = new FloatingIpModel(uuid);
FloatingIpModel current = (FloatingIpModel)tree.ceiling(fipKey);
if (current != null && current.getUuid().equals(uuid)) {
return current;
}
return null;
}
代码示例来源:origin: apache/cloudstack
public VMInterfaceModel getVMInterface(String uuid) {
TreeSet<ModelObject> tree = successors();
VMInterfaceModel vmiKey = new VMInterfaceModel(uuid);
VMInterfaceModel current = (VMInterfaceModel)tree.ceiling(vmiKey);
if (current != null && current.getUuid().equals(uuid)) {
return current;
}
return null;
}
代码示例来源:origin: org.apache.openejb/openejb-core
@Override
public Integer getNextValue(final Calendar calendar) {
final TreeSet<Integer> newValues = getNewValuesFromDynamicExpressions(calendar);
final int currValue = calendar.get(field);
final Integer result = newValues.ceiling(currValue);
return isValidResult(calendar, result) ? result : null;
}
代码示例来源:origin: org.apache.openjpa/openjpa-kernel
@Override
public Object ceiling(Object e) {
if (!_directAccess && isDelayLoad()) {
load();
}
return super.ceiling(e);
}
内容来源于网络,如有侵权,请联系作者删除!