コード例 #1
0
 public void action() {
   SSResponder parent = (SSResponder) getParent();
   ACLMessage received = (ACLMessage) getDataStore().get(parent.RECEIVED_KEY);
   if (received != null && parent.checkInSequence(received)) {
     ret = received.getPerformative();
   } else {
     ret = OUT_OF_SEQUENCE_EXIT_CODE;
   }
 }
コード例 #2
0
    public int onEnd() {
      int ret = super.onEnd();
      SSResponder parent = (SSResponder) getParent();

      // If a reply was sent back, adjust the template and deadline of the
      // RECEIVE_NEXT state
      ACLMessage reply = (ACLMessage) getDataStore().get(parent.REPLY_KEY);
      if (reply != null) {
        MsgReceiver mr = (MsgReceiver) parent.getState(RECEIVE_NEXT);
        mr.setTemplate(createNextMsgTemplate(reply));

        Date d = reply.getReplyByDate();
        if (d != null && d.getTime() > System.currentTimeMillis()) {
          mr.setDeadline(d.getTime());
        } else {
          mr.setDeadline(MsgReceiver.INFINITE);
        }
      }

      parent.afterReply(reply);
      return ret;
    }
コード例 #3
0
 private MessageTemplate createNextMsgTemplate(ACLMessage reply) {
   return MessageTemplate.and(
       MessageTemplate.MatchConversationId(reply.getConversationId()),
       MessageTemplate.not(MessageTemplate.MatchCustom(reply, true)));
 }