Package com.dtrules.interpreter

Examples of com.dtrules.interpreter.IRObject


     * @param name
     * @return
     * @throws RulesException
     */
    public RDecisionTable getDecisionTable(RName name)throws RulesException{
        IRObject dt = decisiontables.get(name);
        if(dt==null || dt.type()!=IRObject.iDecisiontable){
            return null;
        }
        return (RDecisionTable) dt;
    }
View Full Code Here


     * it.
     * @param dt
     * @return
     */
    public RDecisionTable findDecisionTable(RName dt){
        IRObject dttable = decisiontables.get(dt);
        if(dttable==null || dttable.type()!=IRObject.iDecisiontable){
            return null;
        }
        return (RDecisionTable) dttable;
    }
View Full Code Here

    static class SetXmlAttribute extends ROperator {
      SetXmlAttribute(){super("setxmlattribute");}

      @Override
            public void execute(DTState state) throws RulesException {
        IRObject  value     = state.datapop();
        IRObject  attribute = state.datapop();
        XMLNode   xmlNode   = state.datapop().xmlTagValue();
        if(xmlNode != null){
            state.traceInfo("SetXmlAttribute","tag",xmlNode.getTag(),"attribute",attribute.stringValue(),"value",value.stringValue(), null);
            xmlNode.getAttribs().put(attribute.stringValue(), value.stringValue());
        }
      }
View Full Code Here

      */
     static class GetWithKey extends ROperator {
         GetWithKey(){ super("getwithkey");}
        
         public void execute(DTState state) throws RulesException {
             IRObject key = state.datapop();
             RTable rtable = state.datapop().rTableValue();
             state.datapush(rtable.getValue(key));
         }
View Full Code Here

     static class SetWithKey extends ROperator {
         SetWithKey(){ super("setwithkey"); }
     
         public void execute(DTState state) throws RulesException {
            
             IRObject   v      = state.datapop();                // Get the value to store
             IRObject   key    = state.datapop().rNameValue();
             RTable     rtable = state.datapop().rTableValue();
             rtable.setValue(key,v);
            
         }
View Full Code Here

     static class SetWithKeys extends ROperator {
         SetWithKeys(){ super("setwithkeys");}
        
         public void execute(DTState state) throws RulesException {
             int       cnt = 0;                             // We keep a count of the keys.
             IRObject  v   = state.datapop();               // Get the value to store
             int       d   = state.ddepth()-1;              // Get current depth of data stack less one for the value.
            
             while(state.getds(--d).type()==iTable)cnt++;   // Count the keys (index1, index2, etc.)
            
             if(cnt != 1){
                 IRObject []keys = new IRObject[cnt];           // Get an array big enough to hold the keys
                
                 for(int i=0;i<cnt;i++){                        // Get all the keys off the data stack
                    keys[i]= state.datapop();
                 }
                
                 RTable rtable = state.datapop().rTableValue();
                
                 rtable.setValue(state,keys, v);                // Set the value.
             }else{
                 IRObject   key    = state.datapop();
                 RTable     rtable = state.datapop().rTableValue();
                 rtable.setValue(key,v);
             }
            
            
View Full Code Here

     * @return Returns null if no entity was found.
     * @throws RulesException
     */
    public IREntity findEntity(AutoDataMap autoDataMap, String entity, Label label, Object key) {
       IREntity e    = null;      
       IRObject iKey = iconvert(key);
       try {
           if(label.isSingular()){                          // If singular, look for an instance
               e = autoDataMap.getEntities().get(entity); //   on the entity stack.
               if(e==null){                               // None found? create one.
                   e = autoDataMap.getSession().getState().findEntity(entity+"."+entity);
                   if(e==null){
                      e = autoDataMap.getSession().createEntity(null,entity);
                      autoDataMap.getEntities().put(entity,e);   // Remember the one we created, so we
                   }  
               }                                              //   don't create another one.
           }else {
               String skey = entity+"$"+iKey.stringValue();
               if(key!=null &&
                   !(key instanceof String
                       && ((String)key).length()==0)) {                // NOTE: We are NOT allowing "" as a key here!
                                                                         // If so, construct a key for that entity
                   e = (IREntity)autoDataMap.getEntities().get(skey);    //    and look for it.
View Full Code Here

            RName rname = null;
            Object object = autoDataMap.getCurrentObject();
            if(object instanceof IREntity){
                IREntity entity = (IREntity) object;
                rname = mapName(autoDataMap, labelMap, node.getLabel());
                IRObject olist = entity.get(rname);
                if(olist != null && olist.type() == IRObject.iArray){
                    list = olist.rArrayValue();
                }
            }
           
            node.setTargetList(list);
           
View Full Code Here

            if(tgtObj == null) return;
            IREntity      entity     = (IREntity) tgtObj;
            RName         attribute  = RName.getRName(node.getAttribute().getName());
            REntityEntry  entry      = entity.getEntry(attribute);
            if(entry != null && entry.writable){
                IRObject  value  = entity.get(node.getAttribute().getName());
                Object    v      = convert(value);   
                node.setData(v);
            }
        }
       
View Full Code Here

        // We get the object first, because if the LabelMap is going to get cached, it
        // is going to get cached as a result of this call. 
        autoDataMap.pushMark();
        List<Object> results = (List<Object>) node.getChild().mapNode(autoDataMap, labelMap);
        IRObject ref = null;
        if(results != null && results.size()==1){
            ref = (IRObject) results.get(0);
        }
        autoDataMap.pop();
       
View Full Code Here

TOP

Related Classes of com.dtrules.interpreter.IRObject

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.