|
From: <jom...@us...> - 2013-03-14 14:03:15
|
Revision: 1721
http://jason.svn.sourceforge.net/jason/?rev=1721&view=rev
Author: jomifred
Date: 2013-03-14 14:03:03 +0000 (Thu, 14 Mar 2013)
Log Message:
-----------
add a new configuration parameter to enable short names for unnamed vars
Modified Paths:
--------------
trunk/build.xml
trunk/release-notes.txt
trunk/src/jason/asSemantics/TransitionSystem.java
trunk/src/jason/asSyntax/Structure.java
trunk/src/jason/jeditplugin/Config.java
trunk/src/jason/util/ConfigGUI.java
trunk/src/jeditPlugin/agentSpeak.xml
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2013-03-13 15:12:02 UTC (rev 1720)
+++ trunk/build.xml 2013-03-14 14:03:03 UTC (rev 1721)
@@ -12,7 +12,7 @@
<property name="dist.properties" value="${basedir}/bin/dist.properties" />
<property name="version" value="1" />
- <property name="release" value="3.9-alpha" />
+ <property name="release" value="3.9" />
<property name="distDir" value="${env.HOME}/tmp/x/Jason-${version}.${release}" />
<property name="distFile" value="${env.HOME}/Jason-${version}.${release}" />
Modified: trunk/release-notes.txt
===================================================================
--- trunk/release-notes.txt 2013-03-13 15:12:02 UTC (rev 1720)
+++ trunk/release-notes.txt 2013-03-14 14:03:03 UTC (rev 1721)
@@ -5,6 +5,13 @@
---------------------------
New features
+- new operators do add beliefs
+ "++" add a belief with new focus (a new intention is created for the
+ event produced by the addition)
+ "+<" add a belief in the begin of the belief base (it is the same as
+ the usual "+" operator)
+ '+>" add a belief in the end of the belief base
+
- new special achievement goal events
+!jag_sleeping
+!jag_awaking
@@ -24,6 +31,21 @@
[qprofiling=yes]: it generates some statistical data related to queries and is used
to measure the performance of the qcache option
+- new general configuration parameter the define whether short names will be used
+ for unnamed variables (those starting with _).
+ Usually these vars may have quite long names. With this option enabled, the names
+ will be kept short.
+
+ This parameter is stored in the ~/.jason/user.properties file and can be changed
+ either by editing the file or by running
+
+ java -jar lib/jason.jar
+
+ NB: If in the user.properties file doesn't exist the first time someone runs
+ Jason, the file
+ <jason install directory>/jason.properties
+ will be used for initial user's parameters.
+
- new internal action .shuffle to shuffle the elements of lists
---------------------------
Modified: trunk/src/jason/asSemantics/TransitionSystem.java
===================================================================
--- trunk/src/jason/asSemantics/TransitionSystem.java 2013-03-13 15:12:02 UTC (rev 1720)
+++ trunk/src/jason/asSemantics/TransitionSystem.java 2013-03-14 14:03:03 UTC (rev 1721)
@@ -761,7 +761,7 @@
if (h.getBodyType() == BodyType.addBelEnd)
result = ag.brf(body,null,conf.C.SI, true);
else
- result = ag.brf(body,null,conf.C.SI); // use default (well documented and used) method in case someone has overriden it
+ result = ag.brf(body,null,conf.C.SI); // use default (well documented and used) method in case someone has overridden it
if (result != null) { // really added something
// generate events
updateEvents(result,newfocus);
Modified: trunk/src/jason/asSyntax/Structure.java
===================================================================
--- trunk/src/jason/asSyntax/Structure.java 2013-03-13 15:12:02 UTC (rev 1720)
+++ trunk/src/jason/asSyntax/Structure.java 2013-03-14 14:03:03 UTC (rev 1721)
@@ -25,6 +25,7 @@
import jason.asSemantics.Unifier;
import jason.asSyntax.parser.as2j;
+import jason.jeditplugin.Config;
import java.io.StringReader;
import java.util.ArrayList;
@@ -305,6 +306,8 @@
return this;
}
+ static boolean useShortUnnamedVars = Config.get().getBoolean(Config.SHORT_UNNAMED_VARS);
+
protected VarTerm varToReplace(Term t, Unifier un) {
VarTerm vt = (VarTerm)t;
VarTerm deref = un.deref(vt);
@@ -314,7 +317,7 @@
// if the variable hasn't been renamed given the input unifier, then rename it.
if (deref.equals(vt)) {
// forget the name
- VarTerm var = new UnnamedVar("_" + UnnamedVar.getUniqueId() + t);
+ VarTerm var = useShortUnnamedVars ? new UnnamedVar() : new UnnamedVar("_" + UnnamedVar.getUniqueId() + t);
// if deref has annotations then we need to replicate these in the new variable
if (deref.hasAnnot()) {
var.setAnnots(deref.getAnnots().cloneLT());
Modified: trunk/src/jason/jeditplugin/Config.java
===================================================================
--- trunk/src/jason/jeditplugin/Config.java 2013-03-13 15:12:02 UTC (rev 1720)
+++ trunk/src/jason/jeditplugin/Config.java 2013-03-14 14:03:03 UTC (rev 1721)
@@ -78,6 +78,8 @@
public static final String jacamoHomeProp = "JaCaMoHome";
+ public static final String SHORT_UNNAMED_VARS = "shortUnnamedVars";
+
private static Config singleton = null;
public static Config get() {
Modified: trunk/src/jason/util/ConfigGUI.java
===================================================================
--- trunk/src/jason/util/ConfigGUI.java 2013-03-13 15:12:02 UTC (rev 1720)
+++ trunk/src/jason/util/ConfigGUI.java 2013-03-14 14:03:03 UTC (rev 1721)
@@ -67,6 +67,8 @@
protected JCheckBox jadeSnifferCB;
protected JCheckBox jadeRmaCB;
+ protected JCheckBox shortUnnamedVarCB;
+
protected static Config userProperties = Config.get();
static {
@@ -162,6 +164,12 @@
wsvPanel.add(warnSingVarsCBox);
jasonHomePanel.add(wsvPanel);
+ // unamed vars style
+ JPanel unvPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
+ shortUnnamedVarCB = new JCheckBox("Use short names for unamed variables (those starting with _)", false);
+ unvPanel.add(shortUnnamedVarCB);
+ jasonHomePanel.add(unvPanel);
+
pop.add(jasonHomePanel);
@@ -304,6 +312,7 @@
closeAllCBox.setSelected(userProperties.getBoolean(Config.CLOSEALL));
checkVersionCBox.setSelected(userProperties.getBoolean(Config.CHECK_VERSION));
warnSingVarsCBox.setSelected(userProperties.getBoolean(Config.WARN_SING_VAR));
+ shortUnnamedVarCB.setSelected(userProperties.getBoolean(Config.SHORT_UNNAMED_VARS));
jadeSnifferCB.setSelected(userProperties.getBoolean(Config.JADE_SNIFFER));
jadeRmaCB.setSelected(userProperties.getBoolean(Config.JADE_RMA));
@@ -360,6 +369,7 @@
userProperties.put(Config.CLOSEALL, closeAllCBox.isSelected()+"");
userProperties.put(Config.CHECK_VERSION, checkVersionCBox.isSelected()+"");
userProperties.put(Config.WARN_SING_VAR, warnSingVarsCBox.isSelected()+"");
+ userProperties.put(Config.SHORT_UNNAMED_VARS, shortUnnamedVarCB.isSelected()+"");
userProperties.put(Config.JADE_SNIFFER, jadeSnifferCB.isSelected()+"");
userProperties.put(Config.JADE_RMA, jadeRmaCB.isSelected()+"");
Modified: trunk/src/jeditPlugin/agentSpeak.xml
===================================================================
--- trunk/src/jeditPlugin/agentSpeak.xml 2013-03-13 15:12:02 UTC (rev 1720)
+++ trunk/src/jeditPlugin/agentSpeak.xml 2013-03-14 14:03:03 UTC (rev 1721)
@@ -163,6 +163,9 @@
<SEQ TYPE="OPERATOR"><</SEQ>
<SEQ TYPE="OPERATOR">+</SEQ>
+ <SEQ TYPE="OPERATOR">++</SEQ>
+ <SEQ TYPE="OPERATOR">+></SEQ>
+ <SEQ TYPE="OPERATOR">+<</SEQ>
<SEQ TYPE="OPERATOR">-</SEQ>
<SEQ TYPE="OPERATOR">/</SEQ>
<SEQ TYPE="OPERATOR">*</SEQ>
@@ -326,6 +329,9 @@
<SEQ TYPE="OPERATOR"><</SEQ>
<SEQ TYPE="OPERATOR">+</SEQ>
+ <SEQ TYPE="OPERATOR">++</SEQ>
+ <SEQ TYPE="OPERATOR">+></SEQ>
+ <SEQ TYPE="OPERATOR">+<</SEQ>
<SEQ TYPE="OPERATOR">-</SEQ>
<SEQ TYPE="OPERATOR">/</SEQ>
<SEQ TYPE="OPERATOR">*</SEQ>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|