Useful Java Programming Code
Common java classes to import at the top of your code.
Simple input from a user using standard input"
public ProvisionCell AskUser(LinkedListQ Plist, Agent Local) throws Exception {
BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));
System.out.println("Which State? ");
String query = inFromUser.readLine();
}
Elements of interest:
DECAF Util class
see Util.java in the DECAF architecture files.
Examples:
Explanation:
KQML Message Structure Example
Making and populating a new KQML message:
KQMLmsg K = new KQMLmsg();
K.addFieldValuePair("performative", "ask-all");
K.addFieldValuePair("sender", Local.getName());
K.addFieldValuePair("receiver", "Matchmaker");
K.addFieldValuePair("reply-with", Util.getValue(Plist, "REPLY-TOKEN"));
K.addFieldValuePair("language", "DECAF");
K.addFieldValuePair("ontology", "Matchmaker");
K.addFieldValuePair("content", ":keywords Information Extraction "+":percentage 100 :agentNbr 0");
return new ProvisionCell(K.getKQMLString(),"OK");