本文整理汇总了Java中it.unimi.dsi.fastutil.HashCommon类的典型用法代码示例。如果您正苦于以下问题:Java HashCommon类的具体用法?Java HashCommon怎么用?Java HashCommon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HashCommon类属于it.unimi.dsi.fastutil包,在下文中一共展示了HashCommon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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++;
}
示例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;
}
示例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;
}
示例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++;
}
示例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;
}
示例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++;
}
示例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;
}
示例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++;
}
示例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;
}
示例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;
}
示例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++;
}
示例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;
}
示例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 );
}
}
示例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 );
}
}