Package org.jruby

Examples of org.jruby.RubyNumeric$ByteListCaller19


           if (rubyObject instanceof RubyBignum) {
             return ((RubyBignum)rubyObject).getValue();
           } else if (rubyObject instanceof RubyNumeric) {
         return  BigInteger.valueOf (((RubyNumeric)rubyObject).getLongValue());
           } else if (rubyObject.respondsTo("to_i")) {
             RubyNumeric rubyNumeric = ((RubyNumeric)rubyObject.callMethod(context, "to_f"));
         return  BigInteger.valueOf (rubyNumeric.getLongValue());
           }
        } else if (javaClass == BigDecimal.class && !(rubyObject instanceof JavaObject)) {
           if (rubyObject.respondsTo("to_f")) {
               double double_value = ((RubyNumeric)rubyObject.callMethod(context, "to_f")).getDoubleValue();
               return new BigDecimal(double_value);
View Full Code Here


   * @return the returncode of the command
   */
  public int execute(String command, boolean sudo) {
    try {
      if (sudo) {
        RubyNumeric number = (RubyNumeric) vagrantSSH.callMethod(
            "sudo",
            RubyString.newString(vagrantSSH.getRuntime(), command));
        return (int) number.getLongValue();
      } else {
        RubyNumeric number = (RubyNumeric) vagrantSSH.callMethod(
            "execute",
            RubyString.newString(vagrantSSH.getRuntime(), command));
        return (int) number.getLongValue();
      }
    } catch (RaiseException exception) {
      throw new VagrantException(exception);
    }
  }
View Full Code Here

                if (!(current instanceof RubyNumeric)) {
                    // old value is not numeric, CAS fails
                    return runtime.getFalse();
                }

                RubyNumeric currentNumber = (RubyNumeric)current;
                if (!currentNumber.equals(expectedValue)) {
                    // current number does not equal expected, fail CAS
                    return runtime.getFalse();
                }

                // check that current has not changed, or else allow loop to repeat
View Full Code Here

           if (rubyObject instanceof RubyBignum) {
             return ((RubyBignum)rubyObject).getValue();
           } else if (rubyObject instanceof RubyNumeric) {
         return  BigInteger.valueOf (((RubyNumeric)rubyObject).getLongValue());
           } else if (rubyObject.respondsTo("to_i")) {
             RubyNumeric rubyNumeric = ((RubyNumeric)rubyObject.callMethod(context, "to_f"));
         return  BigInteger.valueOf (rubyNumeric.getLongValue());
           }
        } else if (javaClass == BigDecimal.class && !(rubyObject instanceof JavaObject)) {
           if (rubyObject.respondsTo("to_f")) {
               double double_value = ((RubyNumeric)rubyObject.callMethod(context, "to_f")).getDoubleValue();
               return new BigDecimal(double_value);
View Full Code Here

           if (rubyObject instanceof RubyBignum) {
             return ((RubyBignum)rubyObject).getValue();
           } else if (rubyObject instanceof RubyNumeric) {
         return  BigInteger.valueOf (((RubyNumeric)rubyObject).getLongValue());
           } else if (rubyObject.respondsTo("to_i")) {
             RubyNumeric rubyNumeric = ((RubyNumeric)rubyObject.callMethod(context, "to_f"));
         return  BigInteger.valueOf (rubyNumeric.getLongValue());
           }
        } else if (javaClass == BigDecimal.class && !(rubyObject instanceof JavaObject)) {
           if (rubyObject.respondsTo("to_f")) {
               double double_value = ((RubyNumeric)rubyObject.callMethod(context, "to_f")).getDoubleValue();
               return new BigDecimal(double_value);
View Full Code Here

           if (rubyObject instanceof RubyBignum) {
             return ((RubyBignum)rubyObject).getValue();
           } else if (rubyObject instanceof RubyNumeric) {
         return  BigInteger.valueOf (((RubyNumeric)rubyObject).getLongValue());
           } else if (rubyObject.respondsTo("to_i")) {
             RubyNumeric rubyNumeric = ((RubyNumeric)rubyObject.callMethod(context, "to_f"));
         return  BigInteger.valueOf (rubyNumeric.getLongValue());
           }
        } else if (javaClass == BigDecimal.class && !(rubyObject instanceof JavaObject)) {
           if (rubyObject.respondsTo("to_f")) {
               double double_value = ((RubyNumeric)rubyObject.callMethod(context, "to_f")).getDoubleValue();
               return new BigDecimal(double_value);
View Full Code Here

                if (!(current instanceof RubyNumeric)) {
                    // old value is not numeric, CAS fails
                    return runtime.getFalse();
                }

                RubyNumeric currentNumber = (RubyNumeric)current;
                if (!currentNumber.equals(expectedValue)) {
                    // current number does not equal expected, fail CAS
                    return runtime.getFalse();
                }

                // check that current has not changed, or else allow loop to repeat
View Full Code Here

TOP

Related Classes of org.jruby.RubyNumeric$ByteListCaller19

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.