1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
2 | // |
---|
3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
4 | // you may not use this file except in compliance with the License. |
---|
5 | // You may obtain a copy of the License at |
---|
6 | // |
---|
7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
8 | // |
---|
9 | // Unless required by applicable law or agreed to in writing, software |
---|
10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
12 | // See the License for the specific language governing permissions and |
---|
13 | // limitations under the License. |
---|
14 | |
---|
15 | package de.ugoe.cs.autoquest.plugin.html.guimodel; |
---|
16 | |
---|
17 | import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec; |
---|
18 | |
---|
19 | /** |
---|
20 | * <p> |
---|
21 | * TODO comment |
---|
22 | * </p> |
---|
23 | * |
---|
24 | * @author Patrick Harms |
---|
25 | */ |
---|
26 | public class HTMLGUIElementSpec implements IGUIElementSpec { |
---|
27 | |
---|
28 | /** */ |
---|
29 | private static final long serialVersionUID = 1L; |
---|
30 | |
---|
31 | /** */ |
---|
32 | private String type; |
---|
33 | |
---|
34 | /** |
---|
35 | * <p> |
---|
36 | * TODO: comment |
---|
37 | * </p> |
---|
38 | * |
---|
39 | * @param type |
---|
40 | * @param index |
---|
41 | * @param id |
---|
42 | */ |
---|
43 | public HTMLGUIElementSpec(String type) { |
---|
44 | if (type == null) { |
---|
45 | throw new IllegalArgumentException("type must not be null"); |
---|
46 | } |
---|
47 | |
---|
48 | this.type = type; |
---|
49 | } |
---|
50 | |
---|
51 | /* (non-Javadoc) |
---|
52 | * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec#getType() |
---|
53 | */ |
---|
54 | @Override |
---|
55 | public String getType() { |
---|
56 | return type; |
---|
57 | } |
---|
58 | |
---|
59 | /* (non-Javadoc) |
---|
60 | * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec#getSimilarity(IGUIElementSpec) |
---|
61 | */ |
---|
62 | @Override |
---|
63 | public boolean getSimilarity(IGUIElementSpec other) { |
---|
64 | if (other instanceof HTMLGUIElementSpec) { |
---|
65 | HTMLGUIElementSpec otherSpec = (HTMLGUIElementSpec) other; |
---|
66 | return type.equals(otherSpec.type); |
---|
67 | } |
---|
68 | |
---|
69 | return false; |
---|
70 | } |
---|
71 | |
---|
72 | /** |
---|
73 | * <p> |
---|
74 | * TODO: comment |
---|
75 | * </p> |
---|
76 | */ |
---|
77 | @Override |
---|
78 | public String[] getTypeHierarchy() { |
---|
79 | return new String[] { type }; |
---|
80 | } |
---|
81 | |
---|
82 | } |
---|