Esempio n. 1
0
    /**
     * Returns the groundings associated with the rule case, given the input assignment
     *
     * @param input the input assignment
     * @return the resulting groundings
     */
    public RuleGrounding getGroundings(Assignment input) {
      RuleGrounding groundings = new RuleGrounding();
      groundings.add(condition.getGroundings(input));

      if (ruleType == RuleType.UTIL) {
        boolean actionVars = input.containsVars(output.getOutputVariables());
        for (Effect e : getEffects()) {
          if (actionVars) {
            Condition co = e.convertToCondition();
            RuleGrounding effectGrounding = co.getGroundings(input);
            groundings.add(effectGrounding);
          } else {
            Set<String> slots = e.getValueSlots();
            slots.removeAll(input.getVariables());
            groundings.add(Assignment.createOneValue(slots, ""));
          }
        }
      }
      return groundings;
    }