public SSResponder(Agent a, ACLMessage initiation, DataStore store, boolean useInitiationKey) { super(a); setDataStore(store); this.initiation = initiation; initiationKey = (useInitiationKey ? INITIATION_KEY : RECEIVED_KEY); registerDefaultTransition(RECEIVE_NEXT, CHECK_IN_SEQ); registerTransition(CHECK_IN_SEQ, HANDLE_OUT_OF_SEQUENCE, OUT_OF_SEQUENCE_EXIT_CODE); registerDefaultTransition( HANDLE_OUT_OF_SEQUENCE, RECEIVE_NEXT, new String[] {HANDLE_OUT_OF_SEQUENCE}); registerDefaultTransition(SEND_REPLY, DUMMY_FINAL); Behaviour b; // RECEIVE_NEXT b = new NextMsgReceiver(myAgent, getDataStore(), RECEIVED_KEY); registerState(b, RECEIVE_NEXT); // CHECK_IN_SEQ b = new SeqChecker(myAgent); registerDSState(b, CHECK_IN_SEQ); // HANDLE_OUT_OF_SEQUENCE b = new OutOfSeqHandler(myAgent); registerDSState(b, HANDLE_OUT_OF_SEQUENCE); // SEND_REPLY b = new NextReplySender(myAgent, REPLY_KEY, initiationKey); registerDSState(b, SEND_REPLY); // DUMMY_FINAL b = new DummyFinal(myAgent); registerLastState(b, DUMMY_FINAL); b.setDataStore(getDataStore()); }
/** * This method allows to register a user defined <code>Behaviour</code> in the HANDLE_OUT_OF_SEQ * state. This behaviour would override the homonymous method. This method also sets the data * store of the registered <code>Behaviour</code> to the DataStore of this current behaviour. The * registered behaviour can retrieve the <code>out of sequence</code> ACLMessage object received * from the datastore at the <code>RECEIVED_KEY</code> key. * * @param b the Behaviour that will handle this state */ public void registerHandleOutOfSequence(Behaviour b) { registerDSState(b, HANDLE_OUT_OF_SEQUENCE); }