|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectpeersim.core.IdleProtocol
public class IdleProtocol
A protocol that stores links. It does nothing apart from that. It is useful to model a static link-structure (topology). The only function of this protocol is to serve as a source of neighborhood information for other protocols.
| Parameter Summary | |
|---|---|
capacity
Initial capacity. |
|
| Field Summary | |
|---|---|
protected int |
len
Actual number of neighbors in the array |
protected Node[] |
neighbors
Neighbors |
| Constructor Summary | |
|---|---|
IdleProtocol(java.lang.String s)
|
|
| Method Summary | |
|---|---|
boolean |
addNeighbor(Node n)
Adds given node if it is not already in the network. |
java.lang.Object |
clone()
Returns a clone of the protocol. |
boolean |
contains(Node n)
Returns true if the given node is a member of the neighbor set. |
int |
degree()
Returns the size of the neighbor list. |
Node |
getNeighbor(int i)
Returns the neighbor with the given index. |
void |
onKill()
Performs cleanup when removed from the network. |
void |
pack()
A possibility for optimization. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Parameter Detail |
|---|
capacity
| Field Detail |
|---|
protected Node[] neighbors
protected int len
| Constructor Detail |
|---|
public IdleProtocol(java.lang.String s)
| Method Detail |
|---|
public java.lang.Object clone()
ProtocolControls.
clone in interface Protocolclone in class java.lang.Objectpublic boolean contains(Node n)
Linkable
contains in interface Linkablepublic boolean addNeighbor(Node n)
addNeighbor in interface Linkablepublic Node getNeighbor(int i)
LinkableLinkable.degree().
getNeighbor in interface Linkablepublic int degree()
Linkable
degree in interface Linkablepublic void pack()
Linkable
pack in interface Linkablepublic java.lang.String toString()
toString in class java.lang.Objectpublic void onKill()
CleanableFallible.DEAD.
It is very important that after calling this method, NONE of the methods
of the implementing object are guaranteed to work any longer.
They might throw arbitrary exceptions, etc. The idea is that after
calling this, typically no one should access this object.
However, as a recommendation, at least toString should be guaranteed to
execute normally, to aid debugging.
onKill in interface Cleanable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||