|
From: <jom...@us...> - 2008-07-02 10:14:00
|
Revision: 1346
http://jason.svn.sourceforge.net/jason/?rev=1346&view=rev
Author: jomifred
Date: 2008-07-02 03:13:59 -0700 (Wed, 02 Jul 2008)
Log Message:
-----------
set sender of messages in .send and .broadcast
Modified Paths:
--------------
trunk/src/jason/asSemantics/Message.java
trunk/src/jason/infra/centralised/CentralisedAgArch.java
trunk/src/jason/stdlib/broadcast.java
trunk/src/jason/stdlib/send.java
Modified: trunk/src/jason/asSemantics/Message.java
===================================================================
--- trunk/src/jason/asSemantics/Message.java 2008-06-26 15:02:50 UTC (rev 1345)
+++ trunk/src/jason/asSemantics/Message.java 2008-07-02 10:13:59 UTC (rev 1346)
@@ -119,9 +119,12 @@
this.inReplyTo = inReplyTo;
}
- public Object clone() {
+ public Message copy() {
return new Message(this);
}
+ public Object clone() {
+ return new Message(this);
+ }
public String toString() {
String irt = (inReplyTo == null ? "" : "->"+inReplyTo);
Modified: trunk/src/jason/infra/centralised/CentralisedAgArch.java
===================================================================
--- trunk/src/jason/infra/centralised/CentralisedAgArch.java 2008-06-26 15:02:50 UTC (rev 1345)
+++ trunk/src/jason/infra/centralised/CentralisedAgArch.java 2008-07-02 10:13:59 UTC (rev 1346)
@@ -233,7 +233,6 @@
// this is used by the .send internal action in stdlib
public void sendMsg(Message m) throws ReceiverNotFoundException {
// actually send the message
- m.setSender(getAgName());
CentralisedAgArch rec = masRunner.getAg(m.getReceiver());
if (rec == null) {
@@ -242,14 +241,12 @@
else
return;
}
- rec.receiveMsg(new Message(m)); // send a cloned message
+ rec.receiveMsg(m.copy()); // send a cloned message
// notify listeners
- if (msgListeners != null) {
- for (MsgListener l: msgListeners) {
+ if (msgListeners != null)
+ for (MsgListener l: msgListeners)
l.msgSent(m);
- }
- }
}
public void receiveMsg(Message m) {
Modified: trunk/src/jason/stdlib/broadcast.java
===================================================================
--- trunk/src/jason/stdlib/broadcast.java 2008-06-26 15:02:50 UTC (rev 1345)
+++ trunk/src/jason/stdlib/broadcast.java 2008-07-02 10:13:59 UTC (rev 1346)
@@ -77,7 +77,7 @@
} catch (ArrayIndexOutOfBoundsException e) {
throw new JasonException("The internal action 'broadcast' has not received two arguments.");
}
- Message m = new Message(ilf.toString(), null, null, pcnt);
+ Message m = new Message(ilf.toString(), ts.getUserAgArch().getAgName(), null, pcnt);
try {
ts.getUserAgArch().broadcast(m);
Modified: trunk/src/jason/stdlib/send.java
===================================================================
--- trunk/src/jason/stdlib/send.java 2008-06-26 15:02:50 UTC (rev 1345)
+++ trunk/src/jason/stdlib/send.java 2008-07-02 10:13:59 UTC (rev 1346)
@@ -148,7 +148,7 @@
} catch (ArrayIndexOutOfBoundsException e) {
throw new JasonException("The internal action 'send' to '"+to+"' has not received three arguments.");
}
- Message m = new Message(ilf.toString(), null, null, pcnt);
+ Message m = new Message(ilf.toString(), ts.getUserAgArch().getAgName(), null, pcnt);
// async ask has a fourth argument and should suspend the intention
lastSendWasSynAsk = m.isAsk() && args.length > 3;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|