//////////////////////////////////////////////////// // Code to move to a container in the same platform //////////////////////////////////////////////////// String containerName = "Container-1"; ContainerID destination = new ContainerID(); // Initialize the destination object destination.setName(containerName); // Change of the agent state to move myAgent.doMove(destination); ================================== //////////////////////////////////////////////////// // Code to move to a remote platform //////////////////////////////////////////////////// // Build the AID of the corresponding remote platform’s AMS AID remoteAMS = new AID("ams@remotePlatform:1099/JADE", AID.ISGUID); // Specify the MTP by setting the transport address of the remote AMS remoteAMS.addAddresses("http://remotePlatformaddr:7778/acc"); // Create the Location object PlatformID destination = new PlatformID(remoteAMS); // Change of the agent state to move myAgent.doMove(destination); ================================== //////////////////////////////////////////////////// // Code to clone to a container in the same platform //////////////////////////////////////////////////// String containerName = "Container-1"; String newAgentName = "myClone"; ContainerID destination = new ContainerID(); // Initialize the destination object destination.setName(containerName); // Change of the agent state to clone myAgent.doClone(destination, newAgentName); ================================== //////////////////////////////////////////////////// // Behaviour to visit two locations and then terminate //////////////////////////////////////////////////// addBehaviour(new CyclicBehaviour(this){ public void action() { switch(_state){ case 0: // Agent starts to migrate _state++; myAgent.doMove(_dests[0]); break; case 1: // Agent migrates to the second container _state++; myAgent.doMove(_dests[1]); break; case 2: // Agent dies myAgent.doDelete(); break; default: myAgent.doDelete(); } } private ContainerID[] _dests = ...; private int _state = 0; } );