Exemplo n.º 1
0
 /**
  * Returns the set of groundings that can be derived from the rule and the specific input
  * assignment.
  *
  * @param input the input assignment
  * @return the possible groundings for the rule
  */
 private RuleGrounding getGroundings(Assignment input) {
   RuleGrounding groundings = new RuleGrounding();
   for (RuleCase c : cases) {
     groundings.add(c.getGroundings(input));
   }
   return groundings;
 }
Exemplo n.º 2
0
 /**
  * Returns the set of all possible effects in the rule.
  *
  * @return the set of all possible effects
  */
 public Set<Effect> getEffects() {
   Set<Effect> effects = new HashSet<Effect>();
   for (RuleCase c : cases) {
     effects.addAll(c.getEffects());
   }
   return effects;
 }
Exemplo n.º 3
0
 /**
  * Returns the input variables (possibly underspecified, with slots to fill) for the rule
  *
  * @return the set of labels for the input variables
  */
 public Set<Template> getInputVariables() {
   Set<Template> inputVars = new HashSet<Template>();
   for (RuleCase c : cases) {
     inputVars.addAll(c.getInputVariables());
   }
   return inputVars;
 }
Exemplo n.º 4
0
 /**
  * Returns the set of all parameter identifiers employed in the rule
  *
  * @return the set of parameter identifiers
  */
 public Set<String> getParameterIds() {
   Set<String> params = new HashSet<String>();
   for (RuleCase c : cases) {
     for (Effect e : c.getEffects()) {
       params.addAll(c.output.getParameter(e).getVariables());
     }
   }
   return params;
 }
Exemplo n.º 5
0
 /** Returns a string representation for the rule */
 @Override
 public String toString() {
   String str = id + ": ";
   for (RuleCase theCase : cases) {
     if (!theCase.equals(cases.get(0))) {
       str += "\telse ";
     }
     str += theCase.toString() + "\n";
   }
   if (!cases.isEmpty()) {
     str = str.substring(0, str.length() - 1);
   }
   return str;
 }