@JRubyMethod(name = "==") public IRubyObject eq(ThreadContext context, IRubyObject other) { return this.toArray(context).op_equal(context, other); }
public static boolean BNE(ThreadContext context, IRubyObject value1, IRubyObject value2) { boolean eql = value2 == context.nil || value2 == UndefinedValue.UNDEFINED ? value1 == value2 : value1.op_equal(context, value2).isTrue(); return !eql; }
public static boolean BNE(ThreadContext context, IRubyObject value1, IRubyObject value2) { boolean eql = value2 == context.nil || value2 == UndefinedValue.UNDEFINED ? value1 == value2 : value1.op_equal(context, value2).isTrue(); return !eql; }
public static boolean BEQ(ThreadContext context, IRubyObject value1, IRubyObject value2) { return value1.op_equal(context, value2).isTrue(); }
public static boolean BEQ(ThreadContext context, IRubyObject value1, IRubyObject value2) { return value1.op_equal(context, value2).isTrue(); }
@JIT public static boolean BNE(ThreadContext context, IRubyObject value1, IRubyObject value2) { boolean eql = value2 == context.nil || value2 == UndefinedValue.UNDEFINED ? value1 == value2 : value1.op_equal(context, value2).isTrue(); return !eql; }
@JIT public static boolean BNE(ThreadContext context, IRubyObject value1, IRubyObject value2) { boolean eql = value2 == context.nil || value2 == UndefinedValue.UNDEFINED ? value1 == value2 : value1.op_equal(context, value2).isTrue(); return !eql; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof RandomType)) { return false; } RandomType rhs = (RandomType) obj; return seed.op_equal(seed.getRuntime().getCurrentContext(), rhs.seed).isTrue() && mt.equals(rhs.mt); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof RandomType)) { return false; } RandomType rhs = (RandomType) obj; return seed.op_equal(seed.getRuntime().getCurrentContext(), rhs.seed).isTrue() && mt.equals(rhs.mt); }
private IRubyObject stepCommon(ThreadContext context, IRubyObject to, IRubyObject step, boolean desc, Block block) { Ruby runtime = context.runtime; boolean inf; if (step.op_equal(context, RubyFixnum.zero(runtime)).isTrue()) { inf = true; } else if (to instanceof RubyFloat) { double f = ((RubyFloat) to).getDoubleValue(); inf = Double.isInfinite(f) && (f <= -0.0 ? desc : !desc); } else { inf = false; } if (this instanceof RubyFixnum && (inf || to instanceof RubyFixnum) && step instanceof RubyFixnum) { fixnumStep(context, runtime, (RubyFixnum) this, to, (RubyFixnum) step, inf, desc, block); } else if (this instanceof RubyFloat || to instanceof RubyFloat || step instanceof RubyFloat) { floatStep(context, runtime, this, to, step, false, block); } else { duckStep(context, this, to, step, inf, desc, block); } return this; }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currDynScope, temp); Object value2 = getArg2().retrieve(context, self, currDynScope, temp); return ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue() ? getJumpTarget().getTargetPC() : ipc; }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currDynScope, temp); Object value2 = getArg2().retrieve(context, self, currDynScope, temp); return ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue() ? getJumpTarget().getTargetPC() : ipc; }
private RubyString getCorrectKey(IRubyObject key, ThreadContext context) { RubyString originalKey = key.convertToString(); RubyString actualKey = originalKey; Ruby runtime = context.runtime; if (Platform.IS_WINDOWS) { // this is a rather ugly hack, but similar to MRI. See hash.c:ruby_setenv and similar in MRI // we search all keys for a case-insensitive match, and use that RubyArray keys = super.keys(); for (int i = 0; i < keys.size(); i++) { RubyString candidateKey = keys.eltInternal(i).convertToString(); if (candidateKey.casecmp(context, originalKey).op_equal(context, RubyFixnum.zero(runtime)).isTrue()) { actualKey = candidateKey; break; } } } return actualKey; }
private RubyString getCorrectKey(IRubyObject key, ThreadContext context) { RubyString originalKey = key.convertToString(); RubyString actualKey = originalKey; Ruby runtime = context.runtime; if (Platform.IS_WINDOWS) { // this is a rather ugly hack, but similar to MRI. See hash.c:ruby_setenv and similar in MRI // we search all keys for a case-insensitive match, and use that RubyArray keys = super.keys(); for (int i = 0; i < keys.size(); i++) { RubyString candidateKey = keys.eltInternal(i).convertToString(); if (candidateKey.casecmp(context, originalKey).op_equal(context, RubyFixnum.zero(runtime)).isTrue()) { actualKey = candidateKey; break; } } } return actualKey; }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); Object value2 = getArg2().retrieve(context, self, currScope, currDynScope, temp); boolean eql = getArg2() == context.getRuntime().getIRManager().getNil() || getArg2() == UndefinedValue.UNDEFINED ? value1 == value2 : ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue(); return !eql ? getJumpTarget().getTargetPC() : ipc; }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, StaticScope currScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currScope, currDynScope, temp); Object value2 = getArg2().retrieve(context, self, currScope, currDynScope, temp); boolean eql = getArg2() == context.getRuntime().getIRManager().getNil() || getArg2() == UndefinedValue.UNDEFINED ? value1 == value2 : ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue(); return !eql ? getJumpTarget().getTargetPC() : ipc; }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currDynScope, temp); Object value2 = getArg2().retrieve(context, self, currDynScope, temp); boolean eql = getArg2() == context.getRuntime().getIRManager().getNil() || getArg2() == UndefinedValue.UNDEFINED ? value1 == value2 : ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue(); return !eql ? getJumpTarget().getTargetPC() : ipc; }
@Override public int interpretAndGetNewIPC(ThreadContext context, DynamicScope currDynScope, IRubyObject self, Object[] temp, int ipc) { Object value1 = getArg1().retrieve(context, self, currDynScope, temp); Object value2 = getArg2().retrieve(context, self, currDynScope, temp); boolean eql = getArg2() == context.getRuntime().getIRManager().getNil() || getArg2() == UndefinedValue.UNDEFINED ? value1 == value2 : ((IRubyObject) value1).op_equal(context, (IRubyObject)value2).isTrue(); return !eql ? getJumpTarget().getTargetPC() : ipc; }
@JRubyMethod(name = "new", optional = 7, meta = true, compat = RUBY1_9) public static IRubyObject new19(ThreadContext context, IRubyObject recv, IRubyObject[] args) { if (args.length == 0) return newInstance(context, recv); if (args.length == 7) { Ruby runtime = context.getRuntime(); // 7th argument can be the symbol :dst instead of an offset, so needs to be special cased final RubySymbol dstSymbol = RubySymbol.newSymbol(runtime, "dst"); boolean receivedDstSymbolAsArgument = (args[6].op_equal(context, dstSymbol)).isTrue(); final RubyBoolean isDst = RubyBoolean.newBoolean(runtime, receivedDstSymbolAsArgument); // Convert the 7-argument form of Time.new into the 10-argument form of Time.local: args = new IRubyObject[] { args[5], // seconds args[4], // minutes args[3], // hours args[2], // day args[1], // month args[0], // year runtime.getNil(), // weekday runtime.getNil(), // day of year isDst, // is DST? args[6] }; // UTC offset } return createTime(recv, args, false); }
@JRubyMethod(name = "new", optional = 7, meta = true, compat = RUBY1_9) public static IRubyObject new19(ThreadContext context, IRubyObject recv, IRubyObject[] args) { if (args.length == 0) return newInstance(context, recv); if (args.length == 7) { Ruby runtime = context.getRuntime(); // 7th argument can be the symbol :dst instead of an offset, so needs to be special cased final RubySymbol dstSymbol = RubySymbol.newSymbol(runtime, "dst"); boolean receivedDstSymbolAsArgument = (args[6].op_equal(context, dstSymbol)).isTrue(); final RubyBoolean isDst = RubyBoolean.newBoolean(runtime, receivedDstSymbolAsArgument); // Convert the 7-argument form of Time.new into the 10-argument form of Time.local: args = new IRubyObject[] { args[5], // seconds args[4], // minutes args[3], // hours args[2], // day args[1], // month args[0], // year runtime.getNil(), // weekday runtime.getNil(), // day of year isDst, // is DST? args[6] }; // UTC offset } return createTime(recv, args, false); }