diff --git a/AlgebraicDataflowArchitectureModel/models/SimpleUI.model b/AlgebraicDataflowArchitectureModel/models/SimpleUI.model index 9b54346..3e03bbd 100644 --- a/AlgebraicDataflowArchitectureModel/models/SimpleUI.model +++ b/AlgebraicDataflowArchitectureModel/models/SimpleUI.model @@ -1,7 +1,12 @@ init { - screen := {"widgets": {"001": {"type": "button", "text": "OK", "state": 0}, - "002": {"type": "textInput", "text": "", "state": 0}}, - "layout": true} + screenTemplates := { + "000": {"widgets": {"001": {"type": "textInput", "text": "", "state": 0}, + "002": {"type": "button", "text": "Next", "state": 0}}, + "layout": true}, + "001": {"widgets": {"003": {"type": "label", "text": "label", "state": 0}, + "004": {"type": "button", "text": "Back", "state": 0}}, + "layout": true} + } } native channel ScreenUpdate { @@ -44,6 +49,16 @@ out screen.widgets.{wid}.text(curText: Str, textEvent(nextText)) = nextText } +channel ChangeCurScreen { + out curScreen(curScId: Str, changeCurScreen(nextScId)) = nextScId +} + +channel ScreenTransition { + in curScreen(curScId: Str, transScreen(nextScId, nextSc)) = nextScId + in screenTemplates.{nextScId}(curSc, transScreen(nextScId, nextSc)) = nextSc + out screen(curS, transScreen(nextScId, nextSc)) = nextSc +} + channel ChangeLayout { out screen.layout(curLayout: Bool, changeLayout(layout)) = layout } @@ -78,4 +93,4 @@ channel AddMovableTextInput { out screen.widgets(widgets: Map, addMovableTextInput(wid: Str, x: Int, y: Int, width: Int, height: Int)) = insert(widgets, wid, {"type": "textInput", "text": "", "x": x, "y": y, "width": width, "height": height, "state": 0}) -} +} \ No newline at end of file diff --git a/AlgebraicDataflowArchitectureModel/src/models/algebra/Symbol.java b/AlgebraicDataflowArchitectureModel/src/models/algebra/Symbol.java index 20c3cf2..980fc53 100644 --- a/AlgebraicDataflowArchitectureModel/src/models/algebra/Symbol.java +++ b/AlgebraicDataflowArchitectureModel/src/models/algebra/Symbol.java @@ -51,6 +51,7 @@ public Symbol(String name, int arity, Type operatorType, IImplGenerator generator) { this.name = name; + this.implName = name; this.arity = arity; this.operatorType = operatorType; this.generator = generator; @@ -59,6 +60,7 @@ public Symbol(String name, int arity, Type operatorType, IImplGenerator generator, boolean bSideEffect) { this.name = name; + this.implName = name; this.arity = arity; this.operatorType = operatorType; this.generator = generator; @@ -71,19 +73,23 @@ public Symbol(String name, int arity, ICalculator calculator) { this.name = name; + this.implName = name; this.arity = arity; this.calculator = calculator; } public Symbol(String name, int arity, Type operatorType, ICalculator calculator) { this.name = name; + this.implName = name; this.arity = arity; this.operatorType = operatorType; + this.implOperatorType = operatorType; this.calculator = calculator; } public Symbol(String name, int arity, Type operatorType, IImplGenerator generator, ICalculator calculator) { this.name = name; + this.implName = name; this.arity = arity; this.operatorType = operatorType; this.generator = generator; diff --git a/AlgebraicDataflowArchitectureModel/src/models/dataConstraintModel/DataConstraintModel.java b/AlgebraicDataflowArchitectureModel/src/models/dataConstraintModel/DataConstraintModel.java index a76879f..4482a27 100644 --- a/AlgebraicDataflowArchitectureModel/src/models/dataConstraintModel/DataConstraintModel.java +++ b/AlgebraicDataflowArchitectureModel/src/models/dataConstraintModel/DataConstraintModel.java @@ -40,10 +40,10 @@ public static final Symbol add = new Symbol(Parser.ADD, 2, Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -65,10 +65,10 @@ public static final Symbol mul = new Symbol(Parser.MUL, 2, Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -90,10 +90,10 @@ public static final Symbol sub = new Symbol(Parser.SUB, 2, Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -115,10 +115,10 @@ public static final Symbol div = new Symbol(Parser.DIV, 2, Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -140,10 +140,10 @@ public static final Symbol mod = new Symbol(Parser.MOD, 2, Symbol.Type.INFIX, "%", Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -161,7 +161,7 @@ public static final Symbol minus = new Symbol(Parser.MINUS, 1, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } Constant arg = (Constant) args.get(0); @@ -193,10 +193,10 @@ }, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -237,10 +237,10 @@ }, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -269,10 +269,10 @@ public static final Symbol gt = new Symbol(Parser.GT, 2, Symbol.Type.INFIX, ">", Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -299,10 +299,10 @@ public static final Symbol lt = new Symbol(Parser.LT, 2, Symbol.Type.INFIX, "<", Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -329,10 +329,10 @@ public static final Symbol ge = new Symbol(Parser.GE, 2, Symbol.Type.INFIX, ">=", Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -359,10 +359,10 @@ public static final Symbol le = new Symbol(Parser.LE, 2, Symbol.Type.INFIX, "<=", Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -389,10 +389,10 @@ public static final Symbol and = new Symbol(Parser.AND, 2, Symbol.Type.INFIX, "&&", Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -413,10 +413,10 @@ public static final Symbol or = new Symbol(Parser.OR, 2, Symbol.Type.INFIX, "||", Symbol.Type.INFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } - if (!(args.get(1) instanceof Constant)) { + if (!(args.get(1).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -437,7 +437,7 @@ public static final Symbol neg = new Symbol(Parser.NEG, 1, Symbol.Type.PREFIX, "!", Symbol.Type.PREFIX, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) { + if (!(args.get(0).getClass() == Constant.class)) { return null; } Constant arg0 = (Constant) args.get(0); @@ -475,7 +475,7 @@ }, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (args.get(0) instanceof Constant && ((Constant) args.get(0)).getSymbol().equals(nil)) { + if (args.get(0).getClass() == Constant.class && ((Constant) args.get(0)).getSymbol().equals(nil)) { return new Constant(false_); } if (args.get(0) instanceof Term) { @@ -588,7 +588,7 @@ }, new Symbol.ICalculator() { @Override public Expression calculate(List args) { - if (!(args.get(0) instanceof Constant)) return null; + if (!(args.get(0).getClass() == Constant.class)) return null; if (((Constant) args.get(0)).getSymbol().equals(true_)) { return args.get(1); } else if (((Constant) args.get(0)).getSymbol().equals(false_)) {