Tabnine Logo
RubyBignum.coerceCmp
Code IndexAdd Tabnine to your IDE (free)

How to use
coerceCmp
method
in
org.jruby.RubyBignum

Best Java code snippets using org.jruby.RubyBignum.coerceCmp (Showing top 8 results out of 315)

origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@Override
public final int compareTo(IRubyObject other) {
  if (other instanceof RubyBignum) {
    return value.compareTo(((RubyBignum)other).value);
  }
  return (int)coerceCmp(getRuntime().getCurrentContext(), "<=>", other).convertToInteger().getLongValue();
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

@Override
public final int compareTo(IRubyObject other) {
  if (other instanceof RubyBignum) {
    return value.compareTo(((RubyBignum)other).value);
  }
  return (int)coerceCmp(getRuntime().getCurrentContext(), "<=>", other).convertToInteger().getLongValue();
}
origin: org.jruby/jruby-complete

@Override
public final int compareTo(IRubyObject other) {
  if (other instanceof RubyBignum) {
    return value.compareTo(((RubyBignum)other).value);
  }
  ThreadContext context = getRuntime().getCurrentContext();
  return (int)coerceCmp(context, sites(context).op_cmp, other).convertToInteger().getLongValue();
}
origin: org.jruby/jruby-core

@Override
public final int compareTo(IRubyObject other) {
  if (other instanceof RubyBignum) {
    return value.compareTo(((RubyBignum)other).value);
  }
  ThreadContext context = getRuntime().getCurrentContext();
  return (int)coerceCmp(context, sites(context).op_cmp, other).convertToInteger().getLongValue();
}
origin: org.jruby/jruby-complete

/** rb_big_cmp
 *
 */
@Override
public IRubyObject op_cmp(ThreadContext context, IRubyObject other) {
  final BigInteger otherValue;
  if (other instanceof RubyFixnum) {
    otherValue = fix2big((RubyFixnum) other);
  } else if (other instanceof RubyBignum) {
    otherValue = ((RubyBignum) other).value;
  } else if (other instanceof RubyFloat) {
    RubyFloat flt = (RubyFloat)other;
    if (flt.infinite_p().isTrue()) {
      if (flt.getDoubleValue() > 0.0) return RubyFixnum.minus_one(context.runtime);
      return RubyFixnum.one(context.runtime);
    }
    return dbl_cmp(context.runtime, big2dbl(this), flt.getDoubleValue());
  } else {
    return coerceCmp(context, sites(context).op_cmp, other);
  }
  // wow, the only time we can use the java protocol ;)
  return RubyFixnum.newFixnum(context.runtime, value.compareTo(otherValue));
}
origin: org.jruby/jruby-core

/** rb_big_cmp
 *
 */
@Override
public IRubyObject op_cmp(ThreadContext context, IRubyObject other) {
  final BigInteger otherValue;
  if (other instanceof RubyFixnum) {
    otherValue = fix2big((RubyFixnum) other);
  } else if (other instanceof RubyBignum) {
    otherValue = ((RubyBignum) other).value;
  } else if (other instanceof RubyFloat) {
    RubyFloat flt = (RubyFloat)other;
    if (flt.infinite_p().isTrue()) {
      if (flt.getDoubleValue() > 0.0) return RubyFixnum.minus_one(context.runtime);
      return RubyFixnum.one(context.runtime);
    }
    return dbl_cmp(context.runtime, big2dbl(this), flt.getDoubleValue());
  } else {
    return coerceCmp(context, sites(context).op_cmp, other);
  }
  // wow, the only time we can use the java protocol ;)
  return RubyFixnum.newFixnum(context.runtime, value.compareTo(otherValue));
}
origin: com.ning.billing/killbill-osgi-bundles-jruby

/** rb_big_cmp
 *
 */
@JRubyMethod(name = "<=>", required = 1)
public IRubyObject op_cmp(ThreadContext context, IRubyObject other) {
  final BigInteger otherValue;
  if (other instanceof RubyFixnum) {
    otherValue = fix2big((RubyFixnum) other);
  } else if (other instanceof RubyBignum) {
    otherValue = ((RubyBignum) other).value;
  } else if (other instanceof RubyFloat) {
    RubyFloat flt = (RubyFloat)other;
    if (flt.infinite_p().isTrue()) {
      if (flt.getDoubleValue() > 0.0) return RubyFixnum.minus_one(getRuntime());
      return RubyFixnum.one(getRuntime());
    }
    return dbl_cmp(getRuntime(), big2dbl(this), flt.getDoubleValue());
  } else {
    return coerceCmp(context, "<=>", other);
  }
  // wow, the only time we can use the java protocol ;)
  return RubyFixnum.newFixnum(getRuntime(), value.compareTo(otherValue));
}
origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

/** rb_big_cmp
 *
 */
@JRubyMethod(name = "<=>", required = 1)
public IRubyObject op_cmp(ThreadContext context, IRubyObject other) {
  final BigInteger otherValue;
  if (other instanceof RubyFixnum) {
    otherValue = fix2big((RubyFixnum) other);
  } else if (other instanceof RubyBignum) {
    otherValue = ((RubyBignum) other).value;
  } else if (other instanceof RubyFloat) {
    RubyFloat flt = (RubyFloat)other;
    if (flt.infinite_p().isTrue()) {
      if (flt.getDoubleValue() > 0.0) return RubyFixnum.minus_one(getRuntime());
      return RubyFixnum.one(getRuntime());
    }
    return dbl_cmp(getRuntime(), big2dbl(this), flt.getDoubleValue());
  } else {
    return coerceCmp(context, "<=>", other);
  }
  // wow, the only time we can use the java protocol ;)
  return RubyFixnum.newFixnum(getRuntime(), value.compareTo(otherValue));
}
org.jrubyRubyBignumcoerceCmp

Popular methods of RubyBignum

  • newBignum
  • getLongValue
  • getValue
    Getter for property value.
  • <init>
  • addFloat
  • addOther
  • big2dbl
    rb_big2dbl
  • big2long
    rb_big2long
  • bignorm
    rb_big_norm
  • checkShiftDown
  • coerceBin
  • compareTo
  • coerceBin,
  • compareTo,
  • convertToDouble,
  • createBignumClass,
  • dbl_cmp,
  • divmod,
  • even_p,
  • fix2big,
  • getBigIntegerValue

Popular in Java

  • Making http post requests using okhttp
  • setRequestProperty (URLConnection)
  • addToBackStack (FragmentTransaction)
  • getSharedPreferences (Context)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JFileChooser (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now