Examples of IREntity


Examples of com.dtrules.entity.IREntity

           throw new RuntimeException(e);
      }
     
      for(RName ename : this.map.entities.keySet()){
         try {
        IREntity e     = findEntity(ename.stringValue().toLowerCase(),null,null);
        state.entitypush(e);
       } catch (RulesException e) {
              state.traceInfo("error","Failed to initialize the Entity Stack (Failed on "+ename+")\n"+e);
              throw new RuntimeException(e)
    }
View Full Code Here

Examples of com.dtrules.entity.IREntity

   * @return
   * @throws RulesException
   */
  IREntity findEntity( String entity, String code, EntityInfo info) throws RulesException{
     String number = (String) this.map.entityinfo.get(entity);
     IREntity e;
     if(number==null){
       number = "*";
     }
     if(number.equals("1")){
      e = (IREntity)entities.get(entity);
View Full Code Here

Examples of com.dtrules.entity.IREntity

       
        String name = tag;                                 // We assume the tag might create an entity
   
        EntityInfo    info  = (EntityInfo)    this.map.requests.get(name);
    AttributeInfo aInfo = (AttributeInfo) this.map.setattributes.get(tag);
    IREntity      topOfEntityStack = state.entityfetch(0);
     
    //     If I get info, then create an entity.
    //     Get the code from this tag.
    //     If a fixed entity name is specified,
    //     or the tag name, use it.  Otherwise use the multiple name
    if(info!=null){                   
      Object objCode = attribs == null ? null : attribs.get(info.id);
            String code = objCode==null?"":objCode.toString();
      String eName = info.name;
      if (eName == null || eName.length() <= 0)
      {
        eName =  (String) attribs.get("name");
      }
      IREntity e = findEntity(eName, code, info);     // Look up the entity I should create.
        if(e!=null){                  // I hope to goodness I can find it!
          attribs.put("create entity","true")
          if(code.length()!=0) {
            e.put(null, IREntity.mappingKey,RString.newRString(code));
          }else{
            e.put(null, IREntity.mappingKey,RString.newRString("v"+ (++codeCnt)));
          }
       
          state.entitypush(e);
        if(state.testState(DTState.TRACE)){
              state.traceTagBegin("createEntity", "name",info.name,"id",code+"");             
View Full Code Here

Examples of com.dtrules.entity.IREntity

      // 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){
                       
                   
              int type = enclosingEntity.getEntry(a).type;
             
              if(type == IRObject.iInteger){
                value = RInteger.getRIntegerValue(body.length()==0? "0" : body);
              } else if (type == IRObject.iDouble) {
                value = RDouble.getRDoubleValue(body.length()==0? "0" : body);
View Full Code Here

Examples of com.dtrules.entity.IREntity

      listname   = RName.getRName(info.list);
    }
        // 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);
                }
            }
        }
        // Then update the reference to this entity that might be on the Entity Stack.
        // DON'T go wild.  Only look at the top entity (or you may overwrite a reference
        //     you'd rather leave alone.
        // DON'T mess with any entity's self reference though!  That is BAD.
        int i=state.edepth()-1;
      if(((IREntity)state.getes(i)).get(e.getName())!=null){
            IREntity refto = state.getes(i);
            if(! refto.getName().equals(e.getName()))           // Update a reference to an Entity of the same name,
           ((IREntity)state.getes(i)).put(null, e.getName(), e)//  but only if it isn't a self reference.
       
      }
    
      return e;
View Full Code Here

Examples of com.dtrules.entity.IREntity

  public IREntity entitypop() throws RulesException {
    if(entitystkptr<=0) {
            throw new RulesException("Entity Stack Underflow",
                    "entitypop", "Entity Stack underflow.");
    }
        IREntity rval = entitystk[--entitystkptr];
        entitystk[entitystkptr] = null;
    return(rval);
  }
View Full Code Here

Examples of com.dtrules.entity.IREntity

  public IREntity entityfetch(int i) throws RulesException {
      if(entitystkptr<=i) {
            throw new RulesException("Entity Stack Underflow",
                    "entityfetch", "Entity Stack underflow.");
        }
        IREntity rval = entitystk[entitystkptr-1-i];
        return(rval);
  }
View Full Code Here

Examples of com.dtrules.entity.IREntity

   * @param entity
   * @return
   */
  public boolean inContext(RName entity){
     for(int i=0; i < entitystkptr; i++){                      //   entity on the Entity Stack.
          IREntity e = entitystk[i];
          if(e.getName().equals(entity))return true;
     }
     return false;
  }
View Full Code Here

Examples of com.dtrules.entity.IREntity

     */
    public IREntity findEntity(RName name) throws RulesException{
       RName entityname = name.getEntityName();                     // If the RName does not spec an Enttiy Name
       if(entityname == null){                                      //   then we simply look for the RName in each
           for(int i=entitystkptr-1;i>=0;i--){                      //   entity on the Entity Stack.
               IREntity e = entitystk[i];
               if(e.containsAttribute(name)) return e;
           }
       }else{                                                       // Otherwise, we insist that the Entity name
           for(int i=entitystkptr-1;i>=0;i--){                      //   match as well as insist that the Entity
               IREntity e = entitystk[i];                           //   have an attribute that matches this name.
               if(e.getName().equals(entityname)){
                   if(e.containsAttribute(name)){
                       return e;
                   }
               }   
           }
       }
View Full Code Here

Examples of com.dtrules.entity.IREntity

     * Looks up the entity stack for a match for the RName.  When a match is found, the
     * value is returned.  A null is returned if no match is found. 
     * @param name
     */
    public IRObject find(RName name) throws RulesException{
        IREntity entity = findEntity(name);
        if(entity == null) return null;
        return entity.get(name);
    }
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.