Package com.dtrules.interpreter

Examples of com.dtrules.interpreter.IRObject


    static class Get    extends ROperator {
        Get(){super("get");}
        public void execute(DTState state) throws RulesException {
          RName    n = state.datapop().rNameValue();
            IREntity e = state.datapop().rEntityValue();
            IRObject v = e.get(n);
            state.datapush(v);
        }
View Full Code Here


       
        put(null,name,this);                         //Patch up the self reference to point to self.
        put(null,mappingKey,RNull.getRNull());       //Clear the mapping Key

        for(int i=0;i<values.size();i++){
            IRObject value     = values.get(i);
            if(value == this){          // make a clone of everything one level down, but don't clone ourselves.           
                values.set(i,value);    // The clone references the same entity
            }else{
                values.set(i,value.clone(s));
            }
        }
   }
View Full Code Here

  public String toString(){
    String v = name.stringValue()+" = {";
        Iterator<RName> ia = getAttributeIterator();
        while(ia.hasNext()){
            RName    n = ia.next();
            IRObject o = get(n);
            if(o==null){                // Protect ourselves from nulls.
                o = RNull.getRNull();
            }
            v +=n.stringValue()+" = "+get(n).stringValue()+"  ";
        }
View Full Code Here

    if (attr != null){       
        attribs.remove("set attribute");
      // Look and see if we have an attribute name defined.
            if(body!=null){
          RName a = RName.getRName(attr);                
          IRObject value;
                    
                    IREntity enclosingEntity = session.getState().findEntity(a);
                    if(enclosingEntity==null){
                        throw new Exception ("No Entity is in the context that defines "+ a.stringValue());
                    }
View Full Code Here

    RName listname   = RName.getRName(e.getName().stringValue()+"s");
       
        // First add this entity to any list found on the entity stack.
        for(int i=0; i< state.edepth(); i++){
            // Look for all Array Lists on the Entity Stack that look like lists of this Entity
            IRObject elist = state.getes(i).get(listname);
            if(elist!=null && elist.type()==IRObject.iArray){
                // If not a member of this list, then add it.
                if(!((RArray)elist).contains(e)){
                   ((RArray)elist).add(e);
                }
            }
View Full Code Here

     * @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);
        }
        return newentity;
    }
View Full Code Here

   
    if ((attr = (String) attribs.get("set attribute"))!=null){       
      // Look and see if we have an attribute name defined.
       
          RName a = RName.getRName(attr);                
          IRObject value;
                    
                    IREntity enclosingEntity = session.getState().findEntity(a);
                    if(enclosingEntity!=null){
                       
                   
View Full Code Here

    }
        // First add this entity to any list found on the entity stack.
        for(int i=0; i< state.edepth(); i++){
            // Look for all Array Lists on the Entity Stack that look like lists of this Entity
            IREntity entity = state.getes(i);
            IRObject elist = entity.get(listname);
            if(elist!=null && elist.type()==IRObject.iArray){
                // If not a member of this list, then add it.
                if(!((RArray)elist).contains(e)){
                   ((RArray)elist).add(e);
                }
            }
View Full Code Here

     * Creates and returns a new Decision Table object.
     * @param name -- The name of the new decision table.
     * @return -- The new decision table
     */
    public RDecisionTable newDecisionTable(RName name, IRSession session)throws RulesException{
        IRObject table = decisiontables.get(name);
        if(table !=null && table.type() != IRObject.iDecisiontable){
            throw new RulesException("ParsingError","New Decision Table","For some reason, "+name.stringValue()+" isn't a decision table");
        }
        if(table != null){
            session.getState().debug("Overwritting the Decision Table: "+name.stringValue());
        }
View Full Code Here

    /**
     * Delete Decision Table doesn't really delete the decision table, but removes it
     * from the structures in the entityfactory.
     */
    public void deleteDecisionTable(RName name)throws RulesException {
        IRObject table = getDecisionTable(name);
        if(table==null)return;
        decisiontables.removeAttribute(name);
        decisiontablelist.remove(name);
    }
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.