Ejemplo n.º 1
0
 private IntConstraintMatchTotal findIntConstraintMatchTotal(
     RuleContext kcontext, int scoreLevel) {
   Rule rule = kcontext.getRule();
   String constraintPackage = rule.getPackageName();
   String constraintName = rule.getName();
   List<Object> key = Arrays.<Object>asList(constraintPackage, constraintName, scoreLevel);
   IntConstraintMatchTotal matchTotal = (IntConstraintMatchTotal) constraintMatchTotalMap.get(key);
   if (matchTotal == null) {
     matchTotal = new IntConstraintMatchTotal(constraintPackage, constraintName, scoreLevel);
     constraintMatchTotalMap.put(key, matchTotal);
   }
   return matchTotal;
 }
Ejemplo n.º 2
0
 private void putConstraintUndoListener(
     RuleContext kcontext, int scoreLevel, ConstraintUndoListener constraintUndoListener) {
   AgendaItem<?> agendaItem = (AgendaItem) kcontext.getMatch();
   ActivationUnMatchListener activationUnMatchListener = agendaItem.getActivationUnMatchListener();
   if (activationUnMatchListener != null) {
     MultiLevelActivationUnMatchListener multiLevelActivationUnMatchListener =
         (MultiLevelActivationUnMatchListener) activationUnMatchListener;
     multiLevelActivationUnMatchListener.overwriteMatch(scoreLevel, constraintUndoListener);
   } else {
     MultiLevelActivationUnMatchListener multiLevelActivationUnMatchListener =
         new MultiLevelActivationUnMatchListener(scoreLevel, constraintUndoListener);
     agendaItem.setActivationUnMatchListener(multiLevelActivationUnMatchListener);
   }
 }