source: trunk/autoquest-generic-event-monitor/src/main/java/de/ugoe/cs/autoquest/genericeventmonitor/GenericEvent.java @ 2155

Last change on this file since 2155 was 2155, checked in by pharms, 7 years ago
  • Property svn:mime-type set to text/plain
File size: 3.0 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.genericeventmonitor;
16
17import java.util.Map;
18
19/**
20 * <p>
21 * represents an event caused by a user on a client. An event contains the infos
22 * about the client ({@link ClientInfos}, when and where the event took place, the type of
23 * event and some additional infos such as the event coordinates or the number of the pressed
24 * key.
25 * </p>
26 *
27 * @author Patrick Harms
28 */
29class GenericEvent {
30
31    /**
32     * infos about the client that caused the event
33     */
34    private ClientInfos clientInfos;
35
36    /**
37     * the time stamp of the event
38     */
39    private Long time;
40
41    /**
42     * the target on which the event was executed
43     */
44    private GenericEventTarget target;
45
46    /**
47     * the type of the event, e.g. onclick
48     */
49    private String eventType;
50
51    /**
52     * additional parameters of the event
53     */
54    private Map<String, String> parameters;
55
56    /**
57     * <p>
58     * initializes the event with all relevant infos
59     * </p>
60     *
61     * @param clientInfos    infos about the client that caused the event
62     * @param time           the time stamp of the event
63     * @param target         the HTML element on which the event was executed
64     * @param eventType      the type of the event
65     * @param parameters     the parameters of the event
66     */
67    GenericEvent(ClientInfos         clientInfos,
68                 Long                time,
69                 GenericEventTarget  target,
70                 String              eventType,
71                 Map<String, String> parameters)
72    {
73        this.clientInfos = clientInfos;
74        this.time = time;
75        this.target = target;
76        this.eventType = eventType;
77        this.parameters = parameters;
78    }
79
80    /**
81     * @return the clientInfos
82     */
83    ClientInfos getClientInfos() {
84        return clientInfos;
85    }
86
87    /**
88     * @return the time
89     */
90    Long getTime() {
91        return time;
92    }
93
94    /**
95     * @return the target
96     */
97    GenericEventTarget getTarget() {
98        return target;
99    }
100
101    /**
102     * @return the eventType
103     */
104    String getEventType() {
105        return eventType;
106    }
107
108    /**
109     * @return the parameters
110     */
111    Map<String, String> getParameters() {
112        return parameters;
113    }
114
115    /* (non-Javadoc)
116     * @see java.lang.Object#toString()
117     */
118    @Override
119    public String toString() {
120        return eventType + " on " + target;
121    }
122}
Note: See TracBrowser for help on using the repository browser.