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.peer;
21
22 /***
23 * This class provides the default implementation for a peer.
24 */
25 public abstract class AbstractPeer implements Peer
26 {
27
28 //--- Data field(s) ---
29
30 private String clientInfo;
31 private int fileCount = -1;
32 private int linkSpeed = -1;
33 private String name;
34
35 //--- Constructor(s) ---
36
37 public AbstractPeer(String name)
38 {
39 this.name = name;
40 }
41
42 //--- Method(s) ---
43
44 public String getClientInfo()
45 {
46 return clientInfo;
47 }
48
49 public int getFileCount()
50 {
51 return fileCount;
52 }
53
54 public int getLinkSpeed()
55 {
56 return linkSpeed;
57 }
58
59 public String getName()
60 {
61 return name;
62 }
63
64 public void setClientInfo(String newValue)
65 {
66 clientInfo = newValue;
67 }
68
69 public void setFileCount(int newValue)
70 {
71 fileCount = newValue;
72 }
73
74 public void setLinkSpeed(int newValue)
75 {
76 linkSpeed = newValue;
77 }
78
79 public void setName(String name)
80 {
81 this.name = name;
82 }
83
84 /***
85 * Returns the value of {@link #getName() getName()}.
86 */
87 public String toString()
88 {
89 return getName();
90 }
91
92 }