diff --git a/AlgebraicDataflowArchitectureModel/src/algorithms/MethodBodyGenerator.java b/AlgebraicDataflowArchitectureModel/src/algorithms/MethodBodyGenerator.java index 2e783b2..c27b6b3 100644 --- a/AlgebraicDataflowArchitectureModel/src/algorithms/MethodBodyGenerator.java +++ b/AlgebraicDataflowArchitectureModel/src/algorithms/MethodBodyGenerator.java @@ -10,6 +10,7 @@ import models.Node; import models.algebra.InvalidMessage; import models.algebra.ParameterizedIdentifierIsFutureWork; +import models.algebra.Symbol; import models.algebra.UnificationFailed; import models.algebra.ValueUndefined; import models.dataConstraintModel.ChannelMember; @@ -23,6 +24,21 @@ public class MethodBodyGenerator { public static ArrayList doGenerate(ResourceDependencyGraph graph, DataFlowModel model, ArrayList types) { + Symbol floor = model.getSymbol("floor"); + Symbol.Memento floorMem = null; + if (floor != null) { + floorMem = floor.createMemento(); + floor.setImplName("(int)Math.floor"); + floor.setImplOperatorType(Symbol.Type.PREFIX); + } + Symbol sum = model.getSymbol("sum"); + Symbol.Memento sumMem = null; + if (sum != null) { + sumMem = sum.createMemento(); + sum.setImplName("stream().mapToInt(x->x).sum"); + sum.setImplOperatorType(Symbol.Type.METHOD); + } + // Create a map from type names (lower case) to their types. Map typeMap = new HashMap<>(); for (TypeDeclaration type: types) { @@ -73,6 +89,9 @@ | InvalidMessage | UnificationFailed | ValueUndefined e1) { e1.printStackTrace(); } + + if (floor != null) floor.setMemento(floorMem); + if (sum != null) sum.setMemento(sumMem); return types; }