Exemple #1
0
 public ScheduledAgendaItem createScheduledAgendaItem(
     final LeftTuple tuple,
     final PropagationContext context,
     final TerminalNode rtn,
     InternalAgendaGroup agendaGroup) {
   RuleTerminalNodeLeftTuple rtnLeftTuple = (RuleTerminalNodeLeftTuple) tuple;
   rtnLeftTuple.init(activationCounter++, 0, context, null, agendaGroup);
   ScheduledAgendaItem item = new ScheduledAgendaItem(rtnLeftTuple, this);
   tuple.setObject(item);
   return item;
 }
Exemple #2
0
 public AgendaItem createAgendaItem(
     final LeftTuple tuple,
     final int salience,
     final PropagationContext context,
     final TerminalNode rtn,
     RuleAgendaItem ruleAgendaItem,
     InternalAgendaGroup agendaGroup) {
   RuleTerminalNodeLeftTuple rtnLeftTuple = (RuleTerminalNodeLeftTuple) tuple;
   rtnLeftTuple.init(activationCounter++, salience, context, ruleAgendaItem, agendaGroup);
   rtnLeftTuple.setObject(rtnLeftTuple);
   return rtnLeftTuple;
 }
    public int compare(Object existing, Object adding) {
      RuleTerminalNodeLeftTuple rtnLt1 = (RuleTerminalNodeLeftTuple) existing;
      RuleTerminalNodeLeftTuple rtnLt2 = (RuleTerminalNodeLeftTuple) adding;

      final int s1 = rtnLt1.getSalience();
      final int s2 = rtnLt2.getSalience();

      // highest goes first
      if (s1 > s2) {
        return 1;
      } else if (s1 < s2) {
        return -1;
      }

      final int l1 = rtnLt1.getRule().getLoadOrder();
      final int l2 = rtnLt2.getRule().getLoadOrder();

      // lowest goes first
      if (l1 < l2) {
        return 1;
      } else if (l1 > l2) {
        return -1;
      } else {
        return 0;
      }
    }