View Javadoc

1   /*
2    *  XNap - A P2P framework and client.
3    *
4    *  See the file AUTHORS for copyright information.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation.
9    *
10   *  This program is distributed in the hope that it will be useful,
11   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  GNU General Public License for more details.
14   *
15   *  You should have received a copy of the GNU General Public License
16   *  along with this program; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  package org.xnap.plugin.gift.net.event;
21  
22  /***
23   * ControlEvent
24   *
25   * @author <a href="mailto:tvanlessen@taval.de">Tammo van Lessen</a>
26   * @version CVS $Id: ControlEvent.java,v 1.1 2003/10/05 00:20:32 squig Exp $
27   */
28  public class ControlEvent extends Event {
29      //~ Static fields/initializers ---------------------------------------------
30  
31      public static final int STARTED = 0;
32      public static final int FINISHED = 1;
33      public static final String[] ACTIONS = { "started", "finished" };
34  
35      //~ Instance fields --------------------------------------------------------
36  
37      private String status;
38      private int action;
39  
40      //~ Constructors -----------------------------------------------------------
41  
42      /***
43       * Constructor for ControlEvent.
44       *
45       * @param action the action
46       */
47      public ControlEvent(int action) {
48          super();
49          this.action = action;
50          this.status = null;
51      }
52  
53      /***
54       * Creates a new ControlEvent object.
55       *
56       * @param action DOCUMENT ME!
57       * @param status DOCUMENT ME!
58       */
59      public ControlEvent(int action, String status) {
60          super();
61          this.action = action;
62          this.status = status;
63      }
64  
65      //~ Methods ----------------------------------------------------------------
66  
67      /***
68       * Sets the action.
69       *
70       * @param action The action to set
71       */
72      public void setAction(int action) {
73          this.action = action;
74      }
75  
76      /***
77       * Returns the action.
78       *
79       * @return int
80       */
81      public int getAction() {
82          return action;
83      }
84  
85      /***
86       * Sets the status.
87       *
88       * @param status The status to set
89       */
90      public void setStatus(String status) {
91          this.status = status;
92      }
93  
94      /***
95       * Returns the status.
96       *
97       * @return String
98       */
99      public String getStatus() {
100         return status;
101     }
102 
103     /***
104      * @see java.lang.Object#toString()
105      */
106     public String toString() {
107         return ACTIONS[action] + "@" + getClass().getName();
108     }
109 }