Exemplo n.º 1
0
  /**
   * If the kernel rule is using an input parameter and its value is already set do propagate this
   * value to the attribute context of multi rules.
   */
  public void applyValueOfInputParameter() {
    final VarTuple vars = (VarTuple) this.getAttrContext().getVariables();

    for (int i = 0; i < vars.getNumberOfEntries(); i++) {
      final VarMember v = vars.getVarMemberAt(i);
      if (v.isInputParameter() && v.isSet()) {
        VarMember vm =
            ((VarTuple) this.kernelRule.getAttrContext().getVariables())
                .getVarMemberAt(v.getName());
        if (vm != null && (vm.getExpr() == null || !v.getExprAsText().equals(vm.getExprAsText()))) {
          //					vm.setExprAsText(v.getExprAsText());
          vm.setExpr(v.getExpr());
        }

        for (int j = 0; j < this.multiRules.size(); j++) {
          vm =
              ((VarTuple) this.multiRules.get(j).getAttrContext().getVariables())
                  .getVarMemberAt(v.getName());
          if (vm != null
              && (vm.getExpr() == null || !v.getExprAsText().equals(vm.getExprAsText()))) {
            //						vm.setExprAsText(v.getExprAsText());
            vm.setExpr(v.getExpr());
          }
        }
      }
    }

    //		System.out.println("applyValueOfInputParameter...  "+this.kernelRule.getName());
    //		((VarTuple) this.kernelRule.getAttrContext().getVariables()).showVariables();
    //		for (int j=0; j<this.multiRules.size(); j++) {
    //			System.out.println("applyValueOfInputParameter...  "+this.multiRules.get(j).getName());
    //			((VarTuple) this.multiRules.get(j).getAttrContext().getVariables()).showVariables();
    //		}
  }