コード例 #1
0
  public final IBindingSet newBindingSet(final IRule rule) {

    final IBindingSet constants = rule.getConstants();

    final int nconstants = constants.size();

    final IBindingSet bindingSet = new ListBindingSet()
        //                new ArrayBindingSet(rule.getVariableCount()+ nconstants)
        ;

    if (nconstants > 0) {

      /*
       * Bind constants declared by the rule before returning the binding
       * set to the caller.
       */

      final Iterator<Map.Entry<IVariable, IConstant>> itr = constants.iterator();

      while (itr.hasNext()) {

        final Map.Entry<IVariable, IConstant> entry = itr.next();

        bindingSet.set(entry.getKey(), entry.getValue());
      }
    }

    return bindingSet;
  }