示例#1
0
 /**
  * This will return the ActionInsertFact that a variable is bound to.
  *
  * @param var The bound fact variable (NOT bound field).
  * @return null or the ActionInsertFact found.
  */
 public ActionInsertFact getRHSBoundFact(final String var) {
   if (this.rhs == null) {
     return null;
   }
   for (int i = 0; i < this.rhs.length; i++) {
     if (this.rhs[i] instanceof ActionInsertFact) {
       final ActionInsertFact p = (ActionInsertFact) this.rhs[i];
       if (p.getBoundName() != null && var.equals(p.getBoundName())) {
         return p;
       }
     }
   }
   return null;
 }
示例#2
0
  /** This will get a list of all RHS bound variables. */
  public List<String> getAllRHSVariables() {
    List<String> result = new ArrayList<String>();

    for (int i = 0; i < this.rhs.length; i++) {
      IAction pat = this.rhs[i];
      if (pat instanceof ActionInsertFact) {
        ActionInsertFact fact = (ActionInsertFact) pat;
        if (fact.isBound()) {
          result.add(fact.getBoundName());
        }
      }
    }

    return result;
  }
示例#3
0
 /**
  * This will return a List<String> of all ActionInsertFact bindings
  *
  * @return The bindings or an empty list if no bindings are found.
  */
 public List<String> getRHSBoundFacts() {
   if (this.rhs == null) {
     return null;
   }
   final List<String> list = new ArrayList<String>();
   for (int i = 0; i < this.rhs.length; i++) {
     if (this.rhs[i] instanceof ActionInsertFact) {
       final ActionInsertFact p = (ActionInsertFact) this.rhs[i];
       if (p.getBoundName() != null) {
         list.add(p.getBoundName());
       }
     }
   }
   return list;
 }