Package org.jruby

Examples of org.jruby.RubyFixnum


        indent = code.getIndent();
        nid = id2;
      }

      // update indent
      obj.setInstanceVariable("@indent", new RubyFixnum(code.getObject().getRuntime(), indent));

      // update id
      obj.setInstanceVariable("@code", new RubyFixnum(code.getObject().getRuntime(), nid));

      // set parameter
      RubyArray r = (RubyArray) code.getObject().getInstanceVariable("@parameters");
      r.rb_clear();
      r.add(code.getParameters().get(i));
View Full Code Here


    // create new class
    events.put(key, r);

    // add it in the map
    RubyHash event = (RubyHash) map.getInstanceVariable("@events");
    event.put(new RubyFixnum(map.getRuntime(), id), events.get(key));

    // redraw
    view.recreateEventImage();
    updateLeftPanel();
  }
View Full Code Here

      }

      // remove unused
      for (int i = 1, l = aro.size(); i < l; i++) {
        int nid = (Integer) aro.get(i).getObject().getInstanceVariable("@id").toJava(Integer.class);
        RubyFixnum rid = (RubyFixnum) aro.get(i).getObject().getInstanceVariable("@id");
        if (mapinfos.containsKey(rid) && !idCache.containsKey(nid)) {
          mapinfos.remove(mapinfos.get(rid));
        }
      }
View Full Code Here

  public void add() {
    // ask the tab
    RubyObject o = tab.createObject();

    // set id
    o.setInstanceVariable("@id", new RubyFixnum(o.getRuntime(), tab.getElements().size()));

    // add it
    tab.getElements().add(new SystemGObject(o));
    tab.getElements().get(tab.getElements().size() - 1).setModified(true);
    add(tab.getElements().size() - 1);
View Full Code Here

    public void testExit() throws Exception {
        verifyExit(RubyFixnum.zero(runtime),   "true");
        verifyExit(RubyFixnum.one(runtime),    "false");
        verifyExit(RubyFixnum.zero(runtime),    "");
        verifyExit(RubyFixnum.zero(runtime),    "0.1");
        verifyExit(new RubyFixnum(runtime, 7), "7");
    }
View Full Code Here

    }
   
    public static void benchFixnumFib(int n) {
        long start = System.currentTimeMillis();
        ThreadContext context = ruby.getCurrentContext();
        RubyFixnum result = boxedFib(context, RubyFixnum.newFixnum(ruby, n));
        System.out.println("Took " + (System.currentTimeMillis() - start) + "ms for boxedFib(" + n + ") = " + result);
    }
View Full Code Here

        RubyProc p = RubyProc.newProc(runtime, block, block.type);
        return p;
    }

    public static long ll2inum(Ruby runtime, long l) {
        RubyFixnum n = RubyFixnum.newFixnum(runtime, l);
        Handle h = GC.lookup(n);
        if (h != null) {
            return h.getAddress();
        }
        h = Handle.newHandle(runtime, n, Native.getInstance(runtime).newFixnumHandle(n, l));
View Full Code Here

        IRubyObject a, b, p, q;
        a = ary[0];
        b = ary[1];
        IRubyObject c, k, t, p0, p1, p2, q0, q1, q2;

        RubyFixnum zero = RubyFixnum.zero(context.getRuntime());
        RubyFixnum one = RubyFixnum.one(context.getRuntime());

        p0 = q1 = zero;
        p1 = q0 = one;

        while (true) {
View Full Code Here

    public final Encoding getEncoding(int index) {
        return encodings[index];
    }

    public final RubyFixnum getFixnum(Ruby runtime, int index, int value) {
        RubyFixnum fixnum = fixnums[index];
        if (fixnum == null) {
            return fixnums[index] = RubyFixnum.newFixnum(runtime, value);
        }
        return fixnum;
    }
View Full Code Here

        }
        return fixnum;
    }

    public final RubyFixnum getFixnum(Ruby runtime, int index, long value) {
        RubyFixnum fixnum = fixnums[index];
        if (fixnum == null) {
            return fixnums[index] = RubyFixnum.newFixnum(runtime, value);
        }
        return fixnum;
    }
View Full Code Here

TOP

Related Classes of org.jruby.RubyFixnum

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.