Package com.dtrules.interpreter

Examples of com.dtrules.interpreter.IRObject.execute()


        If(){super("if");}

        public void execute(DTState state) throws RulesException {
            boolean  test = state.datapop().booleanValue();
            IRObject body = state.datapop();
            if(test)body.execute(state);
        }
    }
    /**
     * ( truebody falsebody test -- ) Executes truebody if the boolean test is true, otherwise
     * executes falsebody.
View Full Code Here


        public void execute(DTState state) throws RulesException {
            boolean  test      = state.datapop().booleanValue();
            IRObject falsebody = state.datapop();
            IRObject truebody  = state.datapop();
            if(test){
                truebody.execute(state);
            }else{
                falsebody.execute(state);
            }
        }
    }
View Full Code Here

            IRObject test = state.datapop();         // Get the test
            IRObject body = state.datapop();         // Get the body
           
            test.execute(state);                     // evaluate the test
            while(state.datapop().booleanValue()){   // If true, keep looping
                body.execute(state);                 // execute the body.
                test.execute(state);                 // check the test again.
            }
           
          
        }
View Full Code Here

                 if(t== iNull)continue;
                 if(t!=iEntity){
                     throw new RulesException("Type Check", "Forallr", "Encountered a non-Entity entry in array: "+o);
                
                 state.entitypush((IREntity) o);
                 body.execute(state);
                 state.entitypop();
            }
        }
    }
   
View Full Code Here

        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);
            }
        }
    }
    /**
     * ( body array  -- ) pushes each element on to the data stack, then executes the body.
View Full Code Here

            Iterator<REntity> ie = (Iterator<REntity>) array.getIterator();
            while(ie.hasNext()){
                state.entitypush(ie.next());
                test.execute(state);
                if(state.datapop().booleanValue()){
                    body.execute(state);
                    state.entitypop();
                    return;
                }
                state.entitypop();
            }
View Full Code Here

            for(IRObject obj : array) {
                IREntity e = obj.rEntityValue();
                state.entitypush(e);
                test.execute(state);
                if(state.datapop().booleanValue()){
                    body1.execute(state);
                    state.entitypop();
                    return;
                }
                state.entitypop();
            }
View Full Code Here

            int         start     = state.datapop().intValue();
            IRObject    body      = state.datapop();
            if(increment>0){
                for(int i = start;i<limit;i+=increment){
                    state.cpush(RInteger.getRIntegerValue(i));
                    body.execute(state);
                    state.cpop();
                }
            }else{
                for(int i = start;i>limit;i+=increment){
                    state.cpush(RInteger.getRIntegerValue(i));
View Full Code Here

                    state.cpop();
                }
            }else{
                for(int i = start;i>limit;i+=increment){
                    state.cpush(RInteger.getRIntegerValue(i));
                    body.execute(state);
                    state.cpop();
                }
            }
        }
    }
View Full Code Here

        If(){super("if");}

        public void execute(DTState state) throws RulesException {
            boolean  test = state.datapop().booleanValue();
            IRObject body = state.datapop();
            if(test)body.execute(state);
        }
    }
    /**
     * ( truebody falsebody test -- ) Executes truebody if the boolean test is true, otherwise
     * executes falsebody.
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.