Examples of DTState


Examples of com.dtrules.session.DTState

     * Entity.  Otherwise create a new clone and return that.
     * @return
     */
    IREntity getInstance(IRSession s)throws RulesException{
        if(number.equals("1"))return entity;
        DTState state = s.getState();
        IRObject rarray = state.find(RName.getRName(name+"s"));
       
        IREntity newentity = (IREntity) entity.clone(s);
        if(rarray!=null && rarray.type().getId() ==IRObject.iArray){
           ((RArray)rarray).add(newentity);
           if (state.testState(DTState.TRACE)) {
               state.traceInfo("addto", "arrayId", ((RArray)rarray).getID() + "", newentity.postFix());
           }
        }
        return newentity;
    }
View Full Code Here

Examples of com.dtrules.session.DTState

   */
  public boolean setState(
      Trace     trace,
      TraceNode   position) throws RulesException {

    DTState ds = trace.session.getState();
   
    // Found our position.  We are Done!
    if(position == this) return true;
   
    // Keep track of where we actually execute a table.  This will happen even
    // if we don't actually end up executing a column.
    if(name.equals("execute_table")){
        trace.execute_table = this;
    }
    // We are an entitypush.  Find that entity and push it.
    if(name.equals("entitypush")){
      ds.entitypush(getEntity(trace));
    }
   
    // We are an entitypop.  Pop an entity!
    if(name.equals("entitypop")){
      ds.entitypop();
    }
   
    // If we are setting an attribute
    if(name.equals("def")){
            IRObject v;
      String   name = attributes.get("name");
     
      if(body.length()==0){
          v = RNull.getRNull();
      }else{
              trace.session.execute(body);
            v = ds.datapop();
      }

      IREntity    e    = getEntity(trace);
      RName       rn   = RName.getRName(name);
      e.put(trace.session, rn, v);
     
      Change c = new Change(e, rn, trace.execute_table);
     
      trace.changes.put(c, c);     // Keep a hash lookup of my change object.
     
    }
 
    // Creating an array
    if(name.equals("newarray")){
        int id = Integer.parseInt(attributes.get("arrayId"));
        if(!trace.arraytable.containsKey(id)){
            trace.arraytable.put(id, RArray.newArrayTraceInterface(id, true, false));
        }
    }

    // Adding to an array
    if(name.equals("addto")){
        int    id = Integer.parseInt(attributes.get("arrayId"));
            RArray ar = trace.arraytable.get(id);
            if(ar==null){   // Now this shouldn't happen, but if it does, create the array
                ar = RArray.newArrayTraceInterface(id, true, false);
                trace.arraytable.put(id, ar);
            }
            IRObject v;
           
            if(body.length()==0){
                v = RNull.getRNull();
            }else{
                trace.session.execute(body);
                v = ds.datapop();
            }

            ar.add(v);
    }
   
    // Remove a value from an array
    if(name.equals("remove")){
        int    id = Integer.parseInt(attributes.get("arrayId"));
            RArray ar = trace.arraytable.get(id);
            if(ar==null){   // Now this shouldn't happen, but if it does, create the array
                ar = RArray.newArrayTraceInterface(id, true, false);
                trace.arraytable.put(id, ar);
            }
            IRObject v;
           
            if(body.length()==0){
                v = RNull.getRNull();
            }else{
                trace.session.execute(body);
                v = ds.datapop();
            }
            ds.datapush(ar);
            ds.datapush(v);
            ds.getSession().execute("remove");
            ds.datapop();
    }
   
        // Remove a value from an array at a location
        if(name.equals("remove")){
            int    id = Integer.parseInt(attributes.get("arrayId"));
            RArray ar = trace.arraytable.get(id);
            if(ar==null){   // Now this shouldn't happen, but if it does, create the array
                ar = RArray.newArrayTraceInterface(id, true, false);
                trace.arraytable.put(id, ar);
            }
            trace.session.execute(body);
            IRObject i = ds.datapop();
           
            ds.datapush(ar);
            ds.datapush(i);
            ds.getSession().execute("removeat");
            ds.datapop();
        }
   
   
    for(TraceNode child : children){
      if(child.setState(trace, position)){
View Full Code Here

Examples of com.dtrules.session.DTState

     * Entity.  Otherwise create a new clone and return that.
     * @return
     */
    IREntity getInstance(IRSession s)throws RulesException{
        if(number.equals("1"))return entity;
        DTState state = s.getState();
        IRObject rarray = state.find(RName.getRName(name+"s"));
       
        IREntity newentity = (IREntity) entity.clone(s);
        if(rarray!=null && rarray.type().getId() ==IRObject.iArray){
           ((RArray)rarray).add(newentity);
        }
View Full Code Here

Examples of com.dtrules.session.DTState

              out        = new PrintStream     (getOutputDirectory()+number+root+"_results.xml");
              if(Trace()){
                  tracefile  = new FileOutputStream(getOutputDirectory()+number+root+"_trace.xml");
              }
              IRSession      session    = rs.newSession();
              DTState        state      = session.getState();
              state.setOutput(tracefile, out);
              if(Trace()){
                  state.setState(DTState.DEBUG | DTState.TRACE);
                  if(Verbose()){
                      state.setState(DTState.VERBOSE);
                  }
                  state.traceStart();
              }
              // Get the XML mapping for the rule set, and load a set of data into the EDD
                 
              loadData(session, path, dataset);
             
View Full Code Here

Examples of com.dtrules.session.DTState

              out        = new PrintStream     (getOutputDirectory()+number+root+"_results.xml");
              if(Trace()){
                  tracefile  = new FileOutputStream(getOutputDirectory()+number+root+"_trace.xml");
              }
              IRSession      session    = rs.newSession();
              DTState        state      = session.getState();
              state.setOutput(tracefile, out);
              if(Trace()){
                  state.setState(DTState.DEBUG | DTState.TRACE);
                  if(Verbose()){
                      state.setState(DTState.VERBOSE);
                  }
                  state.traceStart();
              }
              // Get the XML mapping for the rule set, and load a set of data into the EDD
                 
              loadData(session, path, dataset);
             
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.