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

Last change on this file since 1069 was 1069, checked in by pharms, 11 years ago
  • support of new HTML logging format
File size: 2.4 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 * TODO comment
22 * </p>
23 *
24 * @author Patrick Harms
25 */
26public class HTMLServerSpec extends HTMLGUIElementSpec implements IGUIElementSpec {
27
28    /**  */
29    private static final long serialVersionUID = 1L;
30   
31    /** */
32    private String host;
33   
34    /** */
35    private int port;
36
37    /**
38     * <p>
39     * TODO: comment
40     * </p>
41     *
42     * @param serverName
43     * @param port
44     */
45    public HTMLServerSpec(String host, int port) {
46        super("server");
47       
48        if (host == null) {
49            throw new IllegalArgumentException("host must not be null");
50        }
51       
52        if ((port < -1) || (port > 65536)) {
53            throw new IllegalArgumentException("port " + port + " is not a valid port");
54        }
55
56        this.host = host;
57        this.port = port;
58    }
59
60    /* (non-Javadoc)
61     * @see de.ugoe.cs.autoquest.eventcore.guimodel.IGUIElementSpec#getSimilarity(IGUIElementSpec)
62     */
63    @Override
64    public boolean getSimilarity(IGUIElementSpec other) {
65        if (other instanceof HTMLServerSpec) {
66            HTMLServerSpec otherSpec = (HTMLServerSpec) other;
67           
68            if (!super.getSimilarity(otherSpec)) {
69                return false;
70            }
71            else if (!host.equals(otherSpec.host)) {
72                return false;
73            }
74            else {
75                return (port == otherSpec.port);
76            }
77        }
78       
79        return false;
80    }
81
82    /**
83     * <p>
84     * TODO: comment
85     * </p>
86     *
87     * @return
88     */
89    String getHost() {
90        return this.host;
91    }
92
93    /**
94     * <p>
95     * TODO: comment
96     * </p>
97     *
98     * @return
99     */
100    int getPort() {
101        return this.port;
102    }
103
104}
Note: See TracBrowser for help on using the repository browser.