Package com.dtrules.interpreter

Examples of com.dtrules.interpreter.IRObject


             RArray  keys       = state.datapop().rArrayValue();
             RTable  table      = state.datapop().rTableValue();
             RArray valueArray = RArray.newArray(state.getSession(),duplicates,false);
             for(IRObject key : keys){
                 if(table.containsKey(key)){
                    IRObject o = table.getValue(key);
                    valueArray.add(o);
                    if (state.testState(DTState.TRACE)) {
                        state.traceInfo("addto", "arrayId", valueArray.getID() + "",
                                o.postFix());
                    }

                 }
             }
             state.datapush(valueArray);
View Full Code Here


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

      public void execute(DTState state) throws RulesException {
          IRObject o2 = state.datapop();
          IRObject o1 = state.datapop();
        long number2 = o2.longValue();
        long number1 = o1.longValue();
        state.datapush(RBoolean.getRBoolean(number1 > number2));
      }
View Full Code Here

       */
    static class Booleanequal extends ROperator {
      Booleanequal(){super("b="); alias("beq");}

      public void execute(DTState state) throws RulesException {
          IRObject o2 = state.datapop();
          IRObject o1 = state.datapop();
          boolean r = false;
          try{
              r = o1.booleanValue() == o2.booleanValue();
          }catch(RulesException e){}   // Ignore any failures, and simply fail.
         
        state.datapush(RBoolean.getRBoolean(r)  );
      }
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

       */
    public static class Dategt extends ROperator {
      Dategt(){super("d>");}

      public void arrayExecute(DTState state) throws RulesException {
        IRObject o2 = state.datapop();
        IRObject o1 = state.datapop();
        Date date1=null, date2=null;
        try{
          date1 = o1.timeValue()
          date2 = o2.timeValue();
        }catch(RulesException e){
          if(date1==null) {
              e.addToMessage("The First Parameter is null");
              try{
View Full Code Here

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

      public void execute(DTState state) throws RulesException {
        IRObject value2 = state.datapop();
        IRObject value1 = state.datapop();
        state.datapush(RBoolean.getRBoolean(value1.equals(value2)));
      }
View Full Code Here

    }

    public void execute(DTState state) throws RulesException {

      String pattern = state.datapop().stringValue();
      IRObject obj1 = state.datapop();
      String v = "";
      if (obj1.type().getId() != IRObject.iNull) {
        v = obj1.stringValue().trim();
      }
      String[] results = v.split(pattern);

      RArray r = RArray.newArray(state.getSession(), false, false);
      for (String t : results) {
View Full Code Here

    Addto() {
      super("addto");
    }

    public void execute(DTState state) throws RulesException {
      IRObject value = state.datapop();
      RArray rarray = state.datapop().rArrayValue();
      if (state.testState(DTState.TRACE)) {
        state.traceInfo("addto", "arrayId", rarray.getID() + "",
            value.postFix());
      }
      rarray.add(value);
    }
View Full Code Here

      super("findmatch");
    }

    public void execute(DTState state) throws RulesException {
      RArray array = state.datapop().rArrayValue();
      IRObject v3 = state.datapop();
      IRObject n3 = state.datapop();
      IRObject v2 = state.datapop();
      IRObject n2 = state.datapop();
      IRObject v1 = state.datapop();
      IRObject n1 = state.datapop();
     
      for(IRObject ie : array){
        IREntity e = ie.rEntityValue();
       
        if(n3.type().getId() != RNull.type.getId()){
          IRObject v = e.get(n3.rNameValue());
          if(!v.equals(v3)){
            continue;
          }
        }
        if(n2.type().getId() != RNull.type.getId()){
          IRObject v = e.get(n2.rNameValue());
          if(!v.equals(v2)){
            continue;
          }
        }
        if(n1.type().getId() != RNull.type.getId()){
          IRObject v = e.get(n1.rNameValue());
          if(!v.equals(v1)){
            continue;
          }
        }
        state.datapush(e);
        state.datapush(RBoolean.getRBoolean(true));
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.