From: <jom...@us...> - 2009-02-15 11:13:24
|
Revision: 1445 http://jason.svn.sourceforge.net/jason/?rev=1445&view=rev Author: jomifred Date: 2009-02-15 11:13:20 +0000 (Sun, 15 Feb 2009) Log Message: ----------- for messages send to itself, the sender is 'self' now, and not the agent's name Modified Paths: -------------- trunk/src/jason/asSemantics/TransitionSystem.java trunk/src/jason/asSyntax/VarTerm.java Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2009-02-14 18:08:49 UTC (rev 1444) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2009-02-15 11:13:20 UTC (rev 1445) @@ -23,7 +23,6 @@ package jason.asSemantics; -import jade.domain.introspection.GetValue; import jason.JasonException; import jason.RevisionFailedException; import jason.architecture.AgArch; @@ -194,8 +193,11 @@ } else if (conf.ag.socAcc(m)) { // generate an event + String sender = m.getSender(); + if (sender.equals(agArch.getAgName())) + sender = "self"; Literal received = new LiteralImpl("kqml_received").addTerms( - new Atom(m.getSender()), + new Atom(sender), new Atom(m.getIlForce()), content, new Atom(m.getMsgId())); Modified: trunk/src/jason/asSyntax/VarTerm.java =================================================================== --- trunk/src/jason/asSyntax/VarTerm.java 2009-02-14 18:08:49 UTC (rev 1444) +++ trunk/src/jason/asSyntax/VarTerm.java 2009-02-15 11:13:20 UTC (rev 1445) @@ -271,9 +271,11 @@ @Override public void addTerm(Term t) { - if (value != null && value.isStructure()) { - ((Structure)getValue()).addTerm(t); - } + if (value != null) + if (value.isStructure()) + ((Structure)getValue()).addTerm(t); + else + logger.log(Level.WARNING, "The addTerm '"+t+"' in "+this+" was lost, since this var value is not a Structure. The value's class is "+getValue().getClass().getName(), new Exception()); } @Override @@ -296,8 +298,13 @@ @Override public Literal setTerms(List<Term> l) { - if (value != null && value.isStructure()) { - return ((Structure)getValue()).setTerms(l); + if (value != null) { + if (value.isStructure()) { + return ((Structure)getValue()).setTerms(l); + } else { + logger.log(Level.WARNING, "The setTerms '"+l+"' in "+this+" was lost, since this var value is not a Structure. The value's class is "+getValue().getClass().getName(), new Exception()); + return null; + } } else { return this; } @@ -305,16 +312,20 @@ @Override public void setTerm(int i, Term t) { - if (value != null && value.isStructure()) { - ((Structure)getValue()).setTerm(i,t); - } + if (value != null) + if (value.isStructure()) + ((Structure)getValue()).setTerm(i,t); + else + logger.log(Level.WARNING, "The setTerm '"+t+"' in "+this+" was lost, since this var value is not a Structure. The value's class is "+getValue().getClass().getName(), new Exception()); } @Override public Literal addTerms(List<Term> l) { - if (value != null && value.isStructure()) { - return ((Structure)getValue()).addTerms(l); - } + if (value != null) + if (value.isStructure()) + return ((Structure)getValue()).addTerms(l); + else + logger.log(Level.WARNING, "The addTerms '"+l+"' in "+this+" was lost, since this var value is not a Structure. The value's class is "+getValue().getClass().getName(), new Exception()); return this; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |