Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill another out of date script
[simgrid.git] / contrib / psg / src / example / bittorrent / SimpleMsg.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 import peersim.core.*;
27
28 /**
29  * This class defines a simple message.
30  * A simple message has its type and the reference of the sender node.
31  * @see SimpleEvent
32  */
33 public class SimpleMsg extends SimpleEvent {
34         
35         /**
36         * The sender of the message.
37         */
38         protected Node sender;
39         
40         public SimpleMsg(){
41         }
42         
43         /**
44          * Initializes the simple message with its type and sender.
45          * @param type The identifier of the type of the message
46          * @param sender The sender of the message
47          */
48         public SimpleMsg(int type, Node sender){
49                 super.type = type;
50                 this.sender = sender;
51         }
52         
53         /**
54      * Gets the sender of the message.
55          * @return The sender of the message.
56          */
57         public Node getSender(){
58                 return this.sender;     
59         }
60 }