Examples of RType


Examples of com.dtrules.compiler.RType

     * @param name
     * @param itype
     * @throws Exception
     */
    private void addType( REntity entity, RName name, int itype) throws Exception {
        RType type =  types.get(name);
        if(type==null){
            type      = new RType(name,itype,entity);
            types.put(name,type);
        }else{
            if(type.getType()!=itype){
                String entitylist = entity.getName().stringValue();
                for(int i=0; i<type.getEntities().size(); i++){
                    entitylist += " "+type.getEntities().get(i).getName().stringValue();
                }
                throw new Exception("Conflicting types for attribute "+name+" on "+entitylist);
            }
            type.addEntityAttribute(entity);
        }

    }
View Full Code Here

Examples of com.dtrules.compiler.RType

        }
       
        Iterator<RName> tables = ef.getDecisionTableRNameIterator();
        while(tables.hasNext()){
            RName tablename = tables.next();
            RType type = new RType(tablename,IRObject.iDecisiontable,(REntity) ef.getDecisiontables());
            if(types.containsKey(tablename)){
                System.out.println("Multiple Decision Tables found with the name '"+types.get(tablename)+"'");
            }
            types.put(tablename, type);
        }
View Full Code Here

Examples of com.dtrules.compiler.RType

     * @param ident
     * @return
     */
    int identType(String ident,String entity){
       
           RType type = (RType) types.get(RName.getRName(ident,true));
           boolean defined = true;
           if(entity != null && entity.length()!=0 && type!=null){
              defined = false;
              for(REntity rEntity : type.getEntities()){
                  if(entity.equalsIgnoreCase(rEntity.getName().stringValue())){
                      if(rEntity.containsAttribute(RName.getRName(ident))){
                          defined = true;
                      }
                      break;
                  }
              }
           }
           if(type==null || defined==false){
               RName rname = RName.getRName(
                  (entity==null||entity.length()==0?"":entity+".")+ident);
               try {
                  IRObject o = session.getState().find(rname);
                  if(o==null)return -1;
                  return o.type();
                } catch (RulesException e) {
                  return -1;
                }
           }
          
           type.addRef(entity);
          
           return type.getType();
        
    }
View Full Code Here

Examples of com.dtrules.compiler.el.RType

     * @param name
     * @param itype
     * @throws Exception
     */
    private void addType( REntity entity, RName name, int itype) throws Exception {
        RType type =  types.get(name);
        if(type==null){
            type      = new RType(name,itype,entity);
            types.put(name,type);
        }else{
            if(type.getType()!=itype){
                String entitylist = entity.getName().stringValue();
                for(int i=0; i<type.getEntities().size(); i++){
                    entitylist += " "+type.getEntities().get(i).getName().stringValue();
                }
                throw new Exception("Conflicting types for attribute "+name+" on "+entitylist);
            }
            type.addEntityAttribute(entity);
        }

    }
View Full Code Here

Examples of com.dtrules.compiler.el.RType

        }
       
        Iterator<RName> tables = ef.getDecisionTableRNameIterator();
        while(tables.hasNext()){
            RName tablename = tables.next();
            RType type = new RType(tablename,IRObject.iDecisiontable,(REntity) ef.getDecisiontables());
            if(types.containsKey(tablename)){
                System.out.println("Multiple Decision Tables found with the name '"+types.get(tablename)+"'");
            }
            types.put(tablename, type);
        }
View Full Code Here

Examples of com.dtrules.interpreter.RType

    }
   
    private HashMap<IREntity,ArrayList<IREntity>> boundries = new HashMap<IREntity,ArrayList<IREntity>>(); // Track printing Entity from Entity boundries to stop recursive printing.
   
    private String getType(IREntity e, RName n) throws RulesException{
        RType type = e.getEntry(n).type;
        return type.toString();
    }
View Full Code Here

Examples of com.dtrules.interpreter.RType

    }
   
    private HashMap<IREntity,ArrayList<IREntity>> boundries = new HashMap<IREntity,ArrayList<IREntity>>(); // Track printing Entity from Entity boundries to stop recursive printing.
   
    private String getType(IREntity e, RName n) throws RulesException{
        RType type = e.getEntry(n).type;
        return type.toString();
    }
View Full Code Here

Examples of com.dtrules.interpreter.RType

      if(input   == null)input   = "";
      if(output  == null)output  = "";
     
      boolean  writeable = true;   // We need to convert access to a boolean
      boolean  readable  = true;    // Make an assumption of r/w
      RType    rtype     = null;    // We need to convert the type to an int.
      IRObject defaultO  = null;    // We need to convert the default into a Rules Engine Object.
     
      writeable = access.toLowerCase().indexOf("w")>=0;
      readable  = access.toLowerCase().indexOf("r")>=0;
      if(!writeable && !readable){
          errorMsgs +="\nThe attribute "+attribute+" has to be either readable or writable\r\n";
          succeeded=false;
          rtype = RNull.type;
      }
     
      // Now the type.  An easy thing.
          if(!RType.isType(type)){
            errorMsgs+= "The type specified: '"+type+"' is not a valid type.";
          succeeded = false;
          }else{
            rtype = RType.getType(type);
      }
     
          try{     
              defaultO = session.getComputeDefault().computeDefaultValue(session, ef, defaultv, rtype) ;
          } catch (RulesException e) {
              errorMsgs += "Bad Default Value '"+defaultv+"' encountered on entity: '"+entityname+"' attribute: '"+attribute+"' \n";
              succeeded = false;
          }
      RName  entityRName = RName.getRName(entityname.trim(),false);
      RName  attributeRName = RName.getRName(attribute.trim(),false);
      IREntity entity = ef.findcreateRefEntity(false,entityRName);
          RType   rtype2 = null;
          if(!RType.isType(type)){
            errorMsgs += "Bad Type: '"+type+"' encountered on entity: '"+entityname+"' attribute: '"+attribute+"' \n";
            succeeded = false;
            rtype2 = RNull.type;
          }else{
View Full Code Here

Examples of com.dtrules.interpreter.RType

        if(!writeable && !readable){
            errorMsgs +="\nThe attribute "+attrib_name+" has to be either readable or writable\r\n";
            succeeded=false;
        }
       
        RType rtype = null;

        // Now the type.  An easy thing.
        if(!RType.isType(type)){
          errorMsgs+= "The type: '"+type+"' is not a valid type";
            succeeded = false;
        }else{
          rtype = RType.getType(type);
        }
               
        IRObject defaultO = session.getComputeDefault().computeDefaultValue(session, ef, default_value, rtype) ;
       
        RName  entityRName = RName.getRName(entityname.trim(),false);
        RName  attributeRName = RName.getRName(attrib_name.trim(),false);
        IREntity entity = ef.findcreateRefEntity(false,entityRName);
       
        RType rtype2 = null;

        if(!RType.isType(type)){
          errorMsgs += "Bad Type: '"+type+"' encountered on entity: '"+entityname+"' attribute: '"+attrib_name+"' \n";
            succeeded = false;
        }else{
View Full Code Here

Examples of com.dtrules.interpreter.RType

    }
   
    private HashMap<IREntity,ArrayList<IREntity>> boundries = new HashMap<IREntity,ArrayList<IREntity>>(); // Track printing Entity from Entity boundries to stop recursive printing.
   
    private String getType(IREntity e, RName n) throws RulesException{
        RType type = e.getEntry(n).type;
        return type.toString();
    }
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.