Last change
on this file since 437 was
437,
checked in by Mateusz Poszwa, 9 years ago
|
Added Framclipse as developed by Bartosz Kukawka and Tomek Maciejewski in 2010
|
-
Property svn:eol-style set to
native
|
File size:
1.2 KB
|
Line | |
---|
1 | package com.framsticks.framclipse.script.model; |
---|
2 | |
---|
3 | import java.util.Collections; |
---|
4 | import java.util.List; |
---|
5 | |
---|
6 | import com.thoughtworks.xstream.annotations.XStreamAsAttribute; |
---|
7 | import com.thoughtworks.xstream.annotations.XStreamImplicit; |
---|
8 | |
---|
9 | public class Type { |
---|
10 | |
---|
11 | public static final Type[] BUILT_IN = { |
---|
12 | createBuiltInType("void"), createBuiltInType("integer"), |
---|
13 | createBuiltInType("float") |
---|
14 | }; |
---|
15 | |
---|
16 | @XStreamAsAttribute |
---|
17 | private String name, context; |
---|
18 | |
---|
19 | private String description; |
---|
20 | |
---|
21 | @XStreamImplicit(itemFieldName = "element") |
---|
22 | private List<Element> elements; |
---|
23 | |
---|
24 | public String getName() { |
---|
25 | return name; |
---|
26 | } |
---|
27 | |
---|
28 | public String getContext() { |
---|
29 | return context; |
---|
30 | } |
---|
31 | |
---|
32 | public String getDescription() { |
---|
33 | return description; |
---|
34 | } |
---|
35 | |
---|
36 | public List<Element> getElements() { |
---|
37 | return elements != null ? elements : Collections.<Element> emptyList(); |
---|
38 | } |
---|
39 | |
---|
40 | @Override |
---|
41 | public String toString() { |
---|
42 | return name; |
---|
43 | } |
---|
44 | |
---|
45 | public Element getElement(String name) { |
---|
46 | for (Element e : getElements()) { |
---|
47 | if (e.getName().equals(name)) { |
---|
48 | return e; |
---|
49 | } |
---|
50 | } |
---|
51 | return null; |
---|
52 | } |
---|
53 | |
---|
54 | public static Type createBuiltInType(String name) { |
---|
55 | Type type = new Type(); |
---|
56 | type.name = name; |
---|
57 | type.context = null; |
---|
58 | type.description = "built-in type"; |
---|
59 | return type; |
---|
60 | } |
---|
61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.