|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Linkable
Instances of classes implementing this interface can form networks (graphs)
in the simulator framework.
The interface is similar to one of a container (containing neighbors),
only the types of the contained elements have to be Node
.
The neighbor collection is defined in a random access list style, but
it must follow the contract of a set too (elements must be unique).
Also note that there is no possibility to remove elements from the neighbor set. This is because removal is usually costly and it does not make sense in the context of our applications, where this interface is used for 1) initialization and 2) providing an interface for other protocols for accessing the neighbor list. Protocols that manage links remove, refresh, etc their link set internally or through custom methods. Therefore it would only put an unnecessary burden on implementors.
Method Summary | |
---|---|
boolean |
addNeighbor(Node neighbour)
Add a neighbor to the current set of neighbors. |
boolean |
contains(Node neighbor)
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 |
pack()
A possibility for optimization. |
Methods inherited from interface peersim.core.Cleanable |
---|
onKill |
Method Detail |
---|
int degree()
Node getNeighbor(int i)
degree()
.
boolean addNeighbor(Node neighbour)
boolean contains(Node neighbor)
void pack()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |