diff --git a/org.coreasm.engine/pom.xml b/org.coreasm.engine/pom.xml
index 049f7cbd..00d989c2 100644
--- a/org.coreasm.engine/pom.xml
+++ b/org.coreasm.engine/pom.xml
@@ -11,6 +11,10 @@
../org.coreasm.parent
+
+ true
+
+
@@ -60,7 +64,7 @@
maven-surefire-plugin
2.16
- true
+ ${skipTests}
false
0
@@ -103,7 +107,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.6.0
+ 3.8.0
1.7
@@ -138,7 +142,7 @@
junit
junit
- 4.8.2
+ 4.12
org.coreasm
diff --git a/org.coreasm.engine/src/org/coreasm/engine/Specification.java b/org.coreasm.engine/src/org/coreasm/engine/Specification.java
index 3666e54f..ba3f046c 100644
--- a/org.coreasm.engine/src/org/coreasm/engine/Specification.java
+++ b/org.coreasm.engine/src/org/coreasm/engine/Specification.java
@@ -323,11 +323,12 @@ public Set getPluginNames() {
* @see #loadSpec(String)
*/
public static ArrayList loadSpec(Specification mainSpec, String fileName) throws IOException {
- String specRoot = "";
- if (mainSpec != null)
- specRoot = mainSpec.getFileDir() + File.separator;
-
- return loadSpec(specRoot + fileName);
+ if (mainSpec == null) {
+ return loadSpec(new File(fileName));
+ }
+ else {
+ return loadSpec(new File(mainSpec.getFileDir(), fileName));
+ }
}
/**
diff --git a/org.coreasm.engine/src/org/coreasm/engine/absstorage/AbstractStorage.java b/org.coreasm.engine/src/org/coreasm/engine/absstorage/AbstractStorage.java
index 8dce06f0..db93a3a4 100644
--- a/org.coreasm.engine/src/org/coreasm/engine/absstorage/AbstractStorage.java
+++ b/org.coreasm.engine/src/org/coreasm/engine/absstorage/AbstractStorage.java
@@ -173,7 +173,7 @@ public interface AbstractStorage extends State {
* This method should only be called when there is a state in the stack.
*
* @param u the update multiset
- * @see #pushState()
+ * @see #pushState(String pluginName)
*/
public void apply(Set u);
diff --git a/org.coreasm.engine/src/org/coreasm/engine/absstorage/HashStorage.java b/org.coreasm.engine/src/org/coreasm/engine/absstorage/HashStorage.java
index ca1bb38b..71129f57 100644
--- a/org.coreasm.engine/src/org/coreasm/engine/absstorage/HashStorage.java
+++ b/org.coreasm.engine/src/org/coreasm/engine/absstorage/HashStorage.java
@@ -140,7 +140,8 @@ private Stack getUpdateStackPluginNames() {
private boolean isStateStacked() {
return !getUpdateStack().isEmpty();
}
-
+
+ @Override
public void initAbstractStorage() {
clearState();
@@ -217,7 +218,8 @@ private void loadVocabularyExtender(VocabularyExtender ve) throws NameConflictEx
addRule(name, veRules.get(name));
}
}
-
+
+ @Override
public synchronized void fireUpdateSet(Set updateSet) throws InvalidLocationException {
// Cannot fire updates while state stack is not empty.
// Doing this check will allow us to bypass calling setValue(...)
@@ -231,16 +233,14 @@ public synchronized void fireUpdateSet(Set updateSet) throws InvalidLoca
monitoredCache.clear();
}
+ @Override
public Element getChosenProgram(Element agent) {
- Element p = null;
- Element s = null;
-
try {
- p = getValue(new Location(PROGRAM_FUNCTION_NAME, ElementList.create(agent)));
+ Element p = getValue(new Location(PROGRAM_FUNCTION_NAME, ElementList.create(agent)));
if (p instanceof RuleElement)
return p;
else {
- capi.error("Value of program(" + s + ") is not a Rule element.");
+ capi.error("Value of program(" + agent + ") is not a Rule element.");
return Element.UNDEF;
}
} catch (InvalidLocationException e) {
@@ -250,23 +250,6 @@ public Element getChosenProgram(Element agent) {
}
}
-// /**
-// * @see org.coreasm.engine.absstorage.AbstractStorage#getState()
-// */
-// public State getState() {
-// return this;
-// }
-//
-// /**
-// * @see org.coreasm.engine.absstorage.AbstractStorage#setState(org.coreasm.engine.absstorage.State)
-// */
-// public void setState(State newState) {
-// if (!stateStacked)
-// this.state = newState;
-// else
-// throw new EngineError("Cannot set state when the state stack is not empty.");
-// }
-//
public Element getValue(Location l) throws InvalidLocationException {
Element e = null;
FunctionElement f = this.getFunction(l.name);
@@ -339,6 +322,7 @@ private Element getStackedValue(Location loc) {
return null;
}
+ @Override
public void aggregateUpdates() {
logger.debug("Aggregating updates.");
UpdateMultiset updateInsts = capi.getScheduler().getUpdateInstructions();
@@ -359,14 +343,15 @@ public void aggregateUpdates() {
/**
* @see AbstractStorage#compose(UpdateMultiset, UpdateMultiset)
*/
+ @Override
public UpdateMultiset compose(UpdateMultiset updateSet1, UpdateMultiset updateSet2) {
// instantiate engine composition API, and set update multiset
CompositionAPIImp compAPI = new CompositionAPIImp();
compAPI.setUpdateInstructions(updateSet1, updateSet2);
- for (Aggregator p: aggregatorPlugins)
+ for (Aggregator p : aggregatorPlugins)
// synchronized (p) {
- ((Aggregator)p).compose(compAPI);
+ p.compose(compAPI);
// }
// if (compAPI.isConsistent() == false)
@@ -379,16 +364,17 @@ public UpdateMultiset compose(UpdateMultiset updateSet1, UpdateMultiset updateSe
/**
* @see AbstractStorage#performAggregation(UpdateMultiset)
*/
+ @Override
public Set performAggregation(UpdateMultiset updateInsts) {
// instantiate engine aggregation API, and set update multiset
AggregationAPIImp aggAPI = new AggregationAPIImp();
aggAPI.setUpdateInstructions(updateInsts);
// for each plugin
- for (Aggregator p: aggregatorPlugins)
- ((Aggregator)p).aggregateUpdates(aggAPI);
+ for (Aggregator p : aggregatorPlugins)
+ p.aggregateUpdates(aggAPI);
- if (aggAPI.isConsistent() == false) {
+ if (!aggAPI.isConsistent()) {
String msg = "Inconsistent aggregated results.";
if (aggAPI.getFailedInstructions().size() > 0) {
@@ -405,7 +391,8 @@ public Set performAggregation(UpdateMultiset updateInsts) {
// get resultant updates from agg API
return aggAPI.getResultantUpdates();
}
-
+
+ @Override
public synchronized boolean isConsistent(Collection updateSet) {
Collection uSet = updateSet;
lastInconsistentUpdates = null;
@@ -430,6 +417,7 @@ public synchronized boolean isConsistent(Collection updateSet) {
return true;
}
+ @Override
public Element getNewElement() {
return new Element();
}
@@ -481,8 +469,9 @@ public void popState(String pluginName) {
* This method should only be called when there is a state in the stack.
*
* @param updates the update multiset
- * @see #pushState()
+ * @see #pushState(String pluginName)
*/
+ @Override
public synchronized void apply(Set updates) {
if (isStateStacked()) {
Stack
org.coreasm
-
\ No newline at end of file
+