本文整理了Java中com.carrotsearch.hppc.ObjectIntHashMap.containsKey()
方法的一些代码示例,展示了ObjectIntHashMap.containsKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectIntHashMap.containsKey()
方法的具体详情如下:
包路径:com.carrotsearch.hppc.ObjectIntHashMap
类名称:ObjectIntHashMap
方法名:containsKey
暂无
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public synchronized void onCommit(List<? extends IndexCommit> commits) throws IOException {
final int keptPosition = indexOfKeptCommits(commits, globalCheckpointSupplier.getAsLong());
lastCommit = commits.get(commits.size() - 1);
safeCommit = commits.get(keptPosition);
for (int i = 0; i < keptPosition; i++) {
if (snapshottedCommits.containsKey(commits.get(i)) == false) {
deleteCommit(commits.get(i));
}
}
updateRetentionPolicy();
}
代码示例来源:origin: carrotsearch/hppc
/**
* Return true if all keys of some other container exist in this container.
* Equality comparison is performed with this object's {@link #equals(Object, Object)}
* method.
*/
protected boolean equalElements(ObjectIntHashMap<?> other) {
if (other.size() != size()) {
return false;
}
for (ObjectIntCursor<?> c : other) {
KType key = (KType) c.key;
if (!containsKey(key) ||
!((get(key)) == (c.value))) {
return false;
}
}
return true;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Releases an index commit that acquired by {@link #acquireIndexCommit(boolean)}.
*
* @return true if the snapshotting commit can be clean up.
*/
synchronized boolean releaseCommit(final IndexCommit snapshotCommit) {
final IndexCommit releasingCommit = ((SnapshotIndexCommit) snapshotCommit).delegate;
assert snapshottedCommits.containsKey(releasingCommit) : "Release non-snapshotted commit;" +
"snapshotted commits [" + snapshottedCommits + "], releasing commit [" + releasingCommit + "]";
final int refCount = snapshottedCommits.addTo(releasingCommit, -1); // release refCount
assert refCount >= 0 : "Number of snapshots can not be negative [" + refCount + "]";
if (refCount == 0) {
snapshottedCommits.remove(releasingCommit);
}
// The commit can be clean up only if no pending snapshot and it is neither the safe commit nor last commit.
return refCount == 0 && releasingCommit.equals(safeCommit) == false && releasingCommit.equals(lastCommit) == false;
}
代码示例来源:origin: clir/clearnlp
public boolean containsKey(T key)
{
return g_map.containsKey(key);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
if (fullValues != null) {
for (String fullValue : fullValues) {
if (!shardPerAttribute.containsKey(fullValue)) {
numberOfAttributes++;
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
public boolean dependsOn(ColumnDefinition column) {
return this.mappingInfo != null && this.mappingInfo.fieldsToIdx.containsKey(column.name.toString());
}
代码示例来源:origin: org.apache.drill.exec/drill-java-exec
private int getFieldIndex(final String name, final InstructionModifier mv) {
if (!fieldMap.containsKey(name)) {
throw new IllegalArgumentException(String.format(
"Unknown name '%s' on line %d.", name, mv.getLastLineNumber()));
}
return fieldMap.get(name); // using lget() is not thread-safe
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public synchronized void onCommit(List<? extends IndexCommit> commits) throws IOException {
final int keptPosition = indexOfKeptCommits(commits, globalCheckpointSupplier.getAsLong());
lastCommit = commits.get(commits.size() - 1);
safeCommit = commits.get(keptPosition);
for (int i = 0; i < keptPosition; i++) {
if (snapshottedCommits.containsKey(commits.get(i)) == false) {
deleteCommit(commits.get(i));
}
}
updateTranslogDeletionPolicy();
}
代码示例来源:origin: harbby/presto-connectors
/**
* <a href="http://trove4j.sourceforge.net">Trove</a>-inspired API method. An equivalent
* of the following code:
* <pre>
* if (!map.containsKey(key)) map.put(value);
* </pre>
*
* @param key The key of the value to check.
* @param value The value to put if <code>key</code> does not exist.
* @return <code>true</code> if <code>key</code> did not exist and <code>value</code>
* was placed in the map.
*/
public boolean putIfAbsent(KType key, int value) {
if (!containsKey(key)) {
put(key, value);
return true;
} else {
return false;
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
@Override
public synchronized void onCommit(List<? extends IndexCommit> commits) throws IOException {
final int keptPosition = indexOfKeptCommits(commits, globalCheckpointSupplier.getAsLong());
lastCommit = commits.get(commits.size() - 1);
safeCommit = commits.get(keptPosition);
for (int i = 0; i < keptPosition; i++) {
if (snapshottedCommits.containsKey(commits.get(i)) == false) {
deleteCommit(commits.get(i));
}
}
updateRetentionPolicy();
}
代码示例来源:origin: dremio/dremio-oss
private void releaseViewExpansionToken(ViewExpansionToken token) {
final String viewOwner = token.viewOwner;
if (Objects.equals(queryUser, viewOwner)) {
// If the token owner and queryUser are same, no need to track the token release.
return;
}
Preconditions.checkState(userTokens.containsKey(token.viewOwner),
"Given user doesn't exist in User Token store. Make sure token for this user is obtained first.");
final int userTokenCount = userTokens.get(viewOwner);
if (userTokenCount == 1) {
// Remove the user from collection, when there are no more tokens issued to the user.
userTokens.remove(viewOwner);
} else {
userTokens.put(viewOwner, userTokenCount - 1);
}
logger.debug("Released view expansion token issued for user '{}'", viewOwner);
}
代码示例来源:origin: dremio/dremio-oss
/**
* Reserve a token for expansion of view owned by given user name.
*
* @param viewOwner Name of the user who owns the view.
* @return An instance of {@link com.dremio.exec.ops.ViewExpansionContext.ViewExpansionToken} which must be
* released when done using the token.
*/
public ViewExpansionToken reserveViewExpansionToken(String viewOwner) {
int totalTokens = 1;
if (!Objects.equals(queryUser, viewOwner)) {
// We want to track the tokens only if the "viewOwner" is not same as the "queryUser".
if (userTokens.containsKey(viewOwner)) {
totalTokens += userTokens.get(viewOwner);
}
userTokens.put(viewOwner, totalTokens);
logger.debug("Issued view expansion token for user '{}'", viewOwner);
}
return new ViewExpansionToken(viewOwner);
}
代码示例来源:origin: harbby/presto-connectors
/**
* If <code>key</code> exists, <code>putValue</code> is inserted into the map,
* otherwise any existing value is incremented by <code>additionValue</code>.
*
* @param key
* The key of the value to adjust.
* @param putValue
* The value to put if <code>key</code> does not exist.
* @param incrementValue
* The value to add to the existing value if <code>key</code> exists.
* @return Returns the current value associated with <code>key</code> (after
* changes).
*/
@Override
public int putOrAdd(KType key, int putValue, int incrementValue) {
assert assigned < mask + 1;
if (containsKey(key)) {
putValue = get(key);
putValue = (int) (((putValue) + (incrementValue)));
}
put(key, putValue);
return putValue;
}
代码示例来源:origin: org.apache.drill.exec/drill-java-exec
private void releaseViewExpansionToken(ViewExpansionToken token) {
final String viewOwner = token.viewOwner;
if (viewOwner.equals(queryUser)) {
// If the token owner and queryUser are same, no need to track the token release.
return;
}
Preconditions.checkState(userTokens.containsKey(token.viewOwner),
"Given user doesn't exist in User Token store. Make sure token for this user is obtained first.");
final int userTokenCount = userTokens.get(viewOwner);
if (userTokenCount == 1) {
// Remove the user from collection, when there are no more tokens issued to the user.
userTokens.remove(viewOwner);
} else {
userTokens.put(viewOwner, userTokenCount - 1);
}
logger.debug("Released view expansion token issued for user '{}'", viewOwner);
}
代码示例来源:origin: harbby/presto-connectors
/**
* Return true if all keys of some other container exist in this container.
* Equality comparison is performed with this object's {@link #equals(Object, Object)}
* method.
*/
protected boolean equalElements(ObjectIntHashMap<?> other) {
if (other.size() != size()) {
return false;
}
for (ObjectIntCursor<?> c : other) {
KType key = (KType) c.key;
if (!containsKey(key) ||
!((get(key)) == (c.value))) {
return false;
}
}
return true;
}
代码示例来源:origin: org.apache.drill.exec/drill-java-exec
if (!viewOwner.equals(queryUser)) {
if (userTokens.containsKey(viewOwner)) {
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Releases an index commit that acquired by {@link #acquireIndexCommit(boolean)}.
*
* @return true if the snapshotting commit can be clean up.
*/
synchronized boolean releaseCommit(final IndexCommit snapshotCommit) {
final IndexCommit releasingCommit = ((SnapshotIndexCommit) snapshotCommit).delegate;
assert snapshottedCommits.containsKey(releasingCommit) : "Release non-snapshotted commit;" +
"snapshotted commits [" + snapshottedCommits + "], releasing commit [" + releasingCommit + "]";
final int refCount = snapshottedCommits.addTo(releasingCommit, -1); // release refCount
assert refCount >= 0 : "Number of snapshots can not be negative [" + refCount + "]";
if (refCount == 0) {
snapshottedCommits.remove(releasingCommit);
}
// The commit can be clean up only if no pending snapshot and it is neither the safe commit nor last commit.
return refCount == 0 && releasingCommit.equals(safeCommit) == false && releasingCommit.equals(lastCommit) == false;
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Releases an index commit that acquired by {@link #acquireIndexCommit(boolean)}.
*
* @return true if the snapshotting commit can be clean up.
*/
synchronized boolean releaseCommit(final IndexCommit snapshotCommit) {
final IndexCommit releasingCommit = ((SnapshotIndexCommit) snapshotCommit).delegate;
assert snapshottedCommits.containsKey(releasingCommit) : "Release non-snapshotted commit;" +
"snapshotted commits [" + snapshottedCommits + "], releasing commit [" + releasingCommit + "]";
final int refCount = snapshottedCommits.addTo(releasingCommit, -1); // release refCount
assert refCount >= 0 : "Number of snapshots can not be negative [" + refCount + "]";
if (refCount == 0) {
snapshottedCommits.remove(releasingCommit);
}
// The commit can be clean up only if no pending snapshot and it is neither the safe commit nor last commit.
return refCount == 0 && releasingCommit.equals(safeCommit) == false && releasingCommit.equals(lastCommit) == false;
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
public Indexer indexerFor(DecoratedKey key, PartitionColumns columns, int nowInSec, Group opGroup, Type transactionType) {
if (isIndexing()) {
if (transactionType == Type.COMPACTION && !this.mappingInfo.indexOnCompaction)
return null;
boolean found = (columns.size() == 0);
if (!found) {
for(ColumnDefinition cd : columns) {
if (this.mappingInfo.fieldsToIdx.containsKey(cd.name.toString())) {
found = true;
break;
}
}
}
if (found) {
try {
if (baseCfs.getComparator().size() == 0)
return this.mappingInfo.new SkinnyRowcumentIndexer(key, columns, nowInSec, opGroup, transactionType);
else
return this.mappingInfo.new WideRowcumentIndexer(key, columns, nowInSec, opGroup, transactionType);
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
}
return null;
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
if (fullValues != null) {
for (String fullValue : fullValues) {
if (!shardPerAttribute.containsKey(fullValue)) {
numberOfAttributes++;
内容来源于网络,如有侵权,请联系作者删除!