diff --git a/AlgebraicDataflowArchitectureModel/src/algorithm/DataStorageNecessity.java b/AlgebraicDataflowArchitectureModel/src/algorithm/DataStorageNecessity.java index 0625664..c9aac3e 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithm/DataStorageNecessity.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithm/DataStorageNecessity.java @@ -16,7 +16,7 @@ boolean flag = false; for (Position pos : curexp.getVariables().keySet()) { System.out.println(curexp); - System.out.println(nextexp.getVariables().containsKey(pos)); + System.out.println(curexp.getVariables().containsKey(pos)); System.out.println(nextexp); if (nextexp.contains(curexp.getVariables().get(pos))) { flag = true; diff --git a/AlgebraicDataflowArchitectureModel/src/models/algebra/Position.java b/AlgebraicDataflowArchitectureModel/src/models/algebra/Position.java index 1708506..d157bee 100644 --- a/AlgebraicDataflowArchitectureModel/src/models/algebra/Position.java +++ b/AlgebraicDataflowArchitectureModel/src/models/algebra/Position.java @@ -3,6 +3,8 @@ import java.util.ArrayList; import java.util.List; +import models.dataConstraintModel.IdentifierTemplate; + public class Position implements Cloneable { private ArrayList orders = new ArrayList(); @@ -32,4 +34,13 @@ public Object clone() { return new Position((ArrayList) orders.clone()); } + + public boolean equals(Object another) { + if (!(another instanceof Position)) return false; + return orders.equals(((Position) another).orders); + } + + public int hashCode() { + return orders.size(); + } } diff --git a/AlgebraicDataflowArchitectureModel/src/models/dataConstraintModel/IdentifierTemplate.java b/AlgebraicDataflowArchitectureModel/src/models/dataConstraintModel/IdentifierTemplate.java index 0ea7b6a..d16617b 100644 --- a/AlgebraicDataflowArchitectureModel/src/models/dataConstraintModel/IdentifierTemplate.java +++ b/AlgebraicDataflowArchitectureModel/src/models/dataConstraintModel/IdentifierTemplate.java @@ -33,4 +33,13 @@ public void setResourceStateType(Type resourceStateType) { this.resourceStateType = resourceStateType; } + + public boolean equals(Object another) { + if (!(another instanceof IdentifierTemplate)) return false; + return resourceName.equals(((IdentifierTemplate) another).resourceName); + } + + public int hashCode() { + return resourceName.hashCode(); + } } diff --git a/AlgebraicDataflowArchitectureModel/src/tests/DerivingStorageResourcesTest.java b/AlgebraicDataflowArchitectureModel/src/tests/DerivingStorageResourcesTest.java index ae31879..d964d85 100644 --- a/AlgebraicDataflowArchitectureModel/src/tests/DerivingStorageResourcesTest.java +++ b/AlgebraicDataflowArchitectureModel/src/tests/DerivingStorageResourcesTest.java @@ -46,7 +46,9 @@ ResourceDependencyGraph graph = DataStorageNecessity.run(model); for (Node n:graph.getNodes()) { ResourceNode resource = (ResourceNode)n; - System.out.println(((StoreAttribute)resource.getAttribute()).isStored()); + if((StoreAttribute)resource.getAttribute() != null) { + System.out.println(resource.toString() + ":" + ((StoreAttribute)resource.getAttribute()).isNeeded()); + } } } catch (ExpectedChannel | ExpectedChannelName | ExpectedLeftCurlyBracket | ExpectedInOrOutKeyword | ExpectedStateTransition | ExpectedEquals | ExpectedRHSExpression | WrongLHSExpression