--------------- Java+ Constants --------------- $AG_NAME type: java.lang.String value: Name of the agent. For example: "Max". $AG_HOST type: java.lang.String value: Hostname of the computer where the agent is located. For example: "perun.im.ns.ac.yu". $AG_RMI_PORT type: int value: Port on which agent listens for RMI calls. For example: 1099. $AG_HTTP_PORT type: int value: Port on which agent listens for HTTP requests. For example: 1971. $AG_SSL_PORT type: int value: Port on which agent listens for SSL connections. For example: 3456. $AG_RMI_URL type: java.lang.String value: RMI URL of the agent (e.g. "//perun.im.ns.ac.yu:1099/Max"). $AG_HTTP_URL type: java.lang.String value: HTTP URL of the agent (e.g. "http://perun.im.ns.ac.yu:1971/Max"). $AG_SSL_ADDRESS type: java.lang.String value: SSL address of the agent (e.g. "perun.im.ns.ac.yu:3456"). $AG_JFRAME type: javax.swing.JFrame value: Agent window. ---------------------------- Java+ Constructs for Beliefs ---------------------------- $GET_BEL(belName) parameter: belName - name of the belief. type: Depends on the type of the belief. value: Belief value. $GET_BEL(belName(param1, ...)) parameter: belName(param1, ...) - name of the dependant belief (neural net) and real parameters. type: double value: Output of the neural net for given parameters. $SET_BEL(belName, value) parameter: belName - name of the belief. parameter: value - value of the belief to set, type: depends on the belief type. type: void $AP_BAD(belName) parameter: belName - name of the adaptable belief. type: void //negative reinforcement for an adaptable belief $AP_HIGHER(belName) parameter: belName - name of the adaptable belief. type: void //negative reinforcement for an adaptable belief; //the value should be higher $AP_LOWER(belName) parameter: belName - name of the adaptable belief. type: void //negative reinforcement for an adaptable belief; //the value should be lower $AP_TO_FILE(belName, fileName) parameter: belName - name of the adaptable belief. parameter: fileName - name of the file, type: java.lang.String. type: void throws java.io.IOException //saves adaptable belief to a file $AP_FROM_FILE(belName, fileName) parameter: belName - name of the adaptable belief. parameter: fileName - name of the file, type: java.lang.String. type: void throws java.io.IOException, java.lang.ClassNotFoundException //load adaptable belief from a file $DV_OFFLINE_TRAINING(belName, maxCycles, maxAverageError) parameter: belName - name of the dependant belief. parameter: maxCycles - upper bound for the number of the learning iterations, type: int. parameter: maxAverageError - upper bound for the maximal average error in percents allowed, type: double. type: double value: Average error of the neural network after learning, in percents. $DV_SHOULD_BE(belName(param1, ...), value) parameter: belName(param1, ...) - name of the dependant belief (neural net) and real parameters. parameter: value - the correct value of the network output, type: double. type: void $DV_TO_FILE(belName, fileName) parameter: belName - name of the dependant belief (neural net). parameter: fileName - name of the file, type: java.lang.String. type: void throws java.io.IOException //saves dependent belief to a file $DV_FROM_FILE(belName, fileName) parameter: belName - name of the dependant belief (neural net). parameter: fileName - name of the file, type: java.lang.String. type: void throws java.io.IOException, java.lang.ClassNotFoundException //loads dependent belief from a file ---------------------------- Java+ Constructs for Actions ---------------------------- $EXEC(actionName, par1, par2, ...) parameter: actionName - name of the action to execute, type: java.lang.String. optional parameters: par1, par2, ... - real parameters for the action execution. type: depends on the action value: Action return value (if the type is not void). //Executes the action in current thread. $EXEC_PARALLEL(actionName, par1, par2, ...) parameter: actionName - name of the action to execute. optional parameters: par1, par2, ... - real parameter for the action execution. type: void //Executes the action in a new thread. $EXEC_AT(date, actionName, par1, par2, ...) parameter: date - time point when the action execution should be started, type: java.util.Date. parameter: actionName - name of the action to execute. optional parameters: par1, par2, ... - real parameter for the action execution. type: void //Executes the action in a new thread at specified time. $IS_EXECUTING_ACTION(actionName) parameter: actionName - name of an action. type: boolean. value: true if the specified action is being executed, false otherwise. $IS_WAITING_ACTION(actionName) parameter: actionName - name of an action. type: boolean. value: true if the specified action is waiting to be executed, false otherwise. --------------------------------- Java+ Constructs for Negotiations --------------------------------- $NEGOTIATE(negName, par1, par2, ...) parameter: negName - name of the requesting negotiation to activate. optional parameters: par1, par2, ... - real parameter for the negotiation activation. type: depends on the requesting negotiation value: Requesting negotiation return value (if the type is not void) //Activates the requesting negotiation in current thread. $NEGOTIATE_PARALLEL(negName, par1, par2, ...) parameter: negName - name of the requesting negotiation to activate. optional parameters: par1, par2, ... - real parameter for the negotiation activation. type: void //Activates the requesting negotiation in new thread. $NEGOTIATE_AT(date, negName, par1, par2, ...) parameter: date - time point when the requesting negotiation activation should be started, type: java.util.Date. parameter: negName - name of the requesting negotiation to activate. optional parameters: par1, par2, ... - real parameter for the negotiation activation. type: void //Activates the requesting negotiation in new thread at //specified time. $STATE(newState) parameter: newState - name of the next state in negotiation. type: void $IS_ACTIVE_NEGOTIATION(negName) parameter: negName - name of a negotiation. type: boolean. value: true if the specified negotiation is currently active, false otherwise. $SEND_FIRST(toAgentRMIURL, speechAct, obj1, obj2, ... ) parameter: toAgentRMIURL - RMI URL of the message receiver agent, type: java.lang.String. parameter: speechAct - speech act of the message, type: java.lang.String. optional parameters: obj1, obj2, ... - serializable java objects, type: java.lang.Object. type: java.lang.String value: ID of the communication session throws aja.framework.CommunicationException //Sends the first message in a communication session $SEND_FIRST_SIGNED(toAgentRMIURL, speechAct, obj1, obj2, ... ) parameter: toAgentRMIURL - RMI URL of the message receiver agent, type: java.lang.String. parameter: speechAct - speech act of the message, type: java.lang.String. optional parameters: obj1, obj2, ... - serializable java objects, type: java.lang.Object. type: java.lang.String value: ID of the communication session throws aja.framework.CommunicationException //Sends the first message in a communication session //with the digital signature. $SEND_FIRST_ENCRYPTED(toAgentSSLAddress, speechAct, obj1, obj2, ... ) parameter: toAgentSSLAddress - SSL address of the agent to whom the message is sent (e.g. "bambi.im.ns.ac.yu:3456"). The address consists of a hostname, colon, and a SSL port number. type: java.lang.String. parameter: speechAct - speech act of the message, type: java.lang.String. optional parameters: obj1, obj2, ... - serializable java objects, type: java.lang.Object. type: java.lang.String value: ID of the communication session throws aja.framework.CommunicationException //Sends the first message in a communication session //using SSL protocol. $REPLY(toAgentRMIURL, sessionID, speechAct, obj1, obj2, ... ) parameter: toAgentRMIURL - RMI URL of the message receiver agent, type: java.lang.String. parameter: sessionID - ID of the communication session, type: java.lang.String. parameter: speechAct - speech act of the message, type: java.lang.String. optional parameters: obj1, obj2, ... - serializable java objects, type: java.lang.Object. type: void throws aja.framework.CommunicationException //Sends a reply message in a communication session $REPLY_SIGNED(toAgentRMIURL, sessionID, speechAct, obj1, obj2, ... ) parameter: toAgentRMIURL - RMI URL of the message receiver agent, type: java.lang.String. parameter: sessionID - ID of the communication session, type: java.lang.String. parameter: speechAct - speech act of the message, type: java.lang.String. optional parameters: obj1, obj2, ... - serializable java objects, type: java.lang.Object. type: void throws aja.framework.CommunicationException //Sends a reply message in a communication session //with the digital signature. $REPLY_ENCRYPTED(toAgentSSLAddress, sessionID, speechAct, obj1, obj2, ... ) parameter: toAgentSSLAddress - SSL address of the agent to whom the message is sent (e.g. "bambi.im.ns.ac.yu:3456"). The address consists of a hostname, colon, and a SSL port number. type: java.lang.String. parameter: sessionID - ID of the communication session, type: java.lang.String. parameter: speechAct - speech act of the message, type: java.lang.String. optional parameters: obj1, obj2, ... - serializable java objects, type: java.lang.Object. type: void throws aja.framework.CommunicationException //Sends a reply message in a communication session //using SSL protocol. $GET_ANSW(sessionID, maxWaitMillis) parameter: sessionID - ID of the communication session, type: java.lang.String. parameter: maxWaitMillis - milliseconds to wait for the answer. If the answer arrives before the specified time elapses, the answer is immediately returned and the current thread continues with the execution. type: long. type: aja.framework.MessageData value: the answer from the agent to whom a message had been previously sent, or null if the answer has not arrived in specified time throws aja.framework.CommunicationException $GET_ANSW_SIGNED(sessionID, maxWaitMillis) parameter: sessionID - ID of the communication session, type: java.lang.String. parameter: maxWaitMillis - milliseconds to wait for the answer. If the digitally signed or encrypted answer arrives before the specified time elapses, the answer is immediately returned and the current thread continues with the execution. type: long. type: aja.framework.MessageData value: the answer from the agent to whom a message had been previously sent, or null if the answer has not arrived in specified time throws aja.framework.CommunicationException $GET_ANSW_ENCRYPTED(sessionID, maxWaitMillis) parameter: sessionID - ID of the communication session, type: java.lang.String. parameter: maxWaitMillis - milliseconds to wait for the answer. If the encrypted answer arrives before the specified time elapses, the answer is immediately returned and the current thread continues with the execution. type: long. type: aja.framework.MessageData value: the answer from the agent to whom a message had been previously sent, or null if the answer has not arrived in specified time throws aja.framework.CommunicationException ---------------------------- Java+ Construct for Reflexes ---------------------------- $TRIGGER_REFLEXES type: void // forces all reflexes to fire. ------------------------------------ Java+ Constructs for WWW Negotiation ------------------------------------ $WWW_DISPLAY_TEXT(text) parameter: text - text to display on the page, type: java.lang.String. type: void throws: aja.framework.WebException //Sends a simple html page with text only. //After the page sending, the connection //with browser is closed. This is always the last html page //sending in a web negotiation. //This function must not be nested in a Java statement. $WWW_DISPLAY_TEXT(text, bNames) parameter: text - text to display, type: java.lang.String. parameter: bNames - labels for buttons, type: java.lang.String[]. type: aja.framework.ButtonSelection value: user response. throws: aja.framework.WebException //Sends a html page with text and buttons. //Because the user answer is expected and because the answer //comes as a new http request, this should not be the last html //page sending in the web negotiation. //This function must not be nested in a Java statement. $WWW_GET_LONG_TEXT(desc, bNames, initText) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: initText - initial (default) text, type: java.lang.String. type: aja.framework.TextInput value: User response. throws: aja.framework.WebException //Obtains long text input from web user. //This function must not be nested in a Java statement. $WWW_GET_ONE_LINE_TEXT(desc, bNames, initText) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: initText - initial (default) text, type: java.lang.String. type: aja.framework.TextInput value: User response. throws: aja.framework.WebException //Obtains one-line text input from web user. //This function must not be nested in a Java statement. $WWW_GET_COMBO(desc, items, bNames, selected) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: items - items in the combo box, type: java.lang.String[]. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: selected - index of the initially selected combo-box item, type: int. type: aja.framework.SingleSelection value: User response. throws: aja.framework.WebException //Obtains combo-box selection from web user. //This function must not be nested in a Java statement. $WWW_GET_LIST_SINGLE(desc, items, bNames, selected) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: items - items in the list, type: java.lang.String[]. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: selected - index of the initially selected list item, type: int. type: aja.framework.SingleSelection value: User response. throws: aja.framework.WebException //Obtains single list selection from web user. //This function must not be nested in a Java statement. $WWW_GET_LIST_MULTIPLE(desc, items, bNames, selected) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: items - items in the list, type: java.lang.String[]. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: selected - initial selection, type: boolean[]. type: aja.framework.MultipleSelection value: User response. throws: aja.framework.WebException //Obtains multiple list selection from web user. //This function must not be nested in a Java statement. $WWW_GET_CHECK_BOXES(desc, items, bNames, selected) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: items - check-boxes items, type: java.lang.String[]. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: selected - initial selection, type: boolean[]. type: aja.framework.MultipleSelection value: User response. throws: aja.framework.WebException //Obtains check-box selection from web user. //This function must not be nested in a Java statement. $WWW_GET_RADIO(desc, items, bNames, selected) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: items - radio-buttons items, type: java.lang.String[]. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: selected - index of the initially selected item, type: int. type: aja.framework.SingleSelection value: User response. throws: aja.framework.WebException //Obtains radio-button selection from web user. //This function must not be nested in a Java statement. ------------------------ Java+ Constructs for GUI ------------------------ $REMOVE_TEXT type: void //Removes input-output components from agent window. $CLEAR_STATUS_BAR type: void //Clears the status bar of the agent window. $WRITE_STATUS_BAR(text) parameter: text - text to write in the status bar, type: java.lang.String. type: void //Writes text in the status bar of agent window. $DISPLAY_TEXT(text) parameter: text - text to display in agent window, type: java.lang.String. type: void //Displays text in the agent window. Appends text to the //text on an existing text area, or makes a new text area //with given text. In both cases the text will be visible //on agent window. Method does not block the thread that //has invoked it. $DISPLAY_TEXT(text, bNames) parameter: text - text to display, type: java.lang.String. parameter: bNames - labels for buttons, type: java.lang.String []. type: aja.framework.ButtonSelection value: User response. //Displays text with buttons and blocks the thread until //one of the buttons is clicked. $GET_LONG_TEXT(desc, bNames, initText) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: initText - initial (default) text, type: java.lang.String. type: aja.framework.TextInput value: User response. //Obtains long text from user. User has to enter a text end //to click one button. A current thread is blocked until one //of the buttons is clicked. $GET_ONE_LINE_TEXT(desc, bNames, initText) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: initText - initial (default) text, type: java.lang.String. type: aja.framework.TextInput value: User response. //Obtains one-line text from user. User has to enter a text end //to click one button. A current thread is blocked until one //of the buttons is clicked. $GET_COMBO(desc, items, bNames, selected) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: items - items in the combo box, type: java.lang.String[]. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: selected - index of the initially selected combo-box item, type: int. type: aja.framework.SingleSelection value: User response. //Obtains combo-box selection from user. User has to make //the selection and to click one button. A current thread is //blocked until one of the buttons is clicked. $GET_LIST_SINGLE(desc, items, bNames, selected) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: items - items in the list, type: java.lang.String[]. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: selected - index of the initially selected list item, type: int. type: aja.framework.SingleSelection value: User response. //Obtains a single list selection from user. User has to make //the selection and to click one button. A current thread is //blocked until one of the buttons is clicked. $GET_LIST_MULTIPLE(desc, items, bNames, selected) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: items - items in the list, type: java.lang.String[]. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: selected - initial selection, type: boolean[]. type: aja.framework.MultipleSelection value: User response. //Obtains a multiple list selection from user. //User has to make the selection and to click one button. A current //thread is blocked until one of the buttons is clicked. $GET_CHECK_BOXES(desc, items, bNames, selected) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: items - check-boxes items, type: java.lang.String[]. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: selected - initial selection, type: boolean[]. type: aja.framework.MultipleSelection value: User response. //Obtains a check-boxes selection from user. User has to make the //selection and to click one button. A current thread is blocked //until one of the buttons is clicked. $GET_RADIO(desc, items, bNames, selected) parameter: desc - text that tells user what he/she should do, type: java.lang.String. parameter: items - radio-buttons items, type: java.lang.String[]. parameter: bNames - labels for buttons, type: java.lang.String[]. parameter: selected - index of the initially selected item, type: int. type: aja.framework.SingleSelection value: User response. //Obtains a radio-button selection from user. User has to make the //selection and to click one button. A current thread is blocked //until one of the buttons is clicked. -------------------------- Remaining Java+ Constructs -------------------------- $NOW type: java.util.Calendar value: Current time. $WAIT(h, m, s, ms) parameter: h - hours, type: int. parameter: m - minutes, type: int. parameter: s - seconds, type int. parameter: ms - milliseconds, type int. type: void //Stops current thread for h hours, m minutes, //s seconds, and ms milliseconds. $WAIT_UNTIL(date) parameter: date - time point, type: java.util.Date. type: void //Stops current thread until specified time point.