Mercurial > projects > doodle
comparison import/p-model.d @ 0:e907d2c54ec3
Initial import
author | David Bryant <daveb@acres.com.au> |
---|---|
date | Wed, 13 May 2009 15:42:39 +0930 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e907d2c54ec3 |
---|---|
1 module dog.presentation.model; | |
2 | |
3 import dog.presentation.types; | |
4 import util.list; | |
5 | |
6 class Property { | |
7 this(char[] key, char[] value) { | |
8 _key = key; | |
9 _value = value; | |
10 } | |
11 | |
12 char[] key() { return _key; } | |
13 char[] value() { return _value; } | |
14 | |
15 private { | |
16 char[] _key; | |
17 char[] _value; | |
18 } | |
19 } | |
20 | |
21 interface IVisitor { | |
22 void visit(GraphEdge); | |
23 void visit(GraphNode); | |
24 } | |
25 | |
26 class Diagram { | |
27 } | |
28 | |
29 abstract class DiagramElement { | |
30 this() { | |
31 _is_visible = true; | |
32 } | |
33 | |
34 abstract void accept(in IVisitor visitor); | |
35 | |
36 bool is_visible() { return _is_visible; } | |
37 | |
38 void add_property(Property property) { | |
39 // TODO | |
40 _properties.addTail(property); | |
41 } | |
42 | |
43 private { | |
44 List!(Property) _properties; | |
45 bool _is_visible; | |
46 GraphElement _container; | |
47 } | |
48 } | |
49 | |
50 abstract class SemanticModelBridge { | |
51 this(char[] presentation) { | |
52 _presentation = presentation; | |
53 } | |
54 | |
55 char[] presentation() { return _presentation; } | |
56 | |
57 private { | |
58 char[] _presentation; | |
59 } | |
60 } | |
61 | |
62 class SimpleSemanticModelElement : SemanticModelBridge { | |
63 this(char[] type_info, char[] presentation) { | |
64 super(presentation); | |
65 _type_info = type_info; | |
66 } | |
67 | |
68 char[] type_info() { return _type_info; } | |
69 | |
70 private { | |
71 char[] _type_info; | |
72 } | |
73 } | |
74 | |
75 abstract class GraphElement : DiagramElement { | |
76 this() { | |
77 } | |
78 | |
79 void add_anchorage(GraphConnector anchorage) { | |
80 // TODO | |
81 } | |
82 | |
83 void remove_anchorage(GraphConnector anchorage) { | |
84 } | |
85 | |
86 private { | |
87 SemanticModelBridge _semantic_model; | |
88 Point _position; | |
89 List!(GraphConnector) _anchorages; | |
90 List!(DiagramElement) _containeds; | |
91 } | |
92 } | |
93 | |
94 class GraphConnector { | |
95 this(Point point) { | |
96 _point = point; | |
97 } | |
98 | |
99 private { | |
100 Point _point; | |
101 GraphElement _element; | |
102 GraphEdge[] _edges; | |
103 } | |
104 } | |
105 | |
106 class GraphEdge : GraphElement { | |
107 this() { | |
108 } | |
109 | |
110 void accept(IVisitor visitor) { | |
111 visitor.visit(this); | |
112 } | |
113 | |
114 private { | |
115 } | |
116 } | |
117 | |
118 class GraphNode : GraphElement { | |
119 this() { | |
120 } | |
121 | |
122 void accept(IVisitor visitor) { | |
123 visitor.visit(this); | |
124 } | |
125 | |
126 private { | |
127 } | |
128 } |