source: trunk/autoquest-plugin-php/src/main/java/de/ugoe/cs/autoquest/plugin/php/eventcore/PHPEventTarget.java @ 927

Last change on this file since 927 was 927, checked in by sherbold, 12 years ago
  • added copyright under the Apache License, Version 2.0
  • Property svn:mime-type set to text/plain
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.php.eventcore;
16
17import de.ugoe.cs.autoquest.eventcore.IEventTarget;
18
19/**
20 * <p>
21 * Event target for PHP web requests.
22 * </p>
23 *
24 * @version $Revision: $ $Date: Aug 16, 2012$
25 * @author 2012, last modified by $Author: sherbold$
26 */
27public class PHPEventTarget implements IEventTarget {
28
29    /**
30     * <p>
31     * Id for object serialization.
32     * </p>
33     */
34    private static final long serialVersionUID = 1L;
35
36    /**
37     * <p>
38     * Path of the PHP request.
39     * </p>
40     */
41    private String path;
42
43    /**
44     * <p>
45     * Constructor. Creates a new PHP event target as the path of the request.
46     * </p>
47     *
48     * @param path
49     *            path of the URI of the event
50     */
51    public PHPEventTarget(String path) {
52        this.path = path;
53    }
54
55    /*
56     * (non-Javadoc)
57     *
58     * @see de.ugoe.cs.autoquest.eventcore.IEventTarget#getPlatform()
59     */
60    @Override
61    public String getPlatform() {
62        return "PHP";
63    }
64
65    @Override
66    public String getStringIdentifier() {
67        return this.toString();
68    }
69
70    /*
71     * (non-Javadoc)
72     *
73     * @see java.lang.Object#toString()
74     */
75    @Override
76    public String toString() {
77        return path;
78    }
79
80    /*
81     * (non-Javadoc)
82     *
83     * @see java.lang.Object#equals()
84     */
85    @Override
86    public boolean equals(Object obj) {
87        if (obj instanceof PHPEventTarget) {
88            if (path != null) {
89                return path.equals(((PHPEventTarget) obj).path);
90            }
91            else {
92                return ((PHPEventTarget) obj).path == null;
93            }
94        }
95        return false;
96    }
97
98    /*
99     * (non-Javadoc)
100     *
101     * @see java.lang.Object#hashCode()
102     */
103    @Override
104    public int hashCode() {
105        int hash = 3;
106        if (path != null) {
107            hash = path.hashCode();
108        }
109        return hash;
110    }
111
112}
Note: See TracBrowser for help on using the repository browser.