Package com.dtrules.interpreter

Examples of com.dtrules.interpreter.RArray


    }

    public void arrayExecute(DTState state) throws RulesException {
      IRObject value = state.datapop();
      int position = state.datapop().intValue();
      RArray rarray = state.datapop().rArrayValue();
      if (state.testState(DTState.TRACE)) {
        state.traceInfo("addat", "arrayID", rarray.getID() + "",
            "index", position + "", value.postFix());
      }
      rarray.add(position, value);

    }
View Full Code Here


      super("remove");
    }

    public void arrayExecute(DTState state) throws RulesException {
      IRObject value = state.datapop();
      RArray rarray = (RArray) state.datapop();
      ArrayList<IRObject> array = rarray.arrayValue();
      boolean removed = false;
      if (value != null) {
        for (int i = 0; i < array.size();) {
          if (value.equals((IRObject) array.get(i))) {
            if (state.testState(DTState.TRACE)) {
              state.traceInfo("removed", "arrayID",
                  rarray.getID() + "", value.postFix());
            }
            array.remove(i);
            removed = true;
          } else {
            i++;
View Full Code Here

      super("removeat");
    }

    public void arrayExecute(DTState state) throws RulesException {
      int position = state.datapop().intValue();
      RArray rarray = (RArray) state.datapop();
      if (position >= rarray.size()) {
        state.datapush(RBoolean.getRBoolean(false));
      }

      ArrayList<IRObject> array = rarray.arrayValue();
      if (state.testState(DTState.TRACE)) {
        state.traceInfo("removed", "arrayID", rarray.getID() + "",
            "position", position + "", null);
      }

      array.remove(position);
      state.datapush(RBoolean.getRBoolean(true));
View Full Code Here

    Newarray() {
      super("newarray");
    }

    public void arrayExecute(DTState state) throws RulesException {
      IRObject irobject = new RArray(state.getSession().getUniqueID(),
          true, false);
      state.datapush(irobject);
    }
View Full Code Here

    Copyelements() {
      super("copyelements");
    }

    public void arrayExecute(DTState state) throws RulesException {
      RArray rarray = state.datapop().rArrayValue();
      RArray newRArray = rarray.clone(state.getSession()).rArrayValue();
      if (state.testState(DTState.TRACE)) {
        state.traceInfo("copyelements", "id", rarray.getID() + "",
            "newarrayid", newRArray.getID() + "", null);
        for (IRObject v : newRArray) {
          state.traceInfo("addto", "arrayID", rarray.getID() + "",
              v.postFix());
        }
      }
View Full Code Here

    DeepCopy() {
      super("deepcopy");
    }

    public void arrayExecute(DTState state) throws RulesException {
      RArray rarray = state.datapop().rArrayValue();
      RArray newRArray = rarray.deepCopy(state.getSession())
          .rArrayValue();

      if (state.testState(DTState.TRACE)) {
        state.traceInfo("copyelements", "id", rarray.getID() + "",
            "newarrayid", newRArray.getID() + "", null);
        for (IRObject v : newRArray) {
          state.traceInfo("addto", "arrayID", rarray.getID() + "",
              v.postFix());
        }
      }
View Full Code Here

    public void arrayExecute(DTState state) throws RulesException {
      boolean asc = state.datapop().booleanValue();
      int direction = asc ? 1 : -1;

      RArray rarray = state.datapop().rArrayValue();
      ArrayList<IRObject> array = rarray.arrayValue();

      if (state.testState(DTState.TRACE)) {
        state.traceInfo("sort", "length", array.size() + "", "arrayID",
            rarray.getID() + "", asc ? "true" : "false");
      }

      IRObject temp = null;
      int size = array.size();
      for (int i = 0; i < size - 1; i++) {
View Full Code Here

    }

    public void arrayExecute(DTState state) throws RulesException {
      boolean asc = state.datapop().booleanValue();
      RName rname = state.datapop().rNameValue();
      RArray rarray = state.datapop().rArrayValue();
      ArrayList<IRObject> array = rarray.arrayValue();
      if (state.testState(DTState.TRACE)) {
        state.traceInfo("sortentities", "length", array.size() + "",
            "by", rname.stringValue(), "arrayID", rarray.getID()
                + "", asc ? "true" : "false");
      }
      REntity temp = null;
      int size = array.size();
      int greaterthan = asc ? 1 : -1;
View Full Code Here

    }

    public void arrayExecute(DTState state) throws RulesException {

      IRObject value = state.datapop();
      RArray rArray = (RArray) state.datapop();
      for (IRObject v : rArray) {
        if (value.equals((IRObject) v)) {
          return;
        }
      }
      rArray.add(value);
      if (state.testState(DTState.TRACE)) {
        state.traceInfo("addto", "arrayId", rArray.getID() + "",
            value.postFix());
      }

    }
View Full Code Here

      ArrayList<IRObject> array2 = state.datapop().arrayValue();
      ArrayList<IRObject> array1 = state.datapop().arrayValue();
      ArrayList<IRObject> newarray = new ArrayList<IRObject>();
      newarray.addAll(array1);
      newarray.addAll(array2);
      state.datapush(new RArray(state.getSession().getUniqueID(), false,
          newarray, false));
    }
View Full Code Here

TOP

Related Classes of com.dtrules.interpreter.RArray

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.