Example #1
0
  public Message receiveDebug(
      final Message message, final BasicOperator from, final DebugStep debugstep) {
    Message msg = message;
    if (from != null) {
      debugstep.stepMessage(from, this, msg);
      Map<BasicOperator, Message> received = this.messages.get(msg.getId());
      if (received == null) {
        received = new HashMap<BasicOperator, Message>();
        this.messages.put(msg.getId(), received);
      }
      received.put(from, msg);

      final HashSet<BasicOperator> operatorsWithoutCycles = new HashSet<BasicOperator>();
      operatorsWithoutCycles.addAll(this.precedingOperators);
      operatorsWithoutCycles.removeAll(this.cycleOperands);

      if (!received.keySet().containsAll(operatorsWithoutCycles)) {
        return null;
      }

      if (received.keySet().containsAll(this.precedingOperators)) {
        this.messages.remove(msg.getId());
      }
      msg = msg.merge(received.values(), this);
    }
    msg = msg.preProcessDebug(this, debugstep);
    msg = forwardMessageDebug(msg, debugstep);
    if (msg == null) return null;
    else return msg.postProcessDebug(this, debugstep);
  }
Example #2
0
 public Message sendMessageDebug(Message msg, final DebugStep debugstep) {
   Message msgResult = this.forwardMessageDebug(msg.preProcessDebug(this, debugstep), debugstep);
   // postprocess anyway one message, does not matter if the resultant msg is null or not to allow
   // processing right after initialization
   if (msgResult == null) {
     return msg.postProcessDebug(this, debugstep);
   } else {
     return msgResult.postProcessDebug(this, debugstep);
   }
 }