public int onEnd() {
      // The next reply (if any) will be a reply to the received message
      SSResponder parent = (SSResponder) getParent();
      parent.setMessageToReplyKey((String) receivedMsgKey);

      return super.onEnd();
    }
 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;
   }
 }
    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;
    }
 public void action() {
   SSResponder parent = (SSResponder) getParent();
   parent.sessionTerminated();
 }
 public void onStart() {
   SSResponder parent = (SSResponder) getParent();
   ACLMessage reply = (ACLMessage) getDataStore().get(parent.REPLY_KEY);
   parent.beforeReply(reply);
 }
 public void action() {
   SSResponder parent = (SSResponder) getParent();
   parent.handleOutOfSequence((ACLMessage) getDataStore().get(parent.RECEIVED_KEY));
 }