|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeersim.core.GeneralNode
public class GeneralNode
This is the default Node
class that is used to compose the
Network
.
Parameter Summary |
---|
Parameters inherited from interface peersim.core.Node |
---|
protocol |
Field Summary | |
---|---|
protected int |
failstate
The fail state of the node. |
protected Protocol[] |
protocol
The protocols on this node. |
Fields inherited from interface peersim.core.Fallible |
---|
DEAD, DOWN, OK |
Constructor Summary | |
---|---|
GeneralNode(java.lang.String prefix)
Used to construct the prototype node. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clones the node. |
int |
getFailState()
Returns the state of this object. |
long |
getID()
Returns the ID of this node. |
int |
getIndex()
Returns the index of this node. |
Protocol |
getProtocol(int i)
Returns the i -th protocol in this node. |
int |
hashCode()
Implemented as (int)getID() . |
boolean |
isUp()
Convenience method to check if the node is up and running |
int |
protocolSize()
Returns the number of protocols included in this node. |
void |
setFailState(int failState)
Sets the fails state of this object. |
void |
setIndex(int index)
Sets the index of this node in the internal representation of the node list. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Protocol[] protocol
protected int failstate
Constructor Detail |
---|
public GeneralNode(java.lang.String prefix)
prefix
is not used. It reads the protocol components
(components that have type "protocol") from
the configuration.
Method Detail |
---|
public java.lang.Object clone()
Node
throws
clause.
clone
in interface Node
clone
in class java.lang.Object
public void setFailState(int failState)
Fallible
Fallible
.
setFailState
in interface Fallible
public int getFailState()
Fallible
Fallible
.
getFailState
in interface Fallible
public boolean isUp()
Fallible
isUp
in interface Fallible
getFailState()==OK
public Protocol getProtocol(int i)
Node
i
-th protocol in this node. If i
is not a valid protocol id
(negative or larger than or equal to the number of protocols), then it throws
IndexOutOfBoundsException.
getProtocol
in interface Node
public int protocolSize()
Node
protocolSize
in interface Node
public int getIndex()
Node
Network.get(n.getIndex())
returns n. This index can
change during a simulation, it is not a fixed id. If you need that, use
Node.getID()
.
getIndex
in interface Node
Network.get(int)
public void setIndex(int index)
Node
setIndex
in interface Node
public long getID()
getID
in interface Node
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
(int)getID()
.
hashCode
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |