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() ==IRObject.iArray){
           ((RArray)rarray).add(newentity);
        }
View Full Code Here

Examples of com.dtrules.session.DTState

              out        = new PrintStream     (getOutputDirectory()+root+"_results.xml");
              if(Trace()){
                tracefile  = new FileOutputStream(getOutputDirectory()+root+"_trace.xml");
              }
              IRSession      session    = rs.newSession();
              DTState        state      = session.getState();
              state.setOutput(tracefile, out);
              if(Trace()){
                  state.setState(DTState.DEBUG | DTState.TRACE | 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

       
    public static void main(String args[]){
       
        String          file    = "c:\\eclipse\\workspace\\DTRules\\com.dtrules.testfiles\\DTRules.xml";
        IRSession       session;
        DTState         state;
        RulesDirectory  rd;
        RuleSet         rs;
       
        try {
            rd      = new RulesDirectory("",file);
            rs      = rd.getRuleSet(RName.getRName("test",true));
            session = rs.newSession();
            state   = session.getState();
        } catch (RulesException e1) {
            System.out.println("Failed to initialize the Rules Engine");
            return;
        }
       
        for(int i=0;i<tests.length;i+=2){
            try{
               session.execute(tests[i]);
               String result = state.datapop().stringValue();
               if(tests[i+1].equals(result.trim())){
                   state.debug("test: << "+tests[i]+" >> expected: "+tests[i+1]+" --passed\n");
               }else{
                   state.debug("test: << "+tests[i]+" >> expected: "+tests[i+1]+" result:"+result+" --FAILED\n");
               }
               state.debug("\n");
            }catch(Exception e){
               state.error(" Exception Thrown:\n");
               state.error("test: "+tests[i]+"expected: "+tests[i+1]+" result: Exception thrown --FAILED\n");
               state.error(e+"\n");
            }
        }   
      }
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() ==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

   */
  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;
   
    // 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")){
      trace.session.execute(body);
      String     name = attributes.get("name");
      IRObject   v   = ds.datapop();
      IREntity    e    = getEntity(trace);
      e.put(trace.session, RName.getRName(name), v);
    }
 
    for(TraceNode child : children){
View Full Code Here

Examples of com.dtrules.session.DTState

     * @throws RulesException
     */
    public static void printReport(IRSession session, PrintStream _out) throws RulesException {
        XMLPrinter xout = new XMLPrinter(_out);    // Get an instance of the XML Formatter.
       
        DTState state   = session.getState();    // Get all the state information from our
                                //   Session.
       
        IREntity job     = state.findEntity("job"); // Get the Job Entity from the Entity Stack
       
        RArray   results = job.get("job.results").rArrayValue(); // Get the Rules Engine list
                              //   of result Entities
                             
        for(IRObject r :results){          // For each result entity
View Full Code Here

Examples of com.dtrules.session.DTState

     * @throws RulesException
     */
    public static void printReport(IRSession session, PrintStream _out) throws RulesException {
        XMLPrinter xout = new XMLPrinter(_out);    // Get an instance of the XML Formatter.
       
        DTState state   = session.getState();    // Get all the state information from our
                                //   Session.
       
        IREntity job     = state.findEntity("job"); // Get the Job Entity from the Entity Stack
       
        RArray   results = job.get("job.results").rArrayValue(); // Get the Rules Engine list
                              //   of result Entities
                             
        for(IRObject r :results){          // For each result entity
View Full Code Here

Examples of com.dtrules.session.DTState

       
        try {
            RulesDirectory rd       = new RulesDirectory(path,file);
            RuleSet        rs       = rd.getRuleSet(RName.getRName("ebdemo"));
            IRSession      session  = rs.newSession();
            DTState        state    = session.getState();
            DecisionTableTypeTest test;
           
            test = new DecisionTableTypeTest(session,rs);
            test.dt.setType(RDecisionTable.Type.FIRST);
            test.dt.build();
View Full Code Here

Examples of com.dtrules.session.DTState

            out        = new PrintStream     (getOutputDirectory(rs)+number+root+"_results.xml");
              if(Trace()){
                  tracefile  = new FileOutputStream(getOutputDirectory(rs)+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.