1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
package org.argouml.model.euml; |
14 | |
|
15 | |
import java.util.List; |
16 | |
|
17 | |
import org.argouml.model.AbstractModelFactory; |
18 | |
import org.argouml.model.DataTypesFactory; |
19 | |
import org.argouml.model.NotImplementedException; |
20 | |
import org.eclipse.uml2.uml.OpaqueExpression; |
21 | |
import org.eclipse.uml2.uml.UMLFactory; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | 0 | class DataTypesFactoryEUMLImpl implements DataTypesFactory, |
27 | |
AbstractModelFactory { |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
private EUMLModelImplementation modelImpl; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | 0 | public DataTypesFactoryEUMLImpl(EUMLModelImplementation implementation) { |
40 | 0 | modelImpl = implementation; |
41 | 0 | } |
42 | |
|
43 | |
public Object createActionExpression(String language, String body) { |
44 | 0 | return createExpression(language, body); |
45 | |
} |
46 | |
|
47 | |
public Object createArgListsExpression(String language, String body) { |
48 | 0 | return createExpression(language, body); |
49 | |
} |
50 | |
|
51 | |
public Object createBooleanExpression(String language, String body) { |
52 | 0 | return createExpression(language, body); |
53 | |
} |
54 | |
|
55 | |
public OpaqueExpression createExpression(String language, String body) { |
56 | |
|
57 | |
|
58 | |
|
59 | |
|
60 | 0 | OpaqueExpression expression = |
61 | |
UMLFactory.eINSTANCE.createOpaqueExpression(); |
62 | 0 | expression.getLanguages().add(language); |
63 | 0 | expression.getBodies().add(body); |
64 | 0 | return expression; |
65 | |
} |
66 | |
|
67 | |
public Object createIterationExpression(String language, String body) { |
68 | 0 | return createExpression(language, body); |
69 | |
} |
70 | |
|
71 | |
public Object createMappingExpression(String language, String body) { |
72 | 0 | return createExpression(language, body); |
73 | |
} |
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
public Object createMultiplicity(int lower, int upper) { |
80 | 0 | throw new NotImplementedException(); |
81 | |
} |
82 | |
|
83 | |
public Object createMultiplicity(List range) { |
84 | 0 | throw new NotImplementedException(); |
85 | |
} |
86 | |
|
87 | |
public Object createMultiplicity(String str) { |
88 | 0 | throw new NotImplementedException(); |
89 | |
} |
90 | |
|
91 | |
public Object createMultiplicityRange(String str) { |
92 | 0 | throw new NotImplementedException(); |
93 | |
} |
94 | |
|
95 | |
public Object createMultiplicityRange(int lower, int upper) { |
96 | 0 | throw new NotImplementedException(); |
97 | |
} |
98 | |
|
99 | |
public Object createObjectSetExpression(String language, String body) { |
100 | 0 | return createExpression(language, body); |
101 | |
} |
102 | |
|
103 | |
public Object createProcedureExpression(String language, String body) { |
104 | 0 | return createExpression(language, body); |
105 | |
} |
106 | |
|
107 | |
public Object createTimeExpression(String language, String body) { |
108 | 0 | return createExpression(language, body); |
109 | |
} |
110 | |
|
111 | |
public Object createTypeExpression(String language, String body) { |
112 | 0 | return createExpression(language, body); |
113 | |
} |
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
|
119 | |
|
120 | |
|
121 | |
static String boundToString(int i) { |
122 | 0 | if (i == -1) { |
123 | 0 | return "*"; |
124 | |
} else { |
125 | 0 | return Integer.toString(i); |
126 | |
} |
127 | |
} |
128 | |
|
129 | |
|
130 | |
|
131 | |
|
132 | |
|
133 | |
|
134 | |
|
135 | |
private static int stringToBound(String b) { |
136 | |
try { |
137 | 0 | if (b.equals("n") || b.equals("*")) { |
138 | 0 | return -1; |
139 | |
} else { |
140 | 0 | return Integer.parseInt(b); |
141 | |
} |
142 | 0 | } catch (Exception ex) { |
143 | 0 | throw new IllegalArgumentException( |
144 | |
"illegal range bound : " + b); |
145 | |
} |
146 | |
} |
147 | |
|
148 | |
} |