本文整理汇总了Java中it.unimi.dsi.fastutil.HashCommon类的典型用法代码示例。如果您正苦于以下问题:Java HashCommon类的具体用法?Java HashCommon怎么用?Java HashCommon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HashCommon类属于it.unimi.dsi.fastutil包,在下文中一共展示了HashCommon类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: get
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
@Override
public short get(short k) {
// The starting point
int pos = (HashCommon.murmurHash3(k)) & mask;
// There's always an unused entry.
int cnt = 0;
while (used(pos)) {
if (key[pos] == k) {
return values[pos];
}
pos = (pos + 1) & mask;
cnt++;
if (cnt > n) {
rehash();
return get(k);
}
}
return 0;
}
开发者ID:Tencent,项目名称:angel,代码行数:22,代码来源:S2BTightTraverseMap.java
示例2: put
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
public void put(short k, byte v) {
if (v == 0)
return;
// The starting point
int pos = (HashCommon.murmurHash3(k)) & mask;
// There's always an unused entry.
while (used(pos)) {
if (key[pos] == k) {
values[pos] = v;
return;
}
pos = (pos + 1) & mask;
}
key[pos] = k;
values[pos] = v;
values[idx(size)] = (byte) pos;
values[poss(pos)] = (byte) size;
size++;
}
开发者ID:Tencent,项目名称:angel,代码行数:23,代码来源:S2BTightTraverseMap.java
示例3: dec
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
@Override
public short dec(short k) {
int pos = (HashCommon.murmurHash3(k)) & mask;
while (used(pos)) {
if (key[pos] == k) {
values[pos]--;
if (values[pos] == 0) {
size--;
values[idx(values[poss(pos)])] = values[idx(size)];
values[poss(values[idx(size)])] = values[poss(pos)];
}
return values[pos];
}
pos = (pos + 1) & mask;
}
return 0;
}
开发者ID:Tencent,项目名称:angel,代码行数:20,代码来源:S2BTightTraverseMap.java
示例4: get
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
@Override
public short get(short k) {
// The starting point
int pos = (HashCommon.murmurHash3(k)) & mask;
// There's always an unused entry.
int cnt = 0;
while (used[pos]) {
if (key[pos] == k) {
return value[pos];
}
pos = (pos + 1) & mask;
cnt++;
if (cnt > n) {
rehash();
return get(k);
}
}
return 0;
}
开发者ID:Tencent,项目名称:angel,代码行数:22,代码来源:S2BTraverseMap.java
示例5: put
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
public void put(short k, byte v) {
if (v == 0)
return;
// The starting point
int pos = (HashCommon.murmurHash3(k)) & mask;
// There's always an unused entry.
while (used[pos]) {
if (key[pos] == k) {
value[pos] = v;
return;
}
pos = (pos + 1) & mask;
}
used[pos] = true;
key[pos] = k;
value[pos] = v;
idx[size] = (byte) pos;
poss[(byte) pos] = (byte) size;
size++;
}
开发者ID:Tencent,项目名称:angel,代码行数:24,代码来源:S2BTraverseMap.java
示例6: dec
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
@Override
public short dec(short k) {
int pos = (HashCommon.murmurHash3(k)) & mask;
while (used[pos]) {
if (key[pos] == k) {
value[pos]--;
if (value[pos] == 0) {
size--;
idx[poss[pos]] = idx[size];
poss[idx[size]] = poss[pos];
}
return value[pos];
}
pos = (pos + 1) & mask;
}
return 0;
}
开发者ID:Tencent,项目名称:angel,代码行数:20,代码来源:S2BTraverseMap.java
示例7: put
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
public void put(final short k, final short v) {
if (v == 0)
return;
// The starting point
int pos = (HashCommon.murmurHash3(k)) & mask;
// There's always an unused entry.
while (used[pos]) {
if (key[pos] == k) {
value[pos] = v;
return;
}
pos = (pos + 1) & mask;
}
used[pos] = true;
key[pos] = k;
value[pos] = v;
idx[size] = (short) pos;
poss[(short) pos] = size;
size++;
}
开发者ID:Tencent,项目名称:angel,代码行数:24,代码来源:S2STraverseMap.java
示例8: dec
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
public short dec(final short k) {
int pos = (HashCommon.murmurHash3(k)) & mask;
while (used[pos]) {
if (key[pos] == k) {
value[pos]--;
if (value[pos] == 0) {
size--;
idx[poss[pos]] = idx[size];
poss[idx[size]] = poss[pos];
}
return value[pos];
}
pos = (pos + 1) & mask;
}
return 0;
}
开发者ID:Tencent,项目名称:angel,代码行数:19,代码来源:S2STraverseMap.java
示例9: put
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
public void put(short k, int v) {
if (v == 0)
return;
// The starting point
int pos = (HashCommon.murmurHash3(k)) & mask;
// There's always an unused entry.
while (used[pos]) {
if (key[pos] == k) {
value[pos] = v;
return;
}
pos = (pos + 1) & mask;
}
used[pos] = true;
key[pos] = k;
value[pos] = v;
idx[size] = (short) pos;
poss[(short) pos] = size;
size++;
}
开发者ID:Tencent,项目名称:angel,代码行数:24,代码来源:S2ITraverseMap.java
示例10: dec
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
@Override
public short dec(short k) {
int pos = (HashCommon.murmurHash3(k)) & mask;
while (used[pos]) {
if (key[pos] == k) {
value[pos]--;
if (value[pos] == 0) {
size--;
idx[poss[pos]] = idx[size];
poss[idx[size]] = poss[pos];
}
return (short) value[pos];
}
pos = (pos + 1) & mask;
}
return 0;
}
开发者ID:Tencent,项目名称:angel,代码行数:20,代码来源:S2ITraverseMap.java
示例11: get
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
public short get(final short k) {
// The starting point
int pos = (HashCommon.murmurHash3(k)) & mask;
// There's always an unused entry.
int cnt = 0;
while (used(pos)) {
if (key[pos] == k) {
return values[pos];
}
pos = (pos + 1) & mask;
cnt++;
if (cnt > n) {
rehash();
return get(k);
}
}
return 0;
}
开发者ID:Tencent,项目名称:angel,代码行数:21,代码来源:S2STightTraverseMap.java
示例12: put
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
public void put(final short k, final short v) {
if (v == 0)
return;
// The starting point
int pos = (HashCommon.murmurHash3(k)) & mask;
// There's always an unused entry.
while (used(pos)) {
if (key[pos] == k) {
values[pos] = v;
return;
}
pos = (pos + 1) & mask;
}
key[pos] = k;
values[pos] = v;
values[size + n] = (short) pos;
values[(short) pos + n * 2] = size;
size++;
}
开发者ID:Tencent,项目名称:angel,代码行数:23,代码来源:S2STightTraverseMap.java
示例13: dec
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
public short dec(final short k) {
int pos = (HashCommon.murmurHash3(k)) & mask;
while (used(pos)) {
if (key[pos] == k) {
values[pos]--;
if (values[pos] == 0) {
size--;
values[idx(values[poss(pos)])] = values[idx(size)];
values[poss(values[idx(size)])] = values[poss(pos)];
}
return values[pos];
}
pos = (pos + 1) & mask;
}
return 0;
}
开发者ID:Tencent,项目名称:angel,代码行数:19,代码来源:S2STightTraverseMap.java
示例14: shiftKeys
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
/** Shifts left entries with the specified hash code, starting at the specified position,
* and empties the resulting free entry.
*
* @param pos a starting position.
*/
protected final void shiftKeys( int pos ) {
// Shift entries with the same hash.
int last, slot;
long curr;
final long[] key = this.key;
for(;;) {
pos = ( ( last = pos ) + 1 ) & mask;
for(;;) {
if ( ( (curr = key[ pos ]) == (0) ) ) {
key[ last ] = (0);
value[ last ] = null;
return;
}
slot = (int)it.unimi.dsi.fastutil.HashCommon.mix( (curr) ) & mask;
if ( last <= pos ? last >= slot || slot > pos : last >= slot && slot > pos ) break;
pos = ( pos + 1 ) & mask;
}
key[ last ] = curr;
value[ last ] = value[ pos ];
fixPointers( pos, last );
}
}
开发者ID:aikar,项目名称:fastutil-lite,代码行数:28,代码来源:Long2ObjectLinkedOpenHashMap.java
示例15: remove
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
public V remove( final long k ) {
if ( ( (k) == (0) ) ) {
if ( containsNullKey ) return removeNullEntry();
return defRetValue;
}
long curr;
final long[] key = this.key;
int pos;
// The starting point.
if ( ( (curr = key[ pos = (int)it.unimi.dsi.fastutil.HashCommon.mix( (k) ) & mask ]) == (0) ) ) return defRetValue;
if ( ( (k) == (curr) ) ) return removeEntry( pos );
while( true ) {
if ( ( (curr = key[ pos = ( pos + 1 ) & mask ]) == (0) ) ) return defRetValue;
if ( ( (k) == (curr) ) ) return removeEntry( pos );
}
}
开发者ID:aikar,项目名称:fastutil-lite,代码行数:17,代码来源:Long2ObjectLinkedOpenHashMap.java
示例16: get
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
/** @deprecated Please use the corresponding type-specific method instead. */
@Deprecated
public V get( final Long ok ) {
if ( ok == null ) return null;
final long k = ((ok).longValue());
if ( ( (k) == (0) ) ) return containsNullKey ? (value[ n ]) : (this.defRetValue);
long curr;
final long[] key = this.key;
int pos;
// The starting point.
if ( ( (curr = key[ pos = (int)it.unimi.dsi.fastutil.HashCommon.mix( (k) ) & mask ]) == (0) ) ) return (this.defRetValue);
if ( ( (k) == (curr) ) ) return (value[ pos ]);
// There's always an unused entry.
while( true ) {
if ( ( (curr = key[ pos = ( pos + 1 ) & mask ]) == (0) ) ) return (this.defRetValue);
if ( ( (k) == (curr) ) ) return (value[ pos ]);
}
}
开发者ID:aikar,项目名称:fastutil-lite,代码行数:19,代码来源:Long2ObjectLinkedOpenHashMap.java
示例17: contains
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public boolean contains( final Object o ) {
if ( !( o instanceof Map.Entry ) ) return false;
final Map.Entry<Long, V> e = (Map.Entry<Long, V>)o;
if ( e.getKey() == null ) return false;
final long k = ((e.getKey()).longValue());
if ( ( (k) == (0) ) ) return ( Long2ObjectLinkedOpenHashMap.this.containsNullKey && ( (value[ n ]) == null ? ((e.getValue())) == null : (value[ n ]).equals((e.getValue())) ) );
long curr;
final long[] key = Long2ObjectLinkedOpenHashMap.this.key;
int pos;
// The starting point.
if ( ( (curr = key[ pos = (int)it.unimi.dsi.fastutil.HashCommon.mix( (k) ) & mask ]) == (0) ) ) return false;
if ( ( (k) == (curr) ) ) return ( (value[ pos ]) == null ? ((e.getValue())) == null : (value[ pos ]).equals((e.getValue())) );
// There's always an unused entry.
while( true ) {
if ( ( (curr = key[ pos = ( pos + 1 ) & mask ]) == (0) ) ) return false;
if ( ( (k) == (curr) ) ) return ( (value[ pos ]) == null ? ((e.getValue())) == null : (value[ pos ]).equals((e.getValue())) );
}
}
开发者ID:aikar,项目名称:fastutil-lite,代码行数:20,代码来源:Long2ObjectLinkedOpenHashMap.java
示例18: insert
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
private int insert(final long k, final V v) {
int pos;
if ( ( (k) == (0) ) ) {
if ( containsNullKey ) return n;
containsNullKey = true;
pos = n;
}
else {
long curr;
final long[] key = this.key;
// The starting point.
if ( ! ( (curr = key[ pos = (int)it.unimi.dsi.fastutil.HashCommon.mix( (k) ) & mask ]) == (0) ) ) {
if ( ( (curr) == (k) ) ) return pos;
while( ! ( (curr = key[ pos = ( pos + 1 ) & mask ]) == (0) ) )
if ( ( (curr) == (k) ) ) return pos;
}
}
key[ pos ] = k;
value[ pos ] = v;
if ( size++ >= maxFill ) rehash( arraySize( size + 1, f ) );
if ( ASSERTS ) checkTable();
return -1;
}
开发者ID:aikar,项目名称:fastutil-lite,代码行数:24,代码来源:Long2ObjectOpenHashMap.java
示例19: shiftKeys
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
/** Shifts left entries with the specified hash code, starting at the specified position,
* and empties the resulting free entry.
*
* @param pos a starting position.
*/
protected final void shiftKeys( int pos ) {
// Shift entries with the same hash.
int last, slot;
long curr;
final long[] key = this.key;
for(;;) {
pos = ( ( last = pos ) + 1 ) & mask;
for(;;) {
if ( ( (curr = key[ pos ]) == (0) ) ) {
key[ last ] = (0);
value[ last ] = null;
return;
}
slot = (int)it.unimi.dsi.fastutil.HashCommon.mix( (curr) ) & mask;
if ( last <= pos ? last >= slot || slot > pos : last >= slot && slot > pos ) break;
pos = ( pos + 1 ) & mask;
}
key[ last ] = curr;
value[ last ] = value[ pos ];
}
}
开发者ID:aikar,项目名称:fastutil-lite,代码行数:27,代码来源:Long2ObjectOpenHashMap.java
示例20: nextEntry
import it.unimi.dsi.fastutil.HashCommon; //导入依赖的package包/类
public int nextEntry() {
if ( ! hasNext() ) throw new NoSuchElementException();
c--;
if ( mustReturnNullKey ) {
mustReturnNullKey = false;
return last = n;
}
final long key[] = Long2ObjectOpenHashMap.this.key;
for(;;) {
if ( --pos < 0 ) {
// We are just enumerating elements from the wrapped list.
last = Integer.MIN_VALUE;
final long k = wrapped.getLong( - pos - 1 );
int p = (int)it.unimi.dsi.fastutil.HashCommon.mix( (k) ) & mask;
while ( ! ( (k) == (key[ p ]) ) ) p = ( p + 1 ) & mask;
return p;
}
if ( ! ( (key[ pos ]) == (0) ) ) return last = pos;
}
}
开发者ID:aikar,项目名称:fastutil-lite,代码行数:21,代码来源:Long2ObjectOpenHashMap.java
注:本文中的it.unimi.dsi.fastutil.HashCommon类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论