Magentix2  2.1.1
es.upv.dsic.gti_ia.jason.JasonAgent Class Reference
Inheritance diagram for es.upv.dsic.gti_ia.jason.JasonAgent:
Collaboration diagram for es.upv.dsic.gti_ia.jason.JasonAgent:

List of all members.

Public Member Functions

 JasonAgent (AgentID aid, String filename, MagentixAgArch arch) throws Exception
void Shutdown ()
void stopReasoning ()
MagentixAgArch getAgArch ()
void onMessage (ACLMessage msg)

Protected Member Functions

void finalize (CProcessor firstProcessor, ACLMessage finalizeMessage)
void execution (CProcessor firstProcessor, ACLMessage welcomeMessage)
final void createDefaultFactory (final CAgent me)

Detailed Description

Author:
Ricard Lopez Fogues

Definition at line 19 of file JasonAgent.java.


Constructor & Destructor Documentation

es.upv.dsic.gti_ia.jason.JasonAgent.JasonAgent ( AgentID  aid,
String  filename,
MagentixAgArch  arch 
) throws Exception

Creates a new Jason Agent

Parameters:
aidAgent identifier
filenameFile with the AgentSepak code
archAgent architecture
Exceptions:
Exception

Definition at line 30 of file JasonAgent.java.

                                                                                              {
                super(aid);
                this.agArch = arch;
                this.agArch.init(filename, this);
        }

Member Function Documentation

Creates a different default factory adapted to the Jason's reasoning cycle (only no IDmessages)

Reimplemented from es.upv.dsic.gti_ia.cAgents.CAgent.

Definition at line 85 of file JasonAgent.java.

                                                                  {
                this.defaultFactory = new CFactory("DefaultFactory",null, 1,this);

                // BEGIN STATE

                BeginState BEGIN = (BeginState) defaultFactory.cProcessorTemplate()
                                .getState("BEGIN");
                class BEGIN_Method implements BeginStateMethod {
                        public String run(CProcessor myProcessor, ACLMessage msg) {
                                agArch.addMessage(msg);
                                return "FINAL";
                        }
                }
                BEGIN.setMethod(new BEGIN_Method());

                // FINAL STATE

                FinalState FINAL = new FinalState("FINAL");

                class F_Method implements FinalStateMethod {
                        public void run(CProcessor myProcessor, ACLMessage msg) {
                        }
                }
                FINAL.setMethod(new F_Method());
                defaultFactory.cProcessorTemplate().registerState(FINAL);
                defaultFactory.cProcessorTemplate().addTransition(BEGIN, FINAL);
        }
void es.upv.dsic.gti_ia.jason.JasonAgent.execution ( CProcessor  firstProcessor,
ACLMessage  welcomeMessage 
) [protected, virtual]

Executes the architecture

Implements es.upv.dsic.gti_ia.cAgents.CAgent.

Definition at line 47 of file JasonAgent.java.

                                                   {
                agArch.run();           
        }
void es.upv.dsic.gti_ia.jason.JasonAgent.finalize ( CProcessor  firstProcessor,
ACLMessage  finalizeMessage 
) [protected, virtual]

This method is executed just before the agent ends its execution

Parameters:
firstProcessorThe CProcessor managing the welcome conversation
finalizeMessageThe final message produced by this conversation

Implements es.upv.dsic.gti_ia.cAgents.CAgent.

Definition at line 40 of file JasonAgent.java.

                                                    {}

returns the architecture

Returns:

Definition at line 77 of file JasonAgent.java.

                                         {
                return agArch;
        }

OnMessage overridden to pass the messages to JasonAgent reasoning cycle

Parameters:
msgMessage received by a agent

Reimplemented from es.upv.dsic.gti_ia.cAgents.CAgent.

Definition at line 120 of file JasonAgent.java.

                                              {
                super.onMessage(msg);
                agArch.addMessage(msg);
        }

Halts the reasoning and terminates the agent's execution

Reimplemented from es.upv.dsic.gti_ia.cAgents.CAgent.

Definition at line 58 of file JasonAgent.java.

                               {
                this.stopReasoning();
                super.Shutdown();
        }

Stop the reasoning of Jason agent

Returns:

Definition at line 68 of file JasonAgent.java.

                                    {
                this.agArch.stopAg();
        }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables