Package com.dtrules.interpreter

Examples of com.dtrules.interpreter.RArray


      super("removeat");
    }

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

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

      array.remove(position);
      if (state.testState(DTState.TRACE)) {
                state.traceInfo("removedat", "arrayId",
                        rarray.getID() + "", position+"");
            }
      state.datapush(RBoolean.getRBoolean(true));
    }
View Full Code Here


    static class Forall extends ROperator {
        Forall(){super("forall");}

        public void execute(DTState state) throws RulesException {
           
            RArray   array = state.datapop().rArrayValue();
            IRObject body = state.datapop();        // Get the body
           
            for(IRObject o : array){
                 int      t = o.type();
                 if(t== iNull)continue;
View Full Code Here

     */
    static class For extends ROperator {
        For(){super("for");}

        public void execute(DTState state) throws RulesException {
            RArray   list = state.datapop().rArrayValue();
            IRObject body = state.datapop();        // Get the body
            for(IRObject o : list){
                 state.datapush(o);
                 body.execute(state);
            }
View Full Code Here

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

    public void execute(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 execute(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 execute(DTState state) throws RulesException {
      boolean asc = state.datapop().booleanValue();
      int direction = asc ? 1 : -1;

      RArray rarray = state.datapop().rArrayValue();
      List<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

     */
    static class Forfirst extends ROperator {
        Forfirst(){super("forfirst");}

        public void execute(DTState state) throws RulesException {
            RArray   array = state.datapop().rArrayValue();
            IRObject test  = state.datapop();
            IRObject body  = state.datapop();
            Iterator<REntity> ie = (Iterator<REntity>) array.getIterator();
            while(ie.hasNext()){
                state.entitypush(ie.next());
                test.execute(state);
                if(state.datapop().booleanValue()){
                    body.execute(state);
View Full Code Here

    }

    public void execute(DTState state) throws RulesException {
      boolean asc = state.datapop().booleanValue();
      RName rname = state.datapop().rNameValue();
      RArray rarray = state.datapop().rArrayValue();
      List<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

     */
    static class ForFirstElse extends ROperator {
        ForFirstElse(){super("forfirstelse");}

        public void execute(DTState state) throws RulesException {
            RArray   array = state.datapop().rArrayValue();
            IRObject test  = state.datapop();
            IRObject body2 = state.datapop();
            IRObject body1 = state.datapop();
            for(IRObject obj : array) {
                IREntity e = obj.rEntityValue();
View Full Code Here

    }

    public void execute(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

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.