Ejemplo n.º 1
0
 private void removeAttrCondsOfKernelFromMultiRule(final Rule multiRule) {
   CondTuple conds = (CondTuple) multiRule.getAttrContext().getConditions();
   for (int i = 0; i < conds.getNumberOfEntries(); i++) {
     CondMember cond = conds.getCondMemberAt(i);
     if (cond.isShifted()) {
       conds.getTupleType().deleteMemberAt(i);
       i--;
     }
   }
 }
Ejemplo n.º 2
0
 private void addAttrCondsOfKernelToMultiRule(final Rule multiRule) {
   CondTuple kernConds = (CondTuple) this.kernelRule.getAttrContext().getConditions();
   CondTuple multiConds = (CondTuple) multiRule.getAttrContext().getConditions();
   for (int i = 0; i < kernConds.getNumberOfEntries(); i++) {
     String kernCond = kernConds.getCondMemberAt(i).getExprAsText();
     if (!multiConds.contains(kernCond)) {
       CondMember cm = (CondMember) multiConds.addCondition(0, kernCond);
       cm.setShifted(true);
     }
   }
 }
Ejemplo n.º 3
0
  private boolean nacIsUsingVariable(
      final VarMember var, final AttrConditionTuple act, final List<OrdinaryMorphism> nacs) {

    for (int l = 0; l < nacs.size(); l++) {
      final OrdinaryMorphism nac = nacs.get(l);
      if (nac.getTarget().isUsingVariable(var)) {
        return true;
      }
      Vector<String> nacVars = nac.getTarget().getVariableNamesOfAttributes();
      for (int j = 0; j < nacVars.size(); j++) {
        String varName = nacVars.get(j);
        for (int k = 0; k < act.getNumberOfEntries(); k++) {
          CondMember cond = (CondMember) act.getMemberAt(k);
          Vector<String> condVars = cond.getAllVariables();
          if (condVars.contains(varName) && condVars.contains(var.getName())) {
            return true;
          }
        }
      }
    }
    return false;
  }