Package com.dtrules.interpreter

Examples of com.dtrules.interpreter.RName


     */
    static class Lookup extends ROperator {
        Lookup(){super("lookup");}

        public void execute(DTState state) throws RulesException {
            RName name = state.datapop().rNameValue();
            IRObject value = state.find(name);
            if(value == null){
                throw new RulesException(
                        "undefined",
                        "Lookup",
                        "Could not find a value for "+name.stringValue()+" in the current context."
                );
            }
            state.datapush(value);
        }
View Full Code Here


     */
    private void dump(IREntity e,int depth){
        Iterator<RName> anames = e.getAttributeIterator();
        while(anames.hasNext()){
            try {
                RName        aname = anames.next();
                IRObject     value = e.get(aname);
               
                dtstate.traceTagBegin("attribute", "name",aname.stringValue(),"type",getType(e,aname));
                int type = e.getEntry(aname).type.getId();
               
               if(type == IRObject.iEntity) {
                      if(value.type().getId() == IRObject.iNull){
                          dtstate.traceInfo("value","type","null","value","null",null);
View Full Code Here

     * @param name The name of the Entity to create
     * @return     The entity created.
     * @throws RulesException Thrown if any problem occurs (such as an undefined Entity name)
   */
  public IREntity createEntity(Object id, String name) throws RulesException{
        RName entity = RName.getRName(name);
    return createEntity(id, entity);
  }
View Full Code Here

       if(tag==null)tag = e.getName().stringValue();
       IRObject id = e.get(RName.getRName("mapping*key"));
       String   idString = id!=null?id.stringValue():"--none--";
         rpt.opentag(tag,"DTRulesId",e.getID()+"","id",printIds ? idString : "");
         Set<RName> names = e.getAttributeSet();
         RName keys[] = sort(names);
         for(RName name : keys){
             IRObject v    = e.get(name);
             if(v.type().getId()==IRObject.iArray && v.rArrayValue().size()==0) continue;
             String   vstr = v==null?"":v.stringValue();
             rpt.printdata("attribute","name",name.stringValue(), vstr);
View Full Code Here

             if(printed!=null) printed.add(e);
             IRObject id = e.get(RName.getRName("mapping*key"));
             String   idString = id!=null?id.stringValue():"--none--";
             rpt.opentag(entityName,"DTRulesId",printIds ? e.getID():"","id",idString);
             Set<RName> keys = e.getAttributeSet();
             RName akeys [] = sort(keys);
             for(RName name : akeys){
                 IRObject v    = e.get(name);
                 printIRObject(rpt, entitypath, printed, state, name.stringValue(), v);
             }
             rpt.closetag();
View Full Code Here

             entitypath.remove(entitypath.size()-1);
         }
     }
   
     public RName [] sort(Set<RName> keys) {
       RName  ret[] = keys.toArray(new RName[0]);
       int cnt = ret.length;
       for(int i = 0; i< cnt-1; i++){
         for(int j = 0; j < cnt-1-i; j++){
           RName one = ret[j];
           RName two = ret[j+1];
           if(one.stringValue().compareTo(two.stringValue())>0){
             RName hld = ret[j];
             ret[j]    = ret[j+1];
             ret[j+1= hld;
           }
         }
       }
View Full Code Here

     */
    static class InContext extends ROperator {
            InContext(){super("InContext");}

            public void execute(DTState state) throws RulesException {
                RName       entityName  = state.datapop().rNameValue();
                IREntity    entity      = state.findEntity(entityName);
                state.datapush(entity);
            }
View Full Code Here

   * @throws RulesException
   */
    public void printBalancedTables(PrintStream out)throws RulesException {
        Iterator<RName> dts = this.getEntityFactory().getDecisionTableRNameIterator();
        while(dts.hasNext()){
            RName dtname = dts.next();
            RDecisionTable dt = this.getEntityFactory().findDecisionTable(dtname);
            String t;
            try{
              t = dt.getBalancedTable().getPrintableTable();
            }catch(RulesException e){
              System.out.flush();
              System.err.println("The Decision Table '"+dt.getName().stringValue()
                  +"' is too complex, and must be split into two tables.");
              t = "Table too Big to Print";
              System.err.flush();
            }
            out.println();
            out.println(dtname.stringValue());
            out.println();
            out.println(t);
        }
    }
View Full Code Here

     public static class NewTable extends ROperator {
         NewTable(){ super("newtable");}
        
         public void execute(DTState state) throws RulesException {
             String type  = state.datapop().stringValue();
             RName  name  = state.datapop().rNameValue();
             RTable table = RTable.newRTable(state.getSession().getEntityFactory(),name,"");
             state.datapush(table);
         }
View Full Code Here

        //Ignore the mapping "key" attribute.
        if(name.equals(IREntity.mappingKey))return unreferenced;
       
        for(int i=0; i< refs.size(); i++){
            if(refs.get(i).equals(NOT_REF)){
                RName entityName = entities.get(i).getName();
                // Ignore self references.
                if(!entityName.equals(name)){
                  unreferenced.add(entityName.stringValue()+"."+name.stringValue());
               
            }
        }
        return unreferenced;
    }
View Full Code Here

TOP

Related Classes of com.dtrules.interpreter.RName

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.