Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## madkit.netcomm
Class NetAgent

    java.lang.Object
      madkit.kernel.AbstractAgent
          madkit.kernel.Agent
              madkit.netcomm.MadkitNetworkAgent
                  madkit.netcomm.NetAgent

All Implemented Interfaces:
  java.io.Serializable, java.lang.Runnable, Communicator

    public class NetAgent

extends MadkitNetworkAgent
implements Communicator

The NetAgent replaces the Communicator. For the outside agents the communications behave the save way. The NetAgent can be configured to automatically broadcast the presence of the Kernel using @link NetAgent# setAutoBroadcast()

Version:
  $Revision: 1.6 $
Author:
  Sebastian Rodriguez - sebastian.rodriguez@utbm.fr
See Also:
  Serialized Form

Field Summary

Fields inherited from class madkit.netcomm.MadkitNetworkAgent
`community, group, memberCard, myKernel`

Constructor Summary
`NetAgent()`
`NetAgent(int p)`

Method Summary
`void` | `activate()` This methods has been overloaded to initialize some of the variables provided by this agent.
`void` | `connectAgency(java.lang.String kernelName, java.lang.String host, int port)`
`void` | `connectKernel(java.lang.String host, int port)` Requests the connection of the kernel at host:port
`void` | `end()` This method is called by the agent micro-kernel at the end of the agent lifecycle.
`int` | `getPort()`
`protected void` | `handleConfigMessage(NetConfigMessage message)` Handles the Configuration messages.
`protected void` | `handleNetworkMessage(NetworkMessage message)` Handles the internal messages.
`protected void` | `handlePersonalMessage(StringMessage m)`
`void` | `initGUI()` This method is called by the specific external graphic system (as the G-Box) to ask the agent to prepare a graphical interface.
`boolean` | `isAutoBroadcast()`
`void` | `live()` This method defines the main behavior of threaded agents.
`boolean` | `madkitBroadcast()` Broadcasts the presence of the kernel.
`void` | `setAutoBroadcast(boolean autoBroadcast)` If the autoBroadcast is set to true, it broadcasts the presence of the kernel.

Methods inherited from class madkit.netcomm.MadkitNetworkAgent
`bytesReceived, bytesSent, debug, fatatError, fatatError, getReceivedBytesCount, getSentBytesCount, print, println, reset`

Methods inherited from class madkit.kernel.Agent
`connectAgencyToAgency, createPlace, createPlace, enableMobility, enableMobility, exitImmediatlyOnKill, getAgencyNamed, joinPlace, joinPlace, joinPlace, pause, receiveMessage, run, waitNextMessage, waitNextMessage`

Methods inherited from class madkit.kernel.AbstractAgent
`broadcastMessage, broadcastMessage, connectedWithCommunity, createGroup, createGroup, destroyGroup, disposeMyGUI, foundGroup, getAddress, getAgentsWithRole, getAgentsWithRole, getAgentWithRole, getAgentWithRole, getAvailableCommunities, getBean, getController, getCurrentKernelAddress, getDebug, getExistingGroups, getExistingGroups, getExistingRoles, getExistingRoles, getGroups, getGUIObject, getMessageBoxSize, getMyGroups, getMyGroups, getMyRoles, getMyRoles, getName, getRoles, hasGUI, hashCode, hideMyGUI, isBelongingToGroup, isBelongingToGroup, isCommunity, isGroup, isGroup, isMemberOf, isMemberOf, isMessageBoxEmpty, isRole, isRole, joinGroup, killAgent, launchAgent, launchAgent, leaveGroup, leaveGroup, leaveRole, leaveRole, nextMessage, redisplayMyGUI, requestRole, requestRole, requestRole, restoreAgent, sendMessage, sendMessage, sendMessage, setBean, setController, setDebug, setGUIObject, setName, setOutput, setOutputWriter, toString, windowClosing`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### NetAgent

    public NetAgent()

### NetAgent

    public NetAgent(int p)

Method Detail

### live

    public void live()

  Description copied from class: `Agent`
  This method defines the main behavior of threaded agents.

  Overrides:
    `live` in class `Agent`

### activate

    public void activate()

  Description copied from class: `MadkitNetworkAgent`
  This methods has been overloaded to initialize some of the variables provided by this agent. Please remember to all it before your own activate method.

  Overrides:
    `activate` in class `MadkitNetworkAgent`
  See Also:
    `AbstractAgent.activate()`

### end

    public void end()

  Description copied from class: `AbstractAgent`
  This method is called by the agent micro-kernel at the end of the agent lifecycle. If the the agent is killed from the outside, it is the last opportunity for the agent to cleanly shutdown its operations. Although it is "nicer" to make the agent leave its groups, the handled groups and roles are automatically leaved after this last step

  Overrides:
    `end` in class `AbstractAgent`

### initGUI

    public void initGUI()

  Description copied from class: `AbstractAgent`
  This method is called by the specific external graphic system (as the G-Box) to ask the agent to prepare a graphical interface. The agent developer should use a setGUIObject(...) within this method, as well as other necessary initializations. If the developer does not overload this method, a vanilla text output might be used as the default interface.

  Overrides:
    `initGUI` in class `AbstractAgent`

### getPort

    public int getPort()

  Returns:

### handleNetworkMessage

    protected void handleNetworkMessage(NetworkMessage message)

  Description copied from class: `MadkitNetworkAgent`
  Handles the internal messages.

  Specified by:
    `handleNetworkMessage` in class `MadkitNetworkAgent`
  See Also:
    `NetworkMessage`

### handleConfigMessage

    protected void handleConfigMessage(NetConfigMessage message)

  Description copied from class: `MadkitNetworkAgent`
  Handles the Configuration messages. These messages might have influence only in a few type of agents.

  Overrides:
    `handleConfigMessage` in class `MadkitNetworkAgent`
  See Also:
    `NetConfigMessage`

### handlePersonalMessage

    protected void handlePersonalMessage(StringMessage m)

### connectKernel

    public void connectKernel(java.lang.String host,
                              int port)

  Requests the connection of the kernel at host:port

  Parameters:
    `host` - Distant host
    `port` -

### connectAgency

    public void connectAgency(java.lang.String kernelName,
                              java.lang.String host,
                              int port)

  Specified by:
    `connectAgency` in interface `Communicator`

### madkitBroadcast

    public boolean madkitBroadcast()

  Broadcasts the presence of the kernel.

  Returns:
    true if the broadcast was successful.

### isAutoBroadcast

    public boolean isAutoBroadcast()

  Returns:
    Returns the autoBroadcast.

### setAutoBroadcast

    public void setAutoBroadcast(boolean autoBroadcast)

  If the autoBroadcast is set to true, it broadcasts the presence of the kernel.

  Parameters:
    `autoBroadcast` - The autoBroadcast to set.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Madkit Team (O. Gutknecht, J. Ferber, F. Michel et al.) All Rights Reserved.