Examples of RubyHash


Examples of org.jruby.RubyHash

            case ClassIndex.FLOAT:
                write('f');
                RubyFloat.marshalTo((RubyFloat)value, this);
                return;
            case ClassIndex.HASH: {
                RubyHash hash = (RubyHash)value;

                if(hash.getIfNone().isNil()){
                    write('{');
                }else if (hash.hasDefaultProc()) {
                    throw hash.getRuntime().newTypeError("can't dump hash with default proc");
                } else {
                    write('}');
                }

                RubyHash.marshalTo(hash, this);
View Full Code Here

Examples of org.jruby.RubyHash

      titles = JavaHelper.numAry(-1, 100);
      titles[0] = "Player";
      titles[1] = "This Event";
    } else {
      // get all events
      RubyHash ra = (RubyHash) map.getInstanceVariable("@events");

      // convert code
      ArrayList<String> ids = new ArrayList<String>();
      ArrayList<Long> ls = new ArrayList<Long>();
      ids.add("Player");
      ls.add(-1l);
      ids.add("This Event");
      ls.add(0l);

      for (Object s : ra.keySet()) {
        ls.add((Long) s);
        ids.add(new SystemGObject((RubyObject) ra.get(s)).getName());
      }

      // convert
      titles = new String[ids.size()];
      values = new String[ids.size()];
View Full Code Here

Examples of org.jruby.RubyHash

          .getInstanceVariable("@height").toJava(Integer.class) * TILED, BufferedImage.TYPE_4BYTE_ABGR);

      Image eventRaw = IconCache.getImage("event", TILED);

      // paint events
      RubyHash events = (RubyHash) map.getInstanceVariable("@events");
      for (Object id : events.keySet()) {
        // load event
        RubyObject event = (RubyObject) events.get(id);
        int x = (Integer) event.getInstanceVariable("@x").toJava(Integer.class);
        int y = (Integer) event.getInstanceVariable("@y").toJava(Integer.class);
        // get first page for image
        RubyObject page = (RubyObject) ((RubyArray) event.getInstanceVariable("@pages")).get(0);
        // get image
View Full Code Here

Examples of org.jruby.RubyHash

      if (EventsEditorTab.ID.equals(id)) {
        return new EventsEditorTab(p, map);
      }
      if (EventTab.ID.equals(id)) {
        // search for event
        RubyHash events = (RubyHash) map.getInstanceVariable("@events");
        int eid = Integer.valueOf(parameters.get("event"));

        for (Object key : events.keySet()) {
          // load event
          RubyObject event = (RubyObject) events.get(key);
          // right id?
          if (RubyHelper.toInt(event.getInstanceVariable("@id")) == eid) {
            return new EventTab(p, map, event);
          }
        }
View Full Code Here

Examples of org.jruby.RubyHash

    try {

      // load events
      events = new HashMap<String, RubyObject>();
      RubyHash events = (RubyHash) map.getInstanceVariable("@events");

      for (Object id : events.keySet()) {
        // load event
        RubyObject event = (RubyObject) events.get(id);
        this.events
            .put(event.getInstanceVariable("@x").toJava(Integer.class) + "x"
                + event.getInstanceVariable("@y").toJava(Integer.class), event);
      }
View Full Code Here

Examples of org.jruby.RubyHash

    // 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

Examples of org.jruby.RubyHash

    EventsEditorTab.buildMapBcB(bcb, project, act);

    bcb.addSeperator();

    // add all events
    RubyHash ra = (RubyHash) map.getInstanceVariable("@events");

    // convert code
    ArrayList<SystemGObject> elements = new ArrayList<SystemGObject>();
    for (Object s : ra.keySet()) {
      Long l = (Long) s;
      elements.add(new SystemGObject((RubyObject) ra.get(l)));
    }

    int act2 = RubyHelper.toInt(event.getInstanceVariable("@id"));

    for (int i = 1, l = elements.size(); i < l; i++) {
View Full Code Here

Examples of org.jruby.RubyHash

      // save
      project.getCache().put(id, list);

      return list;
    } else if (type == Type.MAP) {
      final RubyHash r = (RubyHash) RGSS1Load.loadFile(project, new File(RGSS1Load.getDataFile(project), "MapInfos.rxdata"));
      Set<?> set = r.keySet();

      int max = 0;

      HashMap<Integer, RubyObject> o = new HashMap<Integer, RubyObject>();
      o.put(0, null);

      // build the list
      for (Object i : set) {
        int roid = Integer.valueOf(i.toString());
        o.put(roid, (RubyObject) RGSS1Load.loadFile(project, RGSS1Load.getMapFile(project, roid)));
        o.get(roid).setInstanceVariable("@id", RubyFixnum.newFixnum(o.get(roid).getRuntime(), roid));
        o.get(roid).setInstanceVariable("@name", ((RubyObject) r.get(roid)).getInstanceVariable("@name"));

        // search for the hightes id
        if (roid > max) {
          max = roid;
        }
      }

      // build the list
      ArrayList<SystemGObject> ro = new ArrayList<SystemGObject>();
      for (int i = 0; i <= max; i++) {
        // add it
        if (o.containsKey(i)) {
          ro.add(new SystemGObject(o.get(i)));
        } else {
          // build filler
          RubyObject no = (RubyObject) RGSSProjectHelper.getInterpreter(project).runScriptlet("return RPG::Map.new(20,15)");
          no.setInstanceVariable("@name", RubyString.newString(r.getRuntime(), "Fill " + i));
          no.setInstanceVariable("@id", RubyFixnum.newFixnum(o.get(i).getRuntime(), i));

          // add filler
          ro.add(new SystemGObject(no));
        }
View Full Code Here

Examples of org.jruby.RubyHash

      // get MapInfo
      File file = new File(RGSS1Load.getDataFile(project), "MapInfos.rxdata");

      // get it
      RubyHash mapinfos = (RubyHash) RGSS1Load.loadFile(project, file);

      // run over all
      HashMap<Integer, Boolean> idCache = new HashMap<Integer, Boolean>();

      // update elements & add missings
      for (int i = 1, l = aro.size(); i < l; i++) {
        mapinfos.put(aro.get(i).getObject().getInstanceVariable("@id"), aro.get(i).getObject());
        idCache.put((Integer) aro.get(i).getObject().getInstanceVariable("@id").toJava(Integer.class), true);
      }

      // 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));
        }
      }

      // save it
      RGSS1Load.saveFile(project, file, mapinfos);
View Full Code Here

Examples of org.jruby.RubyHash

        } catch (Exception e) {
            // skip this one, probably no 'ls' (windows)
        }
    }
    public void testUsesRubyEnvPathToRunShellPrograms() {
        RubyHash env = (RubyHash) runtime.getObject().fastGetConstant("ENV");
        RubyString path = runtime.newString("PATH");
        RubyString utilPath = runtime.newString(System.getProperty("jruby.home") + "/test/org/jruby/util");
        ThreadContext context = runtime.getCurrentContext();
        env.op_aset(context, path,
                env.op_aref(context, path).convertToString()
                .op_plus(context, runtime.newString(File.pathSeparator)).convertToString()
                .op_plus(context, utilPath));

        String cmd = "shell_launcher_test";
        if (Platform.IS_WINDOWS) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.