Magentix2  2.1.1
jason.stdlib.ia_JAuc_Participant Class Reference
Inheritance diagram for jason.stdlib.ia_JAuc_Participant:
Collaboration diagram for jason.stdlib.ia_JAuc_Participant:

List of all members.

Public Member Functions

int getMinArgs ()
int getMaxArgs ()
void checkArguments (Term[] args) throws JasonException
Object execute (TransitionSystem ts, Unifier un, Term[] args) throws Exception

Package Attributes

Jason_JAuc_Participant jaucp

Detailed Description

This class represents the internal action to be used when adding a conversation to a Jason agent under the Japanese Auction Protocol as participant

Author:
Bexy Alfonso Espinosa

Definition at line 24 of file ia_JAuc_Participant.java.


Member Function Documentation

void jason.stdlib.ia_JAuc_Participant.checkArguments ( Term[]  args) throws JasonException

Definition at line 40 of file ia_JAuc_Participant.java.

        {
                super.checkArguments(args);
                boolean result = false;

                if (  (((Term)args[args.length-1]).isAtom())||
                                (((Term)args[args.length-1]).isString())||
                                (((Term)args[args.length-1]).isLiteral())||
                                (((Term)args[args.length-1]).isNumeric())){result=true;}

                result = (result && (((Term)args[0]).isString()) );
                if ( protocolSteep.compareTo(Protocol_Template.JOIN_STEP)==0)
                {
                        result = (result && (((Term)args[1]).isNumeric()) );
                }
        }
Object jason.stdlib.ia_JAuc_Participant.execute ( TransitionSystem  ts,
Unifier  un,
Term[]  args 
) throws Exception

Definition at line 59 of file ia_JAuc_Participant.java.

                                                                                             {
                agentConversationID = getTermAsString( args[args.length-1]);
                protocolSteep = getTermAsString(args[0]);
                ts.getAg().getLogger().fine("CALLING INTERNAL ACTION WITH STEEP: '"+protocolSteep+"'"+" CID: "+agentConversationID); 
                checkArguments(args);
                agName  = ts.getUserAgArch().getAgName();
                if (protocolSteep.compareTo(Protocol_Template.JOIN_STEP)==0){
                        if (args.length >2)
                        {                                       
                                timeOut = getTermAsInt(args[1]);
                        }
                        if (jaucp == null){
                                jaucp = new Jason_JAuc_Participant( ts);
                        }
                        ACLMessage msg = new ACLMessage();
                        msg.setProtocol("japanese-auction");
                        msg.setContent("Joining japanese-auction conversation "+agentConversationID);
                        String myfactName = getFactoryName(agentConversationID,"JAUC",false);
                        String inifactName = getFactoryName(agentConversationID,"JAUC",true);
                        MessageFilter filter = new MessageFilter("protocol = japanese-auction AND purpose = startdata AND factoryname = "+inifactName);
                        // The factory is setup to answer to incoming messages that
                        // can start the participation of the agent in a new conversation
                        ConvCFactory tmpFactory = jaucp.newFactory(myfactName, filter,msg,1, 
                                        ((ConvMagentixAgArch)ts.getUserAgArch()).getJasonAgent(),timeOut);
                        ((ConvMagentixAgArch)ts.getUserAgArch()).getJasonAgent().addFactoryAsParticipant(tmpFactory);
                        CFactories.put(agentConversationID, tmpFactory);
                }
                else
                        if (protocolSteep.compareTo(Protocol_Template.AGREE_STEP)==0){

                                if (conversationsList.get(agentConversationID) == null)
                                {       ConvCFactory tmpFactory = CFactories.get(agentConversationID);
                                Conversation conv = tmpFactory.removeConversationByJasonID(agentConversationID);
                                conversationsList.put(agentConversationID, conv);
                                CFactories.remove(agentConversationID);
                                }

                                ((JAucPartConversation)conversationsList.get(agentConversationID)).Accept = true;
                                conversationsList.get(agentConversationID).release_semaphore();
                        }
                        else
                                if (protocolSteep.compareTo(Protocol_Template.WITHDRAWAL_STEP)==0){
                                        if (conversationsList.get(agentConversationID) == null)
                                        {   ConvCFactory tmpFactory = CFactories.get(agentConversationID);
                                        Conversation conv = tmpFactory.removeConversationByJasonID(agentConversationID);
                                        conversationsList.put(agentConversationID, conv);
                                        CFactories.remove(agentConversationID);

                                        }
                                        ((JAucPartConversation)conversationsList.get(agentConversationID)).Accept = false;
                                        conversationsList.get(agentConversationID).release_semaphore();
                                }
                return true;
        }

Definition at line 37 of file ia_JAuc_Participant.java.

{ return 3; };

Definition at line 36 of file ia_JAuc_Participant.java.

{ return 2; };

Member Data Documentation


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