diff --git a/AlgebraicDataflowArchitectureModel/src/algorithm/DerivingStorageResources.java b/AlgebraicDataflowArchitectureModel/src/algorithm/DerivingStorageResources.java index 0ae7a19..062e93b 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithm/DerivingStorageResources.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithm/DerivingStorageResources.java @@ -1,9 +1,28 @@ package algorithm; +import models.algebra.Expression; +import models.algebra.Position; +import models.algebra.Type; +import models.dataConstraintModel.ChannelGenerator; +import models.dataConstraintModel.ChannelMember; +import models.dataConstraintModel.DataConstraintModel; import models.dataFlowModel.DataFlowModel; public class DerivingStorageResources { public void run(DataFlowModel model) { - + DataConstraintModel dcmodel = (DataConstraintModel) model; + for (ChannelGenerator generator : dcmodel.getChannelGenerators()) { + for (ChannelMember member : generator.getChannelMembers()) { + Expression curexp = member.getStateTransition().getCurStateExpression(); + Expression nextexp = member.getStateTransition().getNextStateExpression(); + for (Position cuspos : curexp.getVariables().keySet()) { + for (Position nextpos : nextexp.getVariables().keySet()) { + if (curexp.getVariables().get(cuspos) == nextexp.getVariables().get(nextpos)) { + member.getIdentifierTemplate().setResourceStateType(new Type("PUSH", "push")); + } + } + } + } + } } }