diff options
Diffstat (limited to 'subprojects/frontend/src/index.tsx')
-rw-r--r-- | subprojects/frontend/src/index.tsx | 102 |
1 files changed, 84 insertions, 18 deletions
diff --git a/subprojects/frontend/src/index.tsx b/subprojects/frontend/src/index.tsx index e8a22e82..4b251a23 100644 --- a/subprojects/frontend/src/index.tsx +++ b/subprojects/frontend/src/index.tsx | |||
@@ -16,35 +16,101 @@ import RootStore from './RootStore'; | |||
16 | (window as unknown as { fixViteIssue: unknown }).fixViteIssue = styled; | 16 | (window as unknown as { fixViteIssue: unknown }).fixViteIssue = styled; |
17 | 17 | ||
18 | const initialValue = `% Metamodel | 18 | const initialValue = `% Metamodel |
19 | class Person { | 19 | |
20 | contains Post[] posts opposite author | 20 | abstract class CompositeElement { |
21 | Person[] friend opposite friend | 21 | contains Region[] regions |
22 | } | ||
23 | |||
24 | class Region { | ||
25 | contains Vertex[] vertices opposite region | ||
26 | } | ||
27 | |||
28 | abstract class Vertex { | ||
29 | container Region region opposite vertices | ||
30 | contains Transition[] outgoingTransition opposite source | ||
31 | Transition[] incomingTransition opposite target | ||
22 | } | 32 | } |
23 | 33 | ||
24 | class Post { | 34 | class Transition { |
25 | container Person author opposite posts | 35 | container Vertex source opposite outgoingTransition |
26 | Post replyTo | 36 | Vertex target opposite incomingTransition |
27 | } | 37 | } |
28 | 38 | ||
39 | abstract class Pseudostate extends Vertex. | ||
40 | |||
41 | abstract class RegularState extends Vertex. | ||
42 | |||
43 | class Entry extends Pseudostate. | ||
44 | |||
45 | class Exit extends Pseudostate. | ||
46 | |||
47 | class Choice extends Pseudostate. | ||
48 | |||
49 | class FinalState extends RegularState. | ||
50 | |||
51 | class State extends RegularState, CompositeElement. | ||
52 | |||
53 | class Statechart extends CompositeElement. | ||
54 | |||
29 | % Constraints | 55 | % Constraints |
30 | error replyToNotFriend(Post x, Post y) <-> | ||
31 | replyTo(x, y), | ||
32 | author(x, xAuthor), | ||
33 | author(y, yAuthor), | ||
34 | xAuthor != yAuthor, | ||
35 | !friend(xAuthor, yAuthor). | ||
36 | 56 | ||
37 | error replyToCycle(Post x) <-> replyTo+(x, x). | 57 | %% Entry |
58 | |||
59 | pred entryInRegion(Region r, Entry e) <-> | ||
60 | vertices(r, e). | ||
61 | |||
62 | error noEntryInRegion(Region r) <-> | ||
63 | !entryInRegion(r, _). | ||
64 | |||
65 | error multipleEntryInRegion(Region r) <-> | ||
66 | entryInRegion(r, e1), | ||
67 | entryInRegion(r, e2), | ||
68 | e1 != e2. | ||
69 | |||
70 | error incomingToEntry(Transition t, Entry e) <-> | ||
71 | target(t, e). | ||
72 | |||
73 | error noOutgoingTransitionFromEntry(Entry e) <-> | ||
74 | !source(_, e). | ||
75 | |||
76 | error multipleTransitionFromEntry(Entry e, Transition t1, Transition t2) <-> | ||
77 | outgoingTransition(e, t1), | ||
78 | outgoingTransition(e, t2), | ||
79 | t1 != t2. | ||
80 | |||
81 | %% Exit | ||
82 | |||
83 | error outgoingFromExit(Transition t, Exit e) <-> | ||
84 | source(t, e). | ||
85 | |||
86 | %% Final | ||
87 | |||
88 | error outgoingFromFinal(Transition t, FinalState e) <-> | ||
89 | source(t, e). | ||
90 | |||
91 | %% State vs Region | ||
92 | |||
93 | pred stateInRegion(Region r, State s) <-> | ||
94 | vertices(r, s). | ||
95 | |||
96 | error noStateInRegion(Region r) <-> | ||
97 | !stateInRegion(r, _). | ||
98 | |||
99 | %% Choice | ||
100 | |||
101 | error choiceHasNoOutgoing(Choice c) <-> | ||
102 | !source(_, c). | ||
103 | |||
104 | error choiceHasNoIncoming(Choice c) <-> | ||
105 | !target(_, c). | ||
38 | 106 | ||
39 | % Instance model | 107 | % Instance model |
40 | friend(a, b). | ||
41 | author(p1, a). | ||
42 | author(p2, b). | ||
43 | 108 | ||
44 | !author(Post::new, a). | 109 | Statechart(sct). |
45 | 110 | ||
46 | % Scope | 111 | % Scope |
47 | scope Post = 10..15, Person += 0. | 112 | |
113 | scope node = 20..30, Region = 2..*, Choice = 1..*, Statechart += 0. | ||
48 | `; | 114 | `; |
49 | 115 | ||
50 | configure({ | 116 | configure({ |