PageRenderTime 43ms CodeModel.GetById 36ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/core/src/com/bluemarsh/jswat/core/session/SessionEvent.java

http://jswat.googlecode.com/
Java | 96 lines | 27 code | 8 blank | 61 comment | 0 complexity | 53a64d93cbb7515a9a24416e1e12d857 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception
 1/*
 2 * The contents of this file are subject to the terms of the Common Development
 3 * and Distribution License (the License). You may not use this file except in
 4 * compliance with the License.
 5 *
 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
 7 * or http://www.netbeans.org/cddl.txt.
 8 *
 9 * When distributing Covered Code, include this CDDL Header Notice in each file
10 * and include the License file at http://www.netbeans.org/cddl.txt.
11 * If applicable, add the following below the CDDL Header, with the fields
12 * enclosed by brackets [] replaced by your own identifying information:
13 * "Portions Copyrighted [year] [name of copyright owner]"
14 *
15 * The Original Software is JSwat. The Initial Developer of the Original
16 * Software is Nathan L. Fiedler. Portions created by Nathan L. Fiedler
17 * are Copyright (C) 2002-2010. All Rights Reserved.
18 *
19 * Contributor(s): Nathan L. Fiedler.
20 *
21 * $Id: SessionEvent.java 285 2010-11-20 23:56:08Z nathanfiedler $
22 */
23package com.bluemarsh.jswat.core.session;
24
25import com.sun.jdi.event.Event;
26import java.util.EventObject;
27
28/**
29 * Class SessionEvent encapsulates information about the Session and its
30 * current state, as well as information about the event that is taking
31 * place.
32 *
33 * @author  Nathan Fiedler
34 */
35public class SessionEvent extends EventObject {
36
37    /** silence the compiler warnings */
38    private static final long serialVersionUID = 1L;
39    /** The Session related to this event. */
40    private transient final Session session;
41    /** The JDI event that caused this event. */
42    private transient final Event event;
43    /** The type of session change. */
44    private final SessionEventType type;
45
46    /**
47     * Constructs a new SessionEvent.
48     *
49     * @param  session  Session related to this event.
50     * @param  type     type of session change.
51     */
52    public SessionEvent(Session session, SessionEventType type) {
53        this(session, type, null);
54    }
55
56    /**
57     * Constructs a new SessionEvent.
58     *
59     * @param  session  Session related to this event.
60     * @param  type     type of session change.
61     * @param  event    event that brought about this event.
62     */
63    public SessionEvent(Session session, SessionEventType type, Event event) {
64        super(session);
65        this.event = event;
66        this.session = session;
67        this.type = type;
68    }
69
70    /**
71     * Returns the JDI event object that caused this event to happen.
72     *
73     * @return  event that caused this event; may be null.
74     */
75    public Event getEvent() {
76        return event;
77    }
78
79    /**
80     * Returns the Session relating to this event.
81     *
82     * @return  Session for this event.
83     */
84    public Session getSession() {
85        return session;
86    }
87
88    /**
89     * Get the session event type.
90     *
91     * @return  session event type.
92     */
93    public SessionEventType getType() {
94        return type;
95    }
96}