Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1da537ac0002e72e25d94c11e92c29d85e404785
[simgrid.git] / contrib / psg / src / example / bittorrent / SimpleEvent.java
1 /*
2  * Copyright (c) 2007-2008 Fabrizio Frioli, Michele Pedrolli
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16  *
17  * --
18  *
19  * Please send your questions/suggestions to:
20  * {fabrizio.frioli, michele.pedrolli} at studenti dot unitn dot it
21  *
22  */
23
24 package example.bittorrent;
25
26 /**
27  * This class defines a simple event. A simple event is characterized only
28  * by its type.
29  */
30 public class SimpleEvent {
31         
32         /**
33         * The identifier of the type of the event.
34         * <p>
35         * The available identifiers for event type are:<br/>
36         * <ul>
37         *  <li>1 is KEEP_ALIVE message</li>
38         *  <li>2 is CHOKE message</li>
39         *  <li>3 is UNCHOKE message</li>
40         *  <li>4 is INTERESTED message</li>
41         *  <li>5 is NOT_INTERESTED message</li>
42         *  <li>6 is HAVE message</li>
43         *  <li>7 is BITFIELD message</li>
44         *  <li>8 is REQUEST message</li>
45         *  <li>9 is PIECE message</li>
46         *  <li>10 is CANCEL message</li>
47         *  <li>11 is TRACKER message</li>
48         *  <li>12 is PEERSET message</li>
49         *  <li>13 is CHOKE_TIME event</li>
50         *  <li>14 is OPTUNCHK_TIME event</li>
51         *  <li>15 is ANTISNUB_TIME event</li>
52         *  <li>16 is CHECKALIVE_TIME event</li>
53         *  <li>17 is TRACKERALIVE_TIME event</li>
54         *  <li>18 is DOWNLOAD_COMPLETED event</li>
55         *</ul></p>
56         */
57         protected int type;
58         
59         public SimpleEvent(){
60         }
61         
62         /**
63      * Initializes the type of the event.
64          * @param type The identifier of the type of the event
65          */
66         public SimpleEvent(int type){
67                 this.type = type;
68         }
69         
70         /**
71          * Gets the type of the event.
72          * @return The type of the current event.
73          */
74         public int getType(){
75                 return this.type;       
76         }
77 }
78
79