本文整理了Java中org.jruby.RubyHash.hashValue
方法的一些代码示例,展示了RubyHash.hashValue
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyHash.hashValue
方法的具体详情如下:
包路径:org.jruby.RubyHash
类名称:RubyHash
方法名:hashValue
暂无
代码示例来源:origin: org.jruby/jruby-complete
protected RubyHashEntry internalDelete(final IRubyObject key) {
if (size == 0) return NO_ENTRY;
return internalDelete(hashValue(key), MATCH_KEY, key);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
protected RubyHashEntry internalDelete(final IRubyObject key) {
return internalDelete(hashValue(key.hashCode()), MATCH_KEY, key);
}
代码示例来源:origin: org.jruby/jruby-core
protected RubyHashEntry internalDelete(final IRubyObject key) {
if (size == 0) return NO_ENTRY;
return internalDelete(hashValue(key), MATCH_KEY, key);
}
代码示例来源:origin: org.jruby/jruby-complete
protected RubyHashEntry internalDeleteEntry(final RubyHashEntry entry) {
// n.b. we need to recompute the hash in case the key object was modified
return internalDelete(hashValue(entry.key), MATCH_ENTRY, entry);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
protected RubyHashEntry internalDelete(final IRubyObject key) {
return internalDelete(hashValue(key.hashCode()), MATCH_KEY, key);
}
代码示例来源:origin: org.jruby/jruby-core
protected RubyHashEntry internalDeleteEntry(final RubyHashEntry entry) {
// n.b. we need to recompute the hash in case the key object was modified
return internalDelete(hashValue(entry.key), MATCH_ENTRY, entry);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
protected RubyHashEntry internalDeleteEntry(final RubyHashEntry entry) {
// n.b. we need to recompute the hash in case the key object was modified
return internalDelete(hashValue(entry.key.hashCode()), MATCH_ENTRY, entry);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
protected RubyHashEntry internalDeleteEntry(final RubyHashEntry entry) {
// n.b. we need to recompute the hash in case the key object was modified
return internalDelete(hashValue(entry.key.hashCode()), MATCH_ENTRY, entry);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
protected RubyHashEntry internalGetEntry(IRubyObject key) {
final int hash = hashValue(key.hashCode());
for (RubyHashEntry entry = table[bucketIndex(hash, table.length)]; entry != null; entry = entry.next) {
if (internalKeyExist(entry, hash, key)) {
return entry;
}
}
return NO_ENTRY;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
protected RubyHashEntry internalGetEntry(IRubyObject key) {
final int hash = hashValue(key.hashCode());
for (RubyHashEntry entry = table[bucketIndex(hash, table.length)]; entry != null; entry = entry.next) {
if (internalKeyExist(entry, hash, key)) {
return entry;
}
}
return NO_ENTRY;
}
代码示例来源:origin: org.jruby/jruby-complete
protected RubyHashEntry internalGetEntry(IRubyObject key) {
if (size == 0) return NO_ENTRY;
final int hash = hashValue(key);
for (RubyHashEntry entry = table[bucketIndex(hash, table.length)]; entry != null; entry = entry.next) {
if (internalKeyExist(entry, hash, key)) {
return entry;
}
}
return NO_ENTRY;
}
代码示例来源:origin: org.jruby/jruby-core
protected RubyHashEntry internalGetEntry(IRubyObject key) {
if (size == 0) return NO_ENTRY;
final int hash = hashValue(key);
for (RubyHashEntry entry = table[bucketIndex(hash, table.length)]; entry != null; entry = entry.next) {
if (internalKeyExist(entry, hash, key)) {
return entry;
}
}
return NO_ENTRY;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
protected void internalPutSmall(final IRubyObject key, final IRubyObject value, final boolean checkForExisting) {
final int hash = hashValue(key.hashCode());
final int i = bucketIndex(hash, table.length);
// if (table[i] != null) collisions++;
if (checkForExisting) {
for (RubyHashEntry entry = table[i]; entry != null; entry = entry.next) {
if (internalKeyExist(entry, hash, key)) {
entry.value = value;
return;
}
}
}
checkIterating();
table[i] = new RubyHashEntry(hash, key, value, table[i], head);
size++;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
protected void internalPutSmall(final IRubyObject key, final IRubyObject value, final boolean checkForExisting) {
final int hash = hashValue(key.hashCode());
final int i = bucketIndex(hash, table.length);
// if (table[i] != null) collisions++;
if (checkForExisting) {
for (RubyHashEntry entry = table[i]; entry != null; entry = entry.next) {
if (internalKeyExist(entry, hash, key)) {
entry.value = value;
return;
}
}
}
checkIterating();
table[i] = new RubyHashEntry(hash, key, value, table[i], head);
size++;
}
代码示例来源:origin: org.jruby/jruby-complete
protected IRubyObject internalPutNoResize(final IRubyObject key, final IRubyObject value, final boolean checkForExisting) {
final int hash = hashValue(key);
final int i = bucketIndex(hash, table.length);
if (checkForExisting) {
for (RubyHashEntry entry = table[i]; entry != null; entry = entry.next) {
if (internalKeyExist(entry, hash, key)) {
IRubyObject existing = entry.value;
entry.value = value;
return existing;
}
}
}
checkIterating();
table[i] = new RubyHashEntry(hash, key, value, table[i], head);
size++;
// no existing entry
return null;
}
代码示例来源:origin: org.jruby/jruby-core
protected IRubyObject internalPutNoResize(final IRubyObject key, final IRubyObject value, final boolean checkForExisting) {
final int hash = hashValue(key);
final int i = bucketIndex(hash, table.length);
if (checkForExisting) {
for (RubyHashEntry entry = table[i]; entry != null; entry = entry.next) {
if (internalKeyExist(entry, hash, key)) {
IRubyObject existing = entry.value;
entry.value = value;
return existing;
}
}
}
checkIterating();
table[i] = new RubyHashEntry(hash, key, value, table[i], head);
size++;
// no existing entry
return null;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/** rb_hash_rehash
*
*/
@JRubyMethod(name = "rehash")
public RubyHash rehash() {
if (iteratorCount > 0) {
throw getRuntime().newRuntimeError("rehash during iteration");
}
modify();
final RubyHashEntry[] oldTable = table;
final RubyHashEntry[] newTable = new RubyHashEntry[oldTable.length];
for (int j = 0; j < oldTable.length; j++) {
RubyHashEntry entry = oldTable[j];
oldTable[j] = null;
while (entry != null) {
RubyHashEntry next = entry.next;
entry.hash = hashValue(entry.key.hashCode()); // update the hash value
int i = bucketIndex(entry.hash, newTable.length);
entry.next = newTable[i];
newTable[i] = entry;
entry = next;
}
}
table = newTable;
return this;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/** rb_hash_rehash
*
*/
@JRubyMethod(name = "rehash")
public RubyHash rehash() {
if (iteratorCount > 0) {
throw getRuntime().newRuntimeError("rehash during iteration");
}
modify();
final RubyHashEntry[] oldTable = table;
final RubyHashEntry[] newTable = new RubyHashEntry[oldTable.length];
for (int j = 0; j < oldTable.length; j++) {
RubyHashEntry entry = oldTable[j];
oldTable[j] = null;
while (entry != null) {
RubyHashEntry next = entry.next;
entry.hash = hashValue(entry.key.hashCode()); // update the hash value
int i = bucketIndex(entry.hash, newTable.length);
entry.next = newTable[i];
newTable[i] = entry;
entry = next;
}
}
table = newTable;
return this;
}
代码示例来源:origin: org.jruby/jruby-complete
while (entry != null) {
RubyHashEntry next = entry.next;
entry.hash = hashValue(entry.key); // update the hash value
int i = bucketIndex(entry.hash, newTable.length);
代码示例来源:origin: org.jruby/jruby-core
while (entry != null) {
RubyHashEntry next = entry.next;
entry.hash = hashValue(entry.key); // update the hash value
int i = bucketIndex(entry.hash, newTable.length);
内容来源于网络,如有侵权,请联系作者删除!