source: trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLGUIElementSpec.java @ 1276

Last change on this file since 1276 was 1276, checked in by pharms, 11 years ago
  • added some Java Docs
File size: 2.5 KB
Line 
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
15package de.ugoe.cs.autoquest.plugin.html.guimodel;
16
17import de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec;
18
19/**
20 * <p>
21 * base class for all GUI element specifications in the context of HTML
22 * </p>
23 *
24 * @author Patrick Harms
25 */
26public class HTMLGUIElementSpec implements IGUIElementSpec {
27
28    /**
29     * <p>
30     * default serial version UID
31     * </p>
32     */
33    private static final long serialVersionUID = 1L;
34   
35    /**
36     * <p>
37     * the type of GUI element represented by this specification, which is usually the tag name of
38     * the HTML GUI element
39     * </p>
40     */
41    private String type;
42   
43    /**
44     * <p>
45     * instantiated the specification with the type, i.e., tag name of the represented GUI element
46     * </p>
47     *
48     * @param type  the type, i.e., tag name of the represented GUI element
49     *
50     * @throws IllegalArgumentException if the provided type is null
51     */
52    public HTMLGUIElementSpec(String type) {
53        if (type == null) {
54            throw new IllegalArgumentException("type must not be null");
55        }
56
57        this.type = type;
58    }
59
60    /* (non-Javadoc)
61     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec#getType()
62     */
63    @Override
64    public String getType() {
65        return type;
66    }
67
68    /* (non-Javadoc)
69     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec#getSimilarity(IGUIElementSpec)
70     */
71    @Override
72    public boolean getSimilarity(IGUIElementSpec other) {
73        if (other instanceof HTMLGUIElementSpec) {
74            HTMLGUIElementSpec otherSpec = (HTMLGUIElementSpec) other;
75            return type.equals(otherSpec.type);
76        }
77       
78        return false;
79    }
80
81    /* (non-Javadoc)
82     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec#getTypeHierarchy()
83     */
84    @Override
85    public String[] getTypeHierarchy() {
86        return new String[] { type };
87    }
88
89}
Note: See TracBrowser for help on using the repository browser.