SEdit
Class StructureAgent

java.lang.Object
  extended by madkit.kernel.AbstractAgent
      extended by madkit.kernel.Agent
          extended by SEdit.StructureAgent
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable
Direct Known Subclasses:
FormalismStructureAgent, Warbot

public class StructureAgent
extends Agent

See Also:
Serialized Form

Field Summary
 java.lang.Object clipboard
           
static java.lang.String DATE
           
protected  java.lang.String fileName
           
protected  Formalism formalism
           
 StructureBean gui
           
protected  AgentAddress recipient
           
protected  Structure structure
           
static java.lang.String VERSION
           
 
Constructor Summary
StructureAgent()
           
StructureAgent(Formalism f)
          Create a StructureAgent with a formalism
StructureAgent(Formalism f, java.lang.String _fileName)
          Create a StructureAgent which has to load its content from a file.
 
Method Summary
 void activate()
          This method is initially called when the micro-kernel registers the agent.
 boolean askMessageBoxEmpty()
          glue code
 void close()
           
 void doBroadcastMessage(java.lang.String g, java.lang.String r, Message m)
          glue code
 SElement doCommand(Command c)
           
 void doKillAgent(AbstractAgent a)
          glue code
 void doLaunchAgent(AbstractAgent a, java.lang.String n, boolean gui)
           
 void doPause(int m)
          glue code
 void doSendMessage(AgentAddress a, Message m)
          glue code
 void end()
          apply the end operation to its structure before dying..
 java.lang.Object getClipBoard()
           
 java.lang.String getFileName()
           
 Formalism getFormalism()
          get the related formalism
 Formalism getFormalism(java.lang.String s)
          get the related formalism if its name equals s
 AgentAddress getRecipient()
           
 boolean getShowElementPanel()
           
 Structure getStructure()
          get the related structure
protected  void handleMessage(SEditMessage m)
           
 void initEditor()
           
 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.
 void initStructure()
          Create a structure and initialize it.
 void insertClipBoard()
           
 void insertXMLFile(java.lang.String fileName, boolean selected)
           
 boolean isFormalismCompatible(java.lang.String fname)
          Indicates if the associated formalism is compatible with the formalism fname.
 void live()
          This method defines the main behavior of threaded agents.
 void makeLaunchAgent(java.lang.String cl, java.lang.String n)
          creates and launches an agent of a given class
 SArrow newArrow(boolean selected, ArrowDesc nd, java.lang.String id, java.lang.String fromID, java.lang.String toID, java.lang.String label, java.util.Hashtable properties, java.awt.Point p, java.util.Hashtable graphicProperties)
          Creates a component and initialize all fields and properties.
 SComponent newComponent(boolean selected, ComponentDesc nd, java.lang.String id, java.lang.String label, java.util.Hashtable properties, java.awt.Point p, java.util.Hashtable graphicProperties, java.util.Hashtable connectors, java.util.Hashtable placement)
          Creates a component and initialize all fields and properties.
 SNode newNode(boolean selected, NodeDesc nd, java.lang.String id, java.lang.String label, java.util.Hashtable properties, java.awt.Point p, java.util.Hashtable graphicProperties)
          Creates a node and initialize all fields and properties.
 void println(java.lang.String s)
          Prints text information in an environment-independent way (GUI, console, ...)
 void saveXMLFile(java.lang.String _fileName)
           
 LList schemeGetAgentsWithRole(java.lang.String g, java.lang.String r)
          Java-Scheme glue code : getAgentsWithRole
 LList schemeGetAgentsWithRole(java.lang.String c, java.lang.String g, java.lang.String r)
           
 LList schemeGetAvailableCommunities()
          Java-Scheme glue code : getAvailableCommunities
 LList schemeGetExistingGroups()
          Java-Scheme glue code : getExistingGroups
 LList schemeGetExistingGroups(java.lang.String c)
           
 LList schemeGetExistingRoles(java.lang.String g)
          Java-Scheme glue code : getRoles
 LList schemeGetExistingRoles(java.lang.String c, java.lang.String g)
           
 LList schemeGetMyGroups()
          Java-Scheme glue code : getMyGroups
 LList schemeGetMyGroups(java.lang.String c)
           
 LList schemeGetMyRoles(java.lang.String g)
          Java-Scheme glue code : getRoles
 LList schemeGetMyRoles(java.lang.String c, java.lang.String g)
           
 LList schemeGetRoles(java.lang.String g)
          Java-Scheme glue code : getRoles
 LList schemeGetRoles(java.lang.String c, java.lang.String g)
           
 void sendToRecipient(Message m)
           
 void setClipBoard(java.lang.Object o)
           
 void setRecipient(AgentAddress ag)
           
 void setShowElementPanel(boolean b)
           
 
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, debug, 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, print, 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
 

Field Detail

VERSION

public static java.lang.String VERSION

DATE

public static java.lang.String DATE

gui

public StructureBean gui

clipboard

public java.lang.Object clipboard

formalism

protected Formalism formalism

structure

protected Structure structure

fileName

protected java.lang.String fileName

recipient

protected AgentAddress recipient
Constructor Detail

StructureAgent

public StructureAgent(Formalism f)
Create a StructureAgent with a formalism

Parameters:
f - the formalism

StructureAgent

public StructureAgent(Formalism f,
                      java.lang.String _fileName)
Create a StructureAgent which has to load its content from a file. The content is loaded in 'insert' mode.

Parameters:
fileDir - directory of the file
fileName - name of the file

StructureAgent

public StructureAgent()
Method Detail

getFileName

public java.lang.String getFileName()

getShowElementPanel

public boolean getShowElementPanel()

setShowElementPanel

public void setShowElementPanel(boolean b)

getRecipient

public AgentAddress getRecipient()

setRecipient

public void setRecipient(AgentAddress ag)

initStructure

public void initStructure()
Create a structure and initialize it.


initEditor

public void initEditor()

getStructure

public Structure getStructure()
get the related structure

Returns:
the structure

getFormalism

public Formalism getFormalism()
get the related formalism

Returns:
the formalism

getFormalism

public Formalism getFormalism(java.lang.String s)
get the related formalism if its name equals s

Parameters:
s - the name of the formalism
Returns:
the formalism

isFormalismCompatible

public boolean isFormalismCompatible(java.lang.String fname)
Indicates if the associated formalism is compatible with the formalism fname. By default, this test reduces to a simple equals between names

Parameters:
fname - the name of the formalism whose compatibility is tested
Returns:
true if the formalism is compatible, false otherwise

setClipBoard

public void setClipBoard(java.lang.Object o)

getClipBoard

public java.lang.Object getClipBoard()

insertClipBoard

public void insertClipBoard()

insertXMLFile

public void insertXMLFile(java.lang.String fileName,
                          boolean selected)

saveXMLFile

public void saveXMLFile(java.lang.String _fileName)

activate

public void activate()
Description copied from class: AbstractAgent
This method is initially called when the micro-kernel registers the agent. Usually a good place to set up some initial groups and roles.

Here is a typical example (taken from the PingPong agent of MadKit (plugin demos)) :

public void activate()
{
        try {
                createGroup(true,"ping-pong",null,null);
                println ("No ping-pong group : I created one");
                creator=true;
        } catch (OrganizationRequestException e) { // the group already exists
                creator=false;
                println ("A ping-pong group already exists : I will join");
        }
        requestRole("ping-pong","player",null);
}
 

Overrides:
activate 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

live

public void live()
Description copied from class: Agent
This method defines the main behavior of threaded agents.

Overrides:
live in class Agent

end

public void end()
apply the end operation to its structure before dying..

Overrides:
end in class AbstractAgent

close

public void close()

handleMessage

protected void handleMessage(SEditMessage m)

newComponent

public SComponent newComponent(boolean selected,
                               ComponentDesc nd,
                               java.lang.String id,
                               java.lang.String label,
                               java.util.Hashtable properties,
                               java.awt.Point p,
                               java.util.Hashtable graphicProperties,
                               java.util.Hashtable connectors,
                               java.util.Hashtable placement)
Creates a component and initialize all fields and properties. Call an init method at the end


newNode

public SNode newNode(boolean selected,
                     NodeDesc nd,
                     java.lang.String id,
                     java.lang.String label,
                     java.util.Hashtable properties,
                     java.awt.Point p,
                     java.util.Hashtable graphicProperties)
Creates a node and initialize all fields and properties. Call an init method at the end


newArrow

public SArrow newArrow(boolean selected,
                       ArrowDesc nd,
                       java.lang.String id,
                       java.lang.String fromID,
                       java.lang.String toID,
                       java.lang.String label,
                       java.util.Hashtable properties,
                       java.awt.Point p,
                       java.util.Hashtable graphicProperties)
Creates a component and initialize all fields and properties. Calls an init method at the end


doCommand

public SElement doCommand(Command c)

sendToRecipient

public void sendToRecipient(Message m)

doPause

public void doPause(int m)
glue code


askMessageBoxEmpty

public boolean askMessageBoxEmpty()
glue code


doSendMessage

public void doSendMessage(AgentAddress a,
                          Message m)
glue code


doBroadcastMessage

public void doBroadcastMessage(java.lang.String g,
                               java.lang.String r,
                               Message m)
glue code


println

public void println(java.lang.String s)
Description copied from class: AbstractAgent
Prints text information in an environment-independent way (GUI, console, ...)

Overrides:
println in class AbstractAgent
Parameters:
s - the string

doKillAgent

public void doKillAgent(AbstractAgent a)
glue code


makeLaunchAgent

public void makeLaunchAgent(java.lang.String cl,
                            java.lang.String n)
creates and launches an agent of a given class


doLaunchAgent

public void doLaunchAgent(AbstractAgent a,
                          java.lang.String n,
                          boolean gui)

schemeGetAgentsWithRole

public LList schemeGetAgentsWithRole(java.lang.String g,
                                     java.lang.String r)
Java-Scheme glue code : getAgentsWithRole


schemeGetAgentsWithRole

public LList schemeGetAgentsWithRole(java.lang.String c,
                                     java.lang.String g,
                                     java.lang.String r)

schemeGetMyGroups

public LList schemeGetMyGroups()
Java-Scheme glue code : getMyGroups


schemeGetMyGroups

public LList schemeGetMyGroups(java.lang.String c)

schemeGetExistingGroups

public LList schemeGetExistingGroups()
Java-Scheme glue code : getExistingGroups


schemeGetExistingGroups

public LList schemeGetExistingGroups(java.lang.String c)

schemeGetRoles

public LList schemeGetRoles(java.lang.String g)
Java-Scheme glue code : getRoles


schemeGetRoles

public LList schemeGetRoles(java.lang.String c,
                            java.lang.String g)

schemeGetExistingRoles

public LList schemeGetExistingRoles(java.lang.String g)
Java-Scheme glue code : getRoles


schemeGetExistingRoles

public LList schemeGetExistingRoles(java.lang.String c,
                                    java.lang.String g)

schemeGetMyRoles

public LList schemeGetMyRoles(java.lang.String g)
Java-Scheme glue code : getRoles


schemeGetMyRoles

public LList schemeGetMyRoles(java.lang.String c,
                              java.lang.String g)

schemeGetAvailableCommunities

public LList schemeGetAvailableCommunities()
Java-Scheme glue code : getAvailableCommunities



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