Details
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/domain/CO.java b/bdi-jade-test/src/bdi4jade/examples/undo/domain/CO.java
index b964ca0..7d8434a 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/domain/CO.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/domain/CO.java
@@ -1,28 +1,10 @@
-//----------------------------------------------------------------------------
-// Copyright (C) 2011 Ingrid Nunes
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// To contact the authors:
-// http://inf.ufrgs.br/prosoft/bdi4jade/
-//
-//----------------------------------------------------------------------------
-
package bdi4jade.examples.undo.domain;
import java.io.Serializable;
+import java.util.Random;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import jade.content.Concept;
import jade.content.ContentElement;
@@ -31,8 +13,87 @@ import jade.content.ContentElement;
* @author jgfaccin
*
*/
-public class CO implements Serializable, Concept, ContentElement {
+public class CO implements Serializable, Concept, ContentElement, Runnable {
private static final long serialVersionUID = 2426152760359289784L;
+ private static CO instance;
+ private Boolean openWindows;
+ private Boolean fansOn;
+ private Boolean leaking;
+ private Integer gasConcentration;
+ private final Log log;
+
+ private CO() {
+ this.log = LogFactory.getLog(this.getClass());
+ this.openWindows = false;
+ this.fansOn = false;
+ this.leaking = false;
+ Random random = new Random(System.currentTimeMillis());
+ this.gasConcentration = random.nextInt(9);
+ }
+
+ public void setOpenWindows(Boolean open) {
+ this.openWindows = open;
+ }
+
+ public void setFansOn(Boolean on) {
+ this.fansOn = on;
+ }
+
+ public void setLeaking(Boolean leak) {
+ this.leaking = leak;
+ }
+
+ public static synchronized CO getInstance() {
+ if (instance == null) {
+ instance = new CO();
+ }
+ return instance;
+ }
+
+ public Integer getGasConcentration() {
+ return this.gasConcentration;
+ }
+
+ public void updateGasConcentration() {
+ if (this.leaking) {
+ this.gasConcentration += 5;
+ if (this.openWindows) {
+ this.gasConcentration -= 3;
+ } else {
+ this.gasConcentration += 2;
+ }
+ if (this.fansOn) {
+ this.gasConcentration -= 4;
+ } else {
+ this.gasConcentration += 3;
+ }
+ } else {
+ if (this.openWindows) {
+ if (this.gasConcentration > 9) {
+ this.gasConcentration -= 3;
+ }
+ }
+ if (this.fansOn) {
+ if (this.gasConcentration > 9) {
+ this.gasConcentration -= 4;
+ }
+ }
+ }
+ }
+
+ @Override
+ public void run() {
+ while (true) {
+ updateGasConcentration();
+ log.info(this.gasConcentration);
+ System.out.println("CO Concentration:" + this.gasConcentration);
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/domain/Device.java b/bdi-jade-test/src/bdi4jade/examples/undo/domain/Device.java
index 3b2dcad..3b587d5 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/domain/Device.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/domain/Device.java
@@ -10,7 +10,7 @@ import jade.content.ContentElement;
*
*/
public abstract class Device implements Serializable, Concept, ContentElement {
-
+
private static final long serialVersionUID = 3230147050332280745L;
private String id;
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/domain/predicate/Open.java b/bdi-jade-test/src/bdi4jade/examples/undo/domain/predicate/Open.java
index 6a15ceb..7bbc5bd 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/domain/predicate/Open.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/domain/predicate/Open.java
@@ -1,18 +1,18 @@
package bdi4jade.examples.undo.domain.predicate;
-import bdi4jade.examples.undo.domain.Window;
+import bdi4jade.examples.undo.domain.Device;
import bdi4jade.extension.remediation.logics.UnaryPredicate;
/**
* @author jgfaccin
*
*/
-public class Open extends UnaryPredicate<Window> {
+public class Open extends UnaryPredicate<Device> {
private static final long serialVersionUID = -235923477441751683L;
- public Open(Window window) {
- super(window);
+ public Open(Device device) {
+ super(device);
}
}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/AlarmShutdownGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/AlarmShutdownGoal.java
new file mode 100644
index 0000000..1f59041
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/AlarmShutdownGoal.java
@@ -0,0 +1,40 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.TakeOff;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class AlarmShutdownGoal extends PredicateGoal<TakeOff> {
+
+ private static final long serialVersionUID = -4328525629406377273L;
+
+ public AlarmShutdownGoal() {
+ super(new TakeOff(ManagementCapability.ALARM), false);
+ }
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/AlarmTakeOffGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/AlarmTakeOffGoal.java
new file mode 100644
index 0000000..1bc258e
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/AlarmTakeOffGoal.java
@@ -0,0 +1,41 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.TakeOff;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class AlarmTakeOffGoal extends PredicateGoal<TakeOff> {
+
+ private static final long serialVersionUID = -1397748524534808133L;
+
+ public AlarmTakeOffGoal() {
+ super(new TakeOff(ManagementCapability.ALARM), true);
+ }
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/DoorsLockGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/DoorsLockGoal.java
new file mode 100644
index 0000000..2276348
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/DoorsLockGoal.java
@@ -0,0 +1,40 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.Locked;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class DoorsLockGoal extends PredicateGoal<Locked> {
+
+ private static final long serialVersionUID = 1166571096435384036L;
+
+ public DoorsLockGoal() {
+ super(new Locked(ManagementCapability.DOORS), true);
+ }
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/DoorsUnlockGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/DoorsUnlockGoal.java
new file mode 100644
index 0000000..4349405
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/DoorsUnlockGoal.java
@@ -0,0 +1,40 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.Locked;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class DoorsUnlockGoal extends PredicateGoal<Locked> {
+
+ private static final long serialVersionUID = -615289446811920279L;
+
+ public DoorsUnlockGoal() {
+ super(new Locked(ManagementCapability.DOORS), false);
+ }
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/FansOffGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/FansOffGoal.java
new file mode 100644
index 0000000..da9fe0e
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/FansOffGoal.java
@@ -0,0 +1,40 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.On;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class FansOffGoal extends PredicateGoal<On> {
+
+ private static final long serialVersionUID = -7238193264003293338L;
+
+ public FansOffGoal() {
+ super(new On(ManagementCapability.FANS), false);
+ }
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/FansOnGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/FansOnGoal.java
new file mode 100644
index 0000000..2259f72
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/FansOnGoal.java
@@ -0,0 +1,40 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.On;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class FansOnGoal extends PredicateGoal<On> {
+
+ private static final long serialVersionUID = -2540552831695804437L;
+
+ public FansOnGoal() {
+ super(new On(ManagementCapability.FANS), true);
+ }
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/LightsOffGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/LightsOffGoal.java
new file mode 100644
index 0000000..6c839a6
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/LightsOffGoal.java
@@ -0,0 +1,41 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.On;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class LightsOffGoal extends PredicateGoal<On> {
+
+ private static final long serialVersionUID = -457758879523088957L;
+
+ public LightsOffGoal() {
+ super(new On(ManagementCapability.LIGHTS), Boolean.FALSE);
+ }
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/LightsOnGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/LightsOnGoal.java
new file mode 100644
index 0000000..dc8d171
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/LightsOnGoal.java
@@ -0,0 +1,41 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.On;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class LightsOnGoal extends PredicateGoal<On> {
+
+ private static final long serialVersionUID = -8689337390614405995L;
+
+ public LightsOnGoal() {
+ super(new On(ManagementCapability.LIGHTS), true);
+ }
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/NormalizeCOGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/NormalizeCOGoal.java
new file mode 100644
index 0000000..fb66ff5
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/NormalizeCOGoal.java
@@ -0,0 +1,40 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.domain.CO;
+import bdi4jade.examples.undo.domain.predicate.Abnormal;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class NormalizeCOGoal extends PredicateGoal<Abnormal> {
+
+ private static final long serialVersionUID = -2555076582644562774L;
+
+ public NormalizeCOGoal() {
+ super(new Abnormal(CO.getInstance()), false);
+ }
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/ValveCloseGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/ValveCloseGoal.java
new file mode 100644
index 0000000..c2d116b
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/ValveCloseGoal.java
@@ -0,0 +1,40 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.Open;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class ValveCloseGoal extends PredicateGoal<Open> {
+
+ private static final long serialVersionUID = 8490498020858931632L;
+
+ public ValveCloseGoal() {
+ super(new Open(ManagementCapability.VALVE), false);
+ }
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/WindowsCloseGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/WindowsCloseGoal.java
new file mode 100644
index 0000000..13d269e
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/WindowsCloseGoal.java
@@ -0,0 +1,40 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.Open;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class WindowsCloseGoal extends PredicateGoal<Open> {
+
+ private static final long serialVersionUID = 8086664302420760258L;
+
+ public WindowsCloseGoal() {
+ super(new Open(ManagementCapability.WINDOWS), false);
+ }
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/goal/WindowsOpenGoal.java b/bdi-jade-test/src/bdi4jade/examples/undo/goal/WindowsOpenGoal.java
new file mode 100644
index 0000000..06e58c7
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/goal/WindowsOpenGoal.java
@@ -0,0 +1,40 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.undo.goal;
+
+import bdi4jade.examples.undo.ManagementCapability;
+import bdi4jade.examples.undo.domain.predicate.Open;
+import bdi4jade.goal.PredicateGoal;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class WindowsOpenGoal extends PredicateGoal<Open> {
+
+ private static final long serialVersionUID = -3691089887167568727L;
+
+ public WindowsOpenGoal() {
+ super(new Open(ManagementCapability.WINDOWS), true);
+ }
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/ManagementCapability.java b/bdi-jade-test/src/bdi4jade/examples/undo/ManagementCapability.java
new file mode 100644
index 0000000..5be9d24
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/ManagementCapability.java
@@ -0,0 +1,146 @@
+package bdi4jade.examples.undo;
+
+import bdi4jade.annotation.Belief;
+import bdi4jade.belief.PredicateBelief;
+import bdi4jade.belief.TransientPredicate;
+import bdi4jade.examples.undo.domain.Alarm;
+import bdi4jade.examples.undo.domain.CO;
+import bdi4jade.examples.undo.domain.Door;
+import bdi4jade.examples.undo.domain.Fan;
+import bdi4jade.examples.undo.domain.Light;
+import bdi4jade.examples.undo.domain.Valve;
+import bdi4jade.examples.undo.domain.WaterHeater;
+import bdi4jade.examples.undo.domain.Window;
+import bdi4jade.examples.undo.domain.predicate.Abnormal;
+import bdi4jade.examples.undo.domain.predicate.Leak;
+import bdi4jade.examples.undo.domain.predicate.Locked;
+import bdi4jade.examples.undo.domain.predicate.On;
+import bdi4jade.examples.undo.domain.predicate.Open;
+import bdi4jade.examples.undo.domain.predicate.TakeOff;
+import bdi4jade.examples.undo.goal.AlarmShutdownGoal;
+import bdi4jade.examples.undo.goal.AlarmTakeOffGoal;
+import bdi4jade.examples.undo.goal.DoorsLockGoal;
+import bdi4jade.examples.undo.goal.DoorsUnlockGoal;
+import bdi4jade.examples.undo.goal.FansOffGoal;
+import bdi4jade.examples.undo.goal.FansOnGoal;
+import bdi4jade.examples.undo.goal.LightsOffGoal;
+import bdi4jade.examples.undo.goal.LightsOnGoal;
+import bdi4jade.examples.undo.goal.NormalizeCOGoal;
+import bdi4jade.examples.undo.goal.ValveCloseGoal;
+import bdi4jade.examples.undo.goal.WindowsCloseGoal;
+import bdi4jade.examples.undo.goal.WindowsOpenGoal;
+import bdi4jade.examples.undo.plan.EvacuateAndVentilatePlanBody;
+import bdi4jade.examples.undo.plan.request.RequestAlarmShutdownPlanBody;
+import bdi4jade.examples.undo.plan.request.RequestAlarmTakeOffPlanBody;
+import bdi4jade.examples.undo.plan.request.RequestDoorsLockPlanBody;
+import bdi4jade.examples.undo.plan.request.RequestDoorsUnlockPlanBody;
+import bdi4jade.examples.undo.plan.request.RequestFansOffPlanBody;
+import bdi4jade.examples.undo.plan.request.RequestFansOnPlanBody;
+import bdi4jade.examples.undo.plan.request.RequestLightsOffPlanBody;
+import bdi4jade.examples.undo.plan.request.RequestLightsOnPlanBody;
+import bdi4jade.examples.undo.plan.request.RequestValveClosePlanBody;
+import bdi4jade.examples.undo.plan.request.RequestWindowsClosePlanBody;
+import bdi4jade.examples.undo.plan.request.RequestWindowsOpenPlanBody;
+import bdi4jade.extension.undo.RevertingCapability;
+import bdi4jade.plan.DefaultPlan;
+import bdi4jade.plan.Plan;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class ManagementCapability extends RevertingCapability {
+
+ private static final long serialVersionUID = -1971498055603790248L;
+
+ // Devices
+ public static final Alarm ALARM = new Alarm("ALARM");
+ public static final Door DOORS = new Door("DOORS");
+ public static final Fan FANS = new Fan("FANS");
+ public static final Light LIGHTS = new Light("LIGHTS");
+ public static final Valve VALVE = new Valve("VALVE");
+ public static final WaterHeater WATER_HEATER = new WaterHeater("WATER_HEATER");
+ public static final Window WINDOWS = new Window("WINDOWS");
+
+ // Neighbours
+ @Belief
+ String alarmAgent;
+ @Belief
+ String doorsAgent;
+ @Belief
+ String fansAgent;
+ @Belief
+ String lightsAgent;
+ @Belief
+ String valveAgent;
+ @Belief
+ String windowsAgent;
+
+ // Device Predicates
+ PredicateBelief<TakeOff> alarmTakeOff = new TransientPredicate<>(new TakeOff(ALARM), false);
+ PredicateBelief<Locked> doorsUnlock = new TransientPredicate<>(new Locked(DOORS), true);
+ PredicateBelief<On> fansOn = new TransientPredicate<On>(new On(FANS), false);
+ PredicateBelief<Leak> leakingWaterHeater = new TransientPredicate<Leak>(new Leak(WATER_HEATER), false);
+ PredicateBelief<On> lightsOn = new TransientPredicate<>(new On(LIGHTS), false);
+ PredicateBelief<Open> valveClose = new TransientPredicate<Open>(new Open(VALVE), false);
+ PredicateBelief<Open> windowsOpen = new TransientPredicate<Open>(new Open(WINDOWS), false);
+ PredicateBelief<Abnormal> abnormalCO = new TransientPredicate<Abnormal>(new Abnormal(CO.getInstance()), false);
+
+ // Plans
+ @bdi4jade.annotation.Plan
+ private Plan lightsOnPlan;
+ @bdi4jade.annotation.Plan
+ private Plan lightsOffPlan;
+ @bdi4jade.annotation.Plan
+ private Plan alarmTakeOffPlan;
+ @bdi4jade.annotation.Plan
+ private Plan alarmShutdownPlan;
+ @bdi4jade.annotation.Plan
+ private Plan doorsUnlockPlan;
+ @bdi4jade.annotation.Plan
+ private Plan doorsLockPlan;
+ @bdi4jade.annotation.Plan
+ private Plan fansOnPlan;
+ @bdi4jade.annotation.Plan
+ private Plan fansOffPlan;
+ @bdi4jade.annotation.Plan
+ private Plan windowsOpenPlan;
+ @bdi4jade.annotation.Plan
+ private Plan windowsClosePlan;
+ @bdi4jade.annotation.Plan
+ private Plan valveClosePlan;
+ @bdi4jade.annotation.Plan
+ private Plan evacuateAndVentilatePlan;
+
+ public ManagementCapability(String alarmAgent, String valveAgent, String doorsAgent, String fansAgent,
+ String lightsAgent, String windowsAgent) {
+ this.alarmAgent = alarmAgent;
+ this.valveAgent = valveAgent;
+ this.doorsAgent = doorsAgent;
+ this.fansAgent = fansAgent;
+ this.lightsAgent = lightsAgent;
+ this.windowsAgent = windowsAgent;
+
+ initializePlans();
+ initializeCauseEffectRelationship();
+ }
+
+ private void initializePlans() {
+ this.lightsOnPlan = new DefaultPlan(LightsOnGoal.class, RequestLightsOnPlanBody.class);
+ this.lightsOffPlan = new DefaultPlan(LightsOffGoal.class, RequestLightsOffPlanBody.class);
+ this.alarmTakeOffPlan = new DefaultPlan(AlarmTakeOffGoal.class, RequestAlarmTakeOffPlanBody.class);
+ this.alarmShutdownPlan = new DefaultPlan(AlarmShutdownGoal.class, RequestAlarmShutdownPlanBody.class);
+ this.doorsUnlockPlan = new DefaultPlan(DoorsUnlockGoal.class, RequestDoorsUnlockPlanBody.class);
+ this.doorsLockPlan = new DefaultPlan(DoorsLockGoal.class, RequestDoorsLockPlanBody.class);
+ this.fansOnPlan = new DefaultPlan(FansOnGoal.class, RequestFansOnPlanBody.class);
+ this.fansOffPlan = new DefaultPlan(FansOffGoal.class, RequestFansOffPlanBody.class);
+ this.windowsOpenPlan = new DefaultPlan(WindowsOpenGoal.class, RequestWindowsOpenPlanBody.class);
+ this.windowsClosePlan = new DefaultPlan(WindowsCloseGoal.class, RequestWindowsClosePlanBody.class);
+ this.valveClosePlan = new DefaultPlan(ValveCloseGoal.class, RequestValveClosePlanBody.class);
+ this.evacuateAndVentilatePlan = new DefaultPlan(NormalizeCOGoal.class, EvacuateAndVentilatePlanBody.class);
+ }
+
+ private void initializeCauseEffectRelationship() {
+
+ }
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/plan/EvacuateAndVentilatePlanBody.java b/bdi-jade-test/src/bdi4jade/examples/undo/plan/EvacuateAndVentilatePlanBody.java
new file mode 100644
index 0000000..4429b31
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/plan/EvacuateAndVentilatePlanBody.java
@@ -0,0 +1,18 @@
+package bdi4jade.examples.undo.plan;
+
+import bdi4jade.extension.undo.RevertingPlanBody;
+
+/**
+ * @author jgfaccin
+ *
+ */
+public class EvacuateAndVentilatePlanBody extends RevertingPlanBody {
+
+ private static final long serialVersionUID = -2470120034621753974L;
+
+ @Override
+ protected void execute() {
+
+ }
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestAlarmShutdownPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestAlarmShutdownPlanBody.java
index 0cf9785..720cbc9 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestAlarmShutdownPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestAlarmShutdownPlanBody.java
@@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory;
import bdi4jade.belief.Belief;
import bdi4jade.belief.PredicateBelief;
-import bdi4jade.examples.undo.domain.Alarm;
+import bdi4jade.examples.undo.domain.predicate.TakeOff;
import bdi4jade.examples.undo.plan.AnswerRequestPlanBody;
import bdi4jade.extension.undo.RevertingPlanBody;
import bdi4jade.plan.Plan.EndState;
@@ -51,22 +51,22 @@ public class RequestAlarmShutdownPlanBody extends RevertingPlanBody {
private boolean sent = false;
@bdi4jade.annotation.Belief
- private Belief<String, String> neighbour;
+ private Belief<String, String> alarmAgent;
@bdi4jade.annotation.Belief
- private PredicateBelief<Alarm> alarmTakeOff;
+ private PredicateBelief<TakeOff> alarmTakeOff;
@Override
protected void execute() {
if (!sent) {
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setContent(MSG_CONTENT);
- msg.addReceiver(new AID(neighbour.getValue(), false));
+ msg.addReceiver(new AID(alarmAgent.getValue(), false));
msg.setConversationId("cin" + System.currentTimeMillis());
myAgent.send(msg);
this.mt = MessageTemplate.and(MessageTemplate.MatchConversationId(msg.getConversationId()),
MessageTemplate.MatchInReplyTo(msg.getReplyWith()));
this.sent = true;
- log.info("Request sent to agent " + neighbour.getValue() + "!");
+ log.info("Request sent to agent " + alarmAgent.getValue() + "!");
} else {
ACLMessage reply = myAgent.receive(mt);
if (reply != null) {
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestAlarmTakeOffPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestAlarmTakeOffPlanBody.java
index 7d3efcf..8b063bd 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestAlarmTakeOffPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestAlarmTakeOffPlanBody.java
@@ -5,7 +5,7 @@ import org.apache.commons.logging.LogFactory;
import bdi4jade.belief.Belief;
import bdi4jade.belief.PredicateBelief;
-import bdi4jade.examples.undo.domain.Alarm;
+import bdi4jade.examples.undo.domain.predicate.TakeOff;
import bdi4jade.examples.undo.plan.AnswerRequestPlanBody;
import bdi4jade.extension.undo.RevertingPlanBody;
import bdi4jade.plan.Plan.EndState;
@@ -29,22 +29,22 @@ public class RequestAlarmTakeOffPlanBody extends RevertingPlanBody {
private boolean sent = false;
@bdi4jade.annotation.Belief
- private Belief<String, String> neighbour;
+ private Belief<String, String> alarmAgent;
@bdi4jade.annotation.Belief
- private PredicateBelief<Alarm> alarmTakeOff;
+ private PredicateBelief<TakeOff> alarmTakeOff;
@Override
protected void execute() {
if (!sent) {
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setContent(MSG_CONTENT);
- msg.addReceiver(new AID(neighbour.getValue(), false));
+ msg.addReceiver(new AID(alarmAgent.getValue(), false));
msg.setConversationId("cin" + System.currentTimeMillis());
myAgent.send(msg);
this.mt = MessageTemplate.and(MessageTemplate.MatchConversationId(msg.getConversationId()),
MessageTemplate.MatchInReplyTo(msg.getReplyWith()));
this.sent = true;
- log.info("Request sent to agent " + neighbour.getValue() + "!");
+ log.info("Request sent to agent " + alarmAgent.getValue() + "!");
} else {
ACLMessage reply = myAgent.receive(mt);
if (reply != null) {
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestDoorsLockPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestDoorsLockPlanBody.java
index 03aad36..0fd5e98 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestDoorsLockPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestDoorsLockPlanBody.java
@@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory;
import bdi4jade.belief.Belief;
import bdi4jade.belief.PredicateBelief;
-import bdi4jade.examples.undo.domain.Alarm;
+import bdi4jade.examples.undo.domain.predicate.Locked;
import bdi4jade.examples.undo.plan.AnswerRequestPlanBody;
import bdi4jade.extension.undo.RevertingPlanBody;
import bdi4jade.plan.Plan.EndState;
@@ -51,22 +51,22 @@ public class RequestDoorsLockPlanBody extends RevertingPlanBody {
private boolean sent = false;
@bdi4jade.annotation.Belief
- private Belief<String, String> neighbour;
+ private Belief<String, String> doorsAgent;
@bdi4jade.annotation.Belief
- private PredicateBelief<Alarm> doorsUnlock;
+ private PredicateBelief<Locked> doorsUnlock;
@Override
protected void execute() {
if (!sent) {
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setContent(MSG_CONTENT);
- msg.addReceiver(new AID(neighbour.getValue(), false));
+ msg.addReceiver(new AID(doorsAgent.getValue(), false));
msg.setConversationId("cin" + System.currentTimeMillis());
myAgent.send(msg);
this.mt = MessageTemplate.and(MessageTemplate.MatchConversationId(msg.getConversationId()),
MessageTemplate.MatchInReplyTo(msg.getReplyWith()));
this.sent = true;
- log.info("Request sent to agent " + neighbour.getValue() + "!");
+ log.info("Request sent to agent " + doorsAgent.getValue() + "!");
} else {
ACLMessage reply = myAgent.receive(mt);
if (reply != null) {
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestDoorsUnlockPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestDoorsUnlockPlanBody.java
index 8ee65a9..554d153 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestDoorsUnlockPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestDoorsUnlockPlanBody.java
@@ -5,7 +5,7 @@ import org.apache.commons.logging.LogFactory;
import bdi4jade.belief.Belief;
import bdi4jade.belief.PredicateBelief;
-import bdi4jade.examples.undo.domain.Alarm;
+import bdi4jade.examples.undo.domain.predicate.Locked;
import bdi4jade.examples.undo.plan.AnswerRequestPlanBody;
import bdi4jade.extension.undo.RevertingPlanBody;
import bdi4jade.plan.Plan.EndState;
@@ -29,22 +29,22 @@ public class RequestDoorsUnlockPlanBody extends RevertingPlanBody {
private boolean sent = false;
@bdi4jade.annotation.Belief
- private Belief<String, String> neighbour;
+ private Belief<String, String> doorsAgent;
@bdi4jade.annotation.Belief
- private PredicateBelief<Alarm> doorsUnlock;
+ private PredicateBelief<Locked> doorsUnlock;
@Override
protected void execute() {
if (!sent) {
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setContent(MSG_CONTENT);
- msg.addReceiver(new AID(neighbour.getValue(), false));
+ msg.addReceiver(new AID(doorsAgent.getValue(), false));
msg.setConversationId("cin" + System.currentTimeMillis());
myAgent.send(msg);
this.mt = MessageTemplate.and(MessageTemplate.MatchConversationId(msg.getConversationId()),
MessageTemplate.MatchInReplyTo(msg.getReplyWith()));
this.sent = true;
- log.info("Request sent to agent " + neighbour.getValue() + "!");
+ log.info("Request sent to agent " + doorsAgent.getValue() + "!");
} else {
ACLMessage reply = myAgent.receive(mt);
if (reply != null) {
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestFansOffPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestFansOffPlanBody.java
index ce40e1d..043a3ef 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestFansOffPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestFansOffPlanBody.java
@@ -27,7 +27,7 @@ import org.apache.commons.logging.LogFactory;
import bdi4jade.belief.Belief;
import bdi4jade.belief.PredicateBelief;
-import bdi4jade.examples.undo.domain.Alarm;
+import bdi4jade.examples.undo.domain.predicate.On;
import bdi4jade.examples.undo.plan.AnswerRequestPlanBody;
import bdi4jade.extension.undo.RevertingPlanBody;
import bdi4jade.plan.Plan.EndState;
@@ -51,22 +51,22 @@ public class RequestFansOffPlanBody extends RevertingPlanBody {
private boolean sent = false;
@bdi4jade.annotation.Belief
- private Belief<String, String> neighbour;
+ private Belief<String, String> fansAgent;
@bdi4jade.annotation.Belief
- private PredicateBelief<Alarm> fansOn;
+ private PredicateBelief<On> fansOn;
@Override
protected void execute() {
if (!sent) {
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setContent(MSG_CONTENT);
- msg.addReceiver(new AID(neighbour.getValue(), false));
+ msg.addReceiver(new AID(fansAgent.getValue(), false));
msg.setConversationId("cin" + System.currentTimeMillis());
myAgent.send(msg);
this.mt = MessageTemplate.and(MessageTemplate.MatchConversationId(msg.getConversationId()),
MessageTemplate.MatchInReplyTo(msg.getReplyWith()));
this.sent = true;
- log.info("Request sent to agent " + neighbour.getValue() + "!");
+ log.info("Request sent to agent " + fansAgent.getValue() + "!");
} else {
ACLMessage reply = myAgent.receive(mt);
if (reply != null) {
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestFansOnPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestFansOnPlanBody.java
index 58d4259..39ee1b1 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestFansOnPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestFansOnPlanBody.java
@@ -5,7 +5,7 @@ import org.apache.commons.logging.LogFactory;
import bdi4jade.belief.Belief;
import bdi4jade.belief.PredicateBelief;
-import bdi4jade.examples.undo.domain.Alarm;
+import bdi4jade.examples.undo.domain.predicate.On;
import bdi4jade.examples.undo.plan.AnswerRequestPlanBody;
import bdi4jade.extension.undo.RevertingPlanBody;
import bdi4jade.plan.Plan.EndState;
@@ -29,22 +29,22 @@ public class RequestFansOnPlanBody extends RevertingPlanBody {
private boolean sent = false;
@bdi4jade.annotation.Belief
- private Belief<String, String> neighbour;
+ private Belief<String, String> fansAgent;
@bdi4jade.annotation.Belief
- private PredicateBelief<Alarm> fansOn;
+ private PredicateBelief<On> fansOn;
@Override
protected void execute() {
if (!sent) {
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setContent(MSG_CONTENT);
- msg.addReceiver(new AID(neighbour.getValue(), false));
+ msg.addReceiver(new AID(fansAgent.getValue(), false));
msg.setConversationId("cin" + System.currentTimeMillis());
myAgent.send(msg);
this.mt = MessageTemplate.and(MessageTemplate.MatchConversationId(msg.getConversationId()),
MessageTemplate.MatchInReplyTo(msg.getReplyWith()));
this.sent = true;
- log.info("Request sent to agent " + neighbour.getValue() + "!");
+ log.info("Request sent to agent " + fansAgent.getValue() + "!");
} else {
ACLMessage reply = myAgent.receive(mt);
if (reply != null) {
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestLightsOffPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestLightsOffPlanBody.java
index 95a94a8..e3a735f 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestLightsOffPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestLightsOffPlanBody.java
@@ -51,7 +51,7 @@ public class RequestLightsOffPlanBody extends RevertingPlanBody {
private boolean sent = false;
@bdi4jade.annotation.Belief
- private Belief<String, String> neighbour;
+ private Belief<String, String> lightsAgent;
@bdi4jade.annotation.Belief
private PredicateBelief<Alarm> lightsOn;
@@ -60,13 +60,13 @@ public class RequestLightsOffPlanBody extends RevertingPlanBody {
if (!sent) {
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setContent(MSG_CONTENT);
- msg.addReceiver(new AID(neighbour.getValue(), false));
+ msg.addReceiver(new AID(lightsAgent.getValue(), false));
msg.setConversationId("cin" + System.currentTimeMillis());
myAgent.send(msg);
this.mt = MessageTemplate.and(MessageTemplate.MatchConversationId(msg.getConversationId()),
MessageTemplate.MatchInReplyTo(msg.getReplyWith()));
this.sent = true;
- log.info("Request sent to agent " + neighbour.getValue() + "!");
+ log.info("Request sent to agent " + lightsAgent.getValue() + "!");
} else {
ACLMessage reply = myAgent.receive(mt);
if (reply != null) {
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestLightsOnPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestLightsOnPlanBody.java
index 84f6c08..9338012 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestLightsOnPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestLightsOnPlanBody.java
@@ -5,7 +5,7 @@ import org.apache.commons.logging.LogFactory;
import bdi4jade.belief.Belief;
import bdi4jade.belief.PredicateBelief;
-import bdi4jade.examples.undo.domain.Alarm;
+import bdi4jade.examples.undo.domain.predicate.On;
import bdi4jade.examples.undo.plan.AnswerRequestPlanBody;
import bdi4jade.extension.undo.RevertingPlanBody;
import bdi4jade.plan.Plan.EndState;
@@ -29,22 +29,22 @@ public class RequestLightsOnPlanBody extends RevertingPlanBody {
private boolean sent = false;
@bdi4jade.annotation.Belief
- private Belief<String, String> neighbour;
+ private Belief<String, String> lightsAgent;
@bdi4jade.annotation.Belief
- private PredicateBelief<Alarm> lightsOn;
+ private PredicateBelief<On> lightsOn;
@Override
protected void execute() {
if (!sent) {
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setContent(MSG_CONTENT);
- msg.addReceiver(new AID(neighbour.getValue(), false));
+ msg.addReceiver(new AID(lightsAgent.getValue(), false));
msg.setConversationId("cin" + System.currentTimeMillis());
myAgent.send(msg);
this.mt = MessageTemplate.and(MessageTemplate.MatchConversationId(msg.getConversationId()),
MessageTemplate.MatchInReplyTo(msg.getReplyWith()));
this.sent = true;
- log.info("Request sent to agent " + neighbour.getValue() + "!");
+ log.info("Request sent to agent " + lightsAgent.getValue() + "!");
} else {
ACLMessage reply = myAgent.receive(mt);
if (reply != null) {
diff --git a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestWindowsOpenPlanBody.java b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestWindowsOpenPlanBody.java
index a6870e1..8b15494 100644
--- a/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestWindowsOpenPlanBody.java
+++ b/bdi-jade-test/src/bdi4jade/examples/undo/plan/request/RequestWindowsOpenPlanBody.java
@@ -5,7 +5,7 @@ import org.apache.commons.logging.LogFactory;
import bdi4jade.belief.Belief;
import bdi4jade.belief.PredicateBelief;
-import bdi4jade.examples.undo.domain.Alarm;
+import bdi4jade.examples.undo.domain.predicate.Open;
import bdi4jade.examples.undo.plan.AnswerRequestPlanBody;
import bdi4jade.extension.undo.RevertingPlanBody;
import bdi4jade.plan.Plan.EndState;
@@ -29,22 +29,22 @@ public class RequestWindowsOpenPlanBody extends RevertingPlanBody {
private boolean sent = false;
@bdi4jade.annotation.Belief
- private Belief<String, String> neighbour;
+ private Belief<String, String> windowsAgent;
@bdi4jade.annotation.Belief
- private PredicateBelief<Alarm> windowsOpen;
+ private PredicateBelief<Open> windowsOpen;
@Override
protected void execute() {
if (!sent) {
ACLMessage msg = new ACLMessage(ACLMessage.REQUEST);
msg.setContent(MSG_CONTENT);
- msg.addReceiver(new AID(neighbour.getValue(), false));
+ msg.addReceiver(new AID(windowsAgent.getValue(), false));
msg.setConversationId("cin" + System.currentTimeMillis());
myAgent.send(msg);
this.mt = MessageTemplate.and(MessageTemplate.MatchConversationId(msg.getConversationId()),
MessageTemplate.MatchInReplyTo(msg.getReplyWith()));
this.sent = true;
- log.info("Request sent to agent " + neighbour.getValue() + "!");
+ log.info("Request sent to agent " + windowsAgent.getValue() + "!");
} else {
ACLMessage reply = myAgent.receive(mt);
if (reply != null) {