Package com.dtrules.interpreter

Examples of com.dtrules.interpreter.RName


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


        if(types!=null)return types;
       
        types = new HashMap<RName, RType>();
        Iterator<RName> entities = ef.getEntityRNameIterator();
        while(entities.hasNext()){
            RName    name    = entities.next();
            REntity  entity  = ef.findRefEntity(name);
            Iterator<RName> attribs = entity.getAttributeIterator();
            addType(entity,entity.getName(),IRObject.iEntity);
            while(attribs.hasNext()){
                RName        attribname = attribs.next();
                REntityEntry entry      = entity.getEntry(attribname);
                addType(entity,attribname,entry.type);
            }
        }
       
        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

     */
    public void printTypes(PrintStream out) throws RulesException {
        Object typenames[] = types.keySet().toArray();
        for(int i=0;i<typenames.length-1;i++){
            for(int j=0;j<typenames.length-1;j++){
                RName one = (RName)typenames[j], two = (RName)typenames[j+1];
                if(one.compare(two)>0){
                    Object hold = typenames[j];
                    typenames[j]=typenames[j+1];
                    typenames[j+1]=hold;
                }
            }
        }
        for(int i=0;i<typenames.length-1;i++){
            for(int j=0;j<typenames.length-1;j++){
                RName one = (RName)typenames[j], two = (RName)typenames[j+1];
                if(types.get(one).getType()> types.get(two).getType()){
                    Object hold = typenames[j];
                    typenames[j]=typenames[j+1];
                    typenames[j+1]=hold;
                }
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()+"  ";
        }
        v +="}";
        return v;
       
  }
View Full Code Here

   
    public void writeXML(PrintStream p) throws RulesException {
        Iterator<RName> attribs = getAttributeIterator();
        p.println();
        while(attribs.hasNext()){
           RName attrib = attribs.next();
           if(attrib.equals(name))continue;     // Skip the self reference.
           REntityEntry entry = attributes.get(attrib);
           p.print("<entity attribute=\"");
           p.print(attrib.stringValue());
           p.print("\" type =\"");
           p.print(entry.type.toString());
           p.print("\" cdd_default_value=\"");
           p.print(entry.defaulttxt);
           p.print("\" cdd_i_c=\"");
View Full Code Here

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

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

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

        public void execute(DTState state) throws RulesException {
            RName dtname = state.datapop().rNameValue();
            state.getSession().getEntityFactory().getDecisionTable(dtname).executeTable(state);
        }
View Full Code Here

     * attribute with a name that mathches the name provided.
     *
     * @param name
     */
    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];
View Full Code Here

     * @param name
     * @param value
     */
    public boolean def(RName name, IRObject value, boolean protect) throws RulesException {

        RName entityname = name.getEntityName();

        for (int i = entitystkptr - 1; i >= 0; i--) {
            IREntity e = entitystk[i];
            if (!e.isReadOnly() && (entityname == null || e.getName().equals(entityname))) {
                REntityEntry entry = e.getEntry(name);
View Full Code Here

        public void execute(DTState state) throws RulesException {
            IREntity entity  = state.datapop().rEntityValue()// Get the entity
            IRObject body = state.datapop();                    // Get the body
            Iterator keys = entity.getAttributeIterator();      // Get the Attribute Iterator
            while(keys.hasNext()){                         // For each attribute
                RName     n = (RName) keys.next();
                IRObject  v = entity.get(n);
                if(v!=null){
                    state.datapush(n);
                    state.datapush(v);
                    body.execute(state);
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.