本文整理了Java中org.jruby.RubyHash.op_equal
方法的一些代码示例,展示了RubyHash.op_equal
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyHash.op_equal
方法的具体详情如下:
包路径:org.jruby.RubyHash
类名称:RubyHash
方法名:op_equal
[英]rb_hash_equal
[中]rb_hash_equal
代码示例来源:origin: bazelbuild/bazel
@JRubyMethod(name = "==")
public IRubyObject eq(ThreadContext context, IRubyObject _other) {
if (_other instanceof RubyHash)
return toHash(context).op_equal(context, _other);
RubyMap other = (RubyMap) _other;
if (this == other) return context.runtime.getTrue();
if (!typeCompatible(other) || this.table.size() != other.table.size())
return context.runtime.getFalse();
for (IRubyObject key : table.keySet()) {
if (! other.table.containsKey(key))
return context.runtime.getFalse();
if (! other.table.get(key).equals(table.get(key)))
return context.runtime.getFalse();
}
return context.runtime.getTrue();
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public boolean equals(Object other) {
if (!(other instanceof RubyHash)) return false;
if (this == other) return true;
return op_equal(getRuntime().getCurrentContext(), (RubyHash)other).isTrue();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Override
public boolean equals(Object other) {
if (!(other instanceof RubyHash)) return false;
if (this == other) return true;
return op_equal(getRuntime().getCurrentContext(), (RubyHash)other).isTrue() ? true : false;
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public boolean equals(Object other) {
if (!(other instanceof RubyHash)) return false;
if (this == other) return true;
return op_equal(getRuntime().getCurrentContext(), (RubyHash)other).isTrue();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Override
public boolean equals(Object other) {
if (!(other instanceof RubyHash)) return false;
if (this == other) return true;
return op_equal(getRuntime().getCurrentContext(), (RubyHash)other).isTrue() ? true : false;
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
@JRubyMethod(name = "==")
public IRubyObject op_equal(ThreadContext context, IRubyObject other) {
if ( this == other ) return context.tru;
if ( getMetaClass().isInstance(other) ) {
return this.hash.op_equal(context, ((RubySet) other).hash); // @hash == ...
}
if ( other instanceof RubySet ) {
RubySet that = (RubySet) other;
if ( this.size() == that.size() ) { // && includes all of our elements :
for ( IRubyObject obj : elementsOrdered() ) {
if ( ! that.containsImpl(obj) ) return context.fals;
}
return context.tru;
}
}
return context.fals;
}
代码示例来源:origin: org.jruby/jruby-core
@Override
@JRubyMethod(name = "==")
public IRubyObject op_equal(ThreadContext context, IRubyObject other) {
if ( this == other ) return context.tru;
if ( getMetaClass().isInstance(other) ) {
return this.hash.op_equal(context, ((RubySet) other).hash); // @hash == ...
}
if ( other instanceof RubySet ) {
RubySet that = (RubySet) other;
if ( this.size() == that.size() ) { // && includes all of our elements :
for ( IRubyObject obj : elementsOrdered() ) {
if ( ! that.containsImpl(obj) ) return context.fals;
}
return context.tru;
}
}
return context.fals;
}
内容来源于网络,如有侵权,请联系作者删除!