|
|
@@ -19,94 +19,5 @@ angular.module("modellang-ide.home", [
|
|
|
.controller("HomeCtrl",
|
|
|
["$scope", "$compile",
|
|
|
function($scope, $compile) {
|
|
|
-
|
|
|
- $scope.editorModel = {
|
|
|
- data: //TODO: remove this and move elsewhere very soon
|
|
|
- "// line comment\n" +
|
|
|
- "\n" +
|
|
|
- "/* this is a\n" +
|
|
|
- " * a block comment\n" +
|
|
|
- " */\n" +
|
|
|
- "\n" +
|
|
|
- "\n" +
|
|
|
- "// Example 1: car race scenarios\n" +
|
|
|
- "SCHEMA ex1_car_race\n" +
|
|
|
- "ROOT car_race: {+ driving_a_car +};\n" +
|
|
|
- "driving_a_car: go_straight (* ( go_straight | turn_left | turn_right ) *) stop;\n" +
|
|
|
- "go_straight: ( accelerate | decelerate | cruise );\n" +
|
|
|
- "\n" +
|
|
|
- "\n" +
|
|
|
- "// Example 2: Simple pipe/filter architecture pattern\n" +
|
|
|
- "SCHEMA ex2_simple_message_flow\n" +
|
|
|
- "ROOT Task_A: (* send *);\n" +
|
|
|
- "ROOT Task_B: (* receive *);\n" +
|
|
|
- "COORDINATE (* $x: send *) FROM Task_A, (* $y: receive *) FROM Task_B\n" +
|
|
|
- " ADD $x PRECEDES $y;\n" +
|
|
|
- "\n" +
|
|
|
- "\n" +
|
|
|
- "// Example 3. Data items as behaviors. Data flow.\n" +
|
|
|
- "SCHEMA Data_flow\n" +
|
|
|
- "ROOT Process_1: (* work write *);\n" +
|
|
|
- "ROOT Process_2: (* ( read | work ) *);\n" +
|
|
|
- "ROOT File: (* write *) (* read *);\n" +
|
|
|
- "Process_1, File SHARE ALL write;\n" +
|
|
|
- "Process_2, File SHARE ALL read;\n" +
|
|
|
- "\n" +
|
|
|
- "\n" +
|
|
|
- "// Example 4. Stack behavior\n" +
|
|
|
- "SCHEMA Stack\n" +
|
|
|
- "ROOT Stack_operation: (* ( push | pop) *);\n" +
|
|
|
- "SATISFIES FOREACH $x: pop FROM Stack_operation\n" +
|
|
|
- " ( Number_of (pop) before ($x) < Number_of (push) before ($x) );\n" +
|
|
|
- "\n" +
|
|
|
- "\n" +
|
|
|
- "// Example 5 (from the PDF)\n" +
|
|
|
- "SCHEMA Two_stacks_in_use\n" +
|
|
|
- "INCLUDE Stack;\n" +
|
|
|
- "ROOT Main: {* (do_something | use_S1 | use_S2) *};\n" +
|
|
|
- " use_S1: (push | pop);\n" +
|
|
|
- " use_S2: (push | pop);\n" +
|
|
|
- "ROOT S1: (* use_S1 *);\n" +
|
|
|
- "ROOT S2: (* use_S2 *);\n" +
|
|
|
- "\n" +
|
|
|
- "S1, Main SHARE ALL use_S1;\n" +
|
|
|
- "S2, Main SHARE ALL use_S2;\n" +
|
|
|
- "\n" +
|
|
|
- "\n" +
|
|
|
- "// Example 6. Components and connectors\n" +
|
|
|
- "SCHEMA Buffered_transaction\n" +
|
|
|
- "ROOT Task_A:: (* Send *);\n" +
|
|
|
- "ROOT Task_B:: (* Receive *);\n" +
|
|
|
- "ROOT Buffered_channel: {* (Send [ Receive ] ) *} (Overflow | Normal);\n" +
|
|
|
- "\n" +
|
|
|
- "Task_A, Buffered_channel SHARE ALL Send;\n" +
|
|
|
- "Task_B, Buffered_channel SHARE ALL Receive;\n" +
|
|
|
- "\n" +
|
|
|
- "SATISFIES FOREACH $x: Receive FROM Buffered_channel\n" +
|
|
|
- " ( Number_of (Send) before ($x) - Number_of (Receive) before ($x) ) <= max_buffer_size;\n" +
|
|
|
- "SATISFIES FOREACH $x: Overflow FROM Buffered_channel\n" +
|
|
|
- " ( Number_of (Send) before ($x) - Number_of (Receive) before ($x) ) > max_buffer_size;\n" +
|
|
|
- "SATISFIES FOREACH $x: Normal FROM Buffered_channel\n" +
|
|
|
- " ( Number_of (Send) before ($x) - Number_of (Receive) before ($x) ) <= max_buffer_size;\n" +
|
|
|
- "\n" +
|
|
|
- "\n" +
|
|
|
- "//TODO: Example 7\n" +
|
|
|
- "//TODO: Example 8\n" +
|
|
|
- "//TODO: Example 9\n" +
|
|
|
- "//TODO: Example 10\n" +
|
|
|
- "//TODO: Example 11\n" +
|
|
|
- "//TODO: Example 12\n" +
|
|
|
- "//TODO: Example 13\n" +
|
|
|
- "//TODO: Example 14\n" +
|
|
|
- "//TODO: Example 15\n" +
|
|
|
- "\n"
|
|
|
- };
|
|
|
-
|
|
|
- $scope.menus = "File";
|
|
|
-
|
|
|
- $scope.save = function() {
|
|
|
- localStorage.setItem("code", $scope.editor.doc.getValue());
|
|
|
- };
|
|
|
-
|
|
|
},
|
|
|
]);
|