本文整理了Java中java.util.concurrent.ConcurrentSkipListSet.floor()
方法的一些代码示例,展示了ConcurrentSkipListSet.floor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentSkipListSet.floor()
方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentSkipListSet
类名称:ConcurrentSkipListSet
方法名:floor
暂无
代码示例来源:origin: internetarchive/heritrix3
/**
* @param prefixSet
* @param str
* @return length of longest entry in {@code prefixSet} that prefixes {@code str}, or zero
* if no entry prefixes {@code str}
*/
protected int longestPrefixLength(ConcurrentSkipListSet<String> prefixSet,
String str) {
String possiblePrefix = prefixSet.floor(str);
if (possiblePrefix != null && str.startsWith(possiblePrefix)) {
return possiblePrefix.length();
} else {
return 0;
}
}
代码示例来源:origin: wildfly/wildfly
public List<NameClassPair> list(final Name name) throws NamingException {
final ServiceName lookupName = buildServiceName(name);
final ServiceName floor = boundServices.floor(lookupName);
boolean isContextBinding = false;
if (floor != null && floor.isParentOf(lookupName)) {
代码示例来源:origin: Alluxio/alluxio
/**
* Gets the bucket in the list that contains the inode.
*
* @param inode the inode to be contained
* @return the bucket containing the inode, or null if no such bucket exists
*/
@Nullable
private TtlBucket getBucketContaining(InodeView inode) {
if (inode.getTtl() == Constants.NO_TTL) {
// no bucket will contain a inode with NO_TTL.
return null;
}
long ttlEndTimeMs = inode.getCreationTimeMs() + inode.getTtl();
// Gets the last bucket with interval start time less than or equal to the inode's life end
// time.
TtlBucket bucket = mBucketList.floor(new TtlBucket(ttlEndTimeMs));
if (bucket == null || bucket.getTtlIntervalEndTimeMs() < ttlEndTimeMs
|| (bucket.getTtlIntervalEndTimeMs() == ttlEndTimeMs
&& TtlBucket.getTtlIntervalMs() != 0)) {
// 1. There is no bucket in the list, or
// 2. All buckets' interval start time is larger than the inode's life end time, or
// 3. No bucket actually contains ttlEndTimeMs in its interval.
return null;
}
return bucket;
}
代码示例来源:origin: wildfly/wildfly
public List<Binding> listBindings(final Name name) throws NamingException {
final ServiceName lookupName = buildServiceName(name);
final ServiceName floor = boundServices.floor(lookupName);
boolean isContextBinding = false;
if (floor != null && floor.isParentOf(lookupName)) {
代码示例来源:origin: cojen/Tupl
/**
* Called after adding a term, to make sure that the given term will reference a valid term
* object.
*/
private TermLog fixTermRef(TermLog termLog) {
// When lower terms are extended, the the reference might need to go lower, hence
// findLe. The methods which examine terms are designed to start low, possibly at the
// first term. Null implies that the first term should be examined, and so everything
// should work fine even if this method always returns null. Finding a valid term
// that's just lower avoids a full scan over the terms.
return termLog == null ? null : (TermLog) mTermLogs.floor(termLog); // findLe
}
代码示例来源:origin: org.archive.heritrix/heritrix-modules
/**
* @param prefixSet
* @param str
* @return length of longest entry in {@code prefixSet} that prefixes {@code str}, or zero
* if no entry prefixes {@code str}
*/
protected int longestPrefixLength(ConcurrentSkipListSet<String> prefixSet,
String str) {
String possiblePrefix = prefixSet.floor(str);
if (possiblePrefix != null && str.startsWith(possiblePrefix)) {
return possiblePrefix.length();
} else {
return 0;
}
}
代码示例来源:origin: org.netpreserve.openwayback/openwayback-core
/**
* @param prefixSet
* @param str
* @return length of longest entry in {@code prefixSet} that prefixes {@code str}, or zero
* if no entry prefixes {@code str}
*/
protected int longestPrefixLength(ConcurrentSkipListSet<String> prefixSet,
String str) {
String possiblePrefix = prefixSet.floor(str);
if (possiblePrefix != null && str.startsWith(possiblePrefix)) {
return possiblePrefix.length();
} else {
return 0;
}
}
代码示例来源:origin: iipc/openwayback
/**
* @param prefixSet
* @param str
* @return length of longest entry in {@code prefixSet} that prefixes {@code str}, or zero
* if no entry prefixes {@code str}
*/
protected int longestPrefixLength(ConcurrentSkipListSet<String> prefixSet,
String str) {
String possiblePrefix = prefixSet.floor(str);
if (possiblePrefix != null && str.startsWith(possiblePrefix)) {
return possiblePrefix.length();
} else {
return 0;
}
}
代码示例来源:origin: cojen/Tupl
@Override
public TermLog termLogAt(long index) {
return (TermLog) mTermLogs.floor(new LKey.Finder<>(index)); // findLe
}
代码示例来源:origin: org.wildfly/wildfly-naming
public List<NameClassPair> list(final Name name) throws NamingException {
final ServiceName lookupName = buildServiceName(name);
final ServiceName floor = boundServices.floor(lookupName);
boolean isContextBinding = false;
if (floor != null && floor.isParentOf(lookupName)) {
代码示例来源:origin: cojen/Tupl
@Override
public LogReader openReader(long index) {
LKey<TermLog> key = new LKey.Finder<>(index);
acquireShared();
try {
if (mClosed) {
throw new IllegalStateException("Closed");
}
TermLog termLog = (TermLog) mTermLogs.floor(key); // findLe
if (termLog != null) {
return termLog.openReader(index);
}
termLog = (TermLog) mTermLogs.first();
throw new IllegalStateException
("Index is lower than start index: " + index + " < " + termLog.startIndex());
} finally {
releaseShared();
}
}
代码示例来源:origin: org.jboss.as/jboss-as-naming
public List<NameClassPair> list(final Name name) throws NamingException {
final ServiceName lookupName = buildServiceName(name);
final ServiceName floor = boundServices.floor(lookupName);
boolean isContextBinding = false;
if (floor != null && floor.isParentOf(lookupName)) {
代码示例来源:origin: org.jboss.eap/wildfly-naming
public List<NameClassPair> list(final Name name) throws NamingException {
final ServiceName lookupName = buildServiceName(name);
final ServiceName floor = boundServices.floor(lookupName);
boolean isContextBinding = false;
if (floor != null && floor.isParentOf(lookupName)) {
代码示例来源:origin: org.jboss.eap/wildfly-naming
public List<Binding> listBindings(final Name name) throws NamingException {
final ServiceName lookupName = buildServiceName(name);
final ServiceName floor = boundServices.floor(lookupName);
boolean isContextBinding = false;
if (floor != null && floor.isParentOf(lookupName)) {
代码示例来源:origin: org.wildfly/wildfly-naming
public List<Binding> listBindings(final Name name) throws NamingException {
final ServiceName lookupName = buildServiceName(name);
final ServiceName floor = boundServices.floor(lookupName);
boolean isContextBinding = false;
if (floor != null && floor.isParentOf(lookupName)) {
代码示例来源:origin: org.jboss.as/jboss-as-naming
public List<Binding> listBindings(final Name name) throws NamingException {
final ServiceName lookupName = buildServiceName(name);
final ServiceName floor = boundServices.floor(lookupName);
boolean isContextBinding = false;
if (floor != null && floor.isParentOf(lookupName)) {
代码示例来源:origin: cojen/Tupl
@Override
public void queryTerms(long startIndex, long endIndex, TermQuery results) {
if (startIndex >= endIndex) {
return;
}
LKey<TermLog> startKey = new LKey.Finder<>(startIndex);
LKey<TermLog> endKey = new LKey.Finder<>(endIndex);
LKey<TermLog> prev = mTermLogs.floor(startKey); // findLe
if (prev != null && ((TermLog) prev).endIndex() > startIndex) {
startKey = prev;
}
for (Object key : mTermLogs.subSet(startKey, endKey)) {
TermLog termLog = (TermLog) key;
results.term(termLog.prevTerm(), termLog.term(), termLog.startIndex());
}
}
代码示例来源:origin: org.alluxio/alluxio-core-server-master
/**
* Gets the bucket in the list that contains the inode.
*
* @param inode the inode to be contained
* @return the bucket containing the inode, or null if no such bucket exists
*/
private TtlBucket getBucketContaining(Inode<?> inode) {
if (inode.getTtl() == Constants.NO_TTL) {
// no bucket will contain a inode with NO_TTL.
return null;
}
long ttlEndTimeMs = inode.getCreationTimeMs() + inode.getTtl();
// Gets the last bucket with interval start time less than or equal to the inode's life end
// time.
TtlBucket bucket = mBucketList.floor(new TtlBucket(ttlEndTimeMs));
if (bucket == null || bucket.getTtlIntervalEndTimeMs() < ttlEndTimeMs
|| (bucket.getTtlIntervalEndTimeMs() == ttlEndTimeMs
&& TtlBucket.getTtlIntervalMs() != 0)) {
// 1. There is no bucket in the list, or
// 2. All buckets' interval start time is larger than the inode's life end time, or
// 3. No bucket actually contains ttlEndTimeMs in its interval.
return null;
}
return bucket;
}
代码示例来源:origin: org.tachyonproject/tachyon-servers
/**
* Inserts an {@link InodeFile} to the appropriate bucket where its ttl end time lies in the
* bucket's interval, if no appropriate bucket exists, a new bucket will be created to contain
* this file, if ttl value is {@link Constants#NO_TTL}, the file won't be inserted to any buckets
* and nothing will happen.
*
* @param file the file to be inserted
*/
public void insert(InodeFile file) {
if (file.getTTL() == Constants.NO_TTL) {
return;
}
long ttlEndTimeMs = file.getCreationTimeMs() + file.getTTL();
// Gets the last bucket with interval start time less than or equal to the file's life end
// time.
TTLBucket bucket = mBucketList.floor(new TTLBucket(ttlEndTimeMs));
if (bucket == null || bucket.getTTLIntervalEndTimeMs() <= ttlEndTimeMs) {
// 1. There is no bucket in the list, or
// 2. All buckets' interval start time is larger than the file's life end time, or
// 3. No bucket actually contains ttlEndTimeMs in its interval.
// So a new bucket should should be added with an appropriate interval start. Assume the list
// of buckets have continuous intervals, and the first interval starts at 0, then ttlEndTimeMs
// should be in number (ttlEndTimeMs / interval) interval, so the start time of this interval
// should be (ttlEndTimeMs / interval) * interval.
long interval = TTLBucket.getTTLIntervalMs();
bucket = new TTLBucket(interval == 0 ? ttlEndTimeMs : ttlEndTimeMs / interval * interval);
mBucketList.add(bucket);
}
bucket.addFile(file);
}
代码示例来源:origin: cojen/Tupl
TermLog termLog;
defineTermLog: while (true) {
termLog = (TermLog) mTermLogs.floor(key); // findLe
内容来源于网络,如有侵权,请联系作者删除!