|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectFairness.Nodes.NodeBehaviors.AncestorRatingBehavior
public class AncestorRatingBehavior
AncestorRatingBehavior keeps track of confidence values and increases/decreases the confidence levels of nodes for sending and receiving the packets respectively. When a packet is received, the child increases the confidence of all the nodes in the path to the root and similarly decreases if the packet is denied.
Constructor Summary | |
---|---|
AncestorRatingBehavior()
|
Method Summary | |
---|---|
boolean |
allowChild(Node myNode,
Node candidateChild)
Asks the node behavior if the given Node is allowed to be a child of the Node this behavior is for. |
boolean |
allowForward(Node myNode,
Node target)
Returns true if this node behavior is currently allowing the Node to send to the given target. |
java.lang.Double |
getConfidence(Node n)
Returns this behavior's confidence of the given Node, or null if there is no opinion. |
java.lang.Double |
getDebtLevel(Node n)
Returns this behavior's debt level measurement of the given Node, or null if there is no opinion. |
boolean |
hasConfidenceInformation()
Returns true if this behavior has confidence information on any Node |
boolean |
hasDebtLevelInformation()
Returns true if this behavior has debt levels for any Node |
void |
receivedPacket(Node myNode,
NodePacket packet)
Event to the node behavior for when a packet is received by the Node. |
void |
sentPacket(Node myNode,
Node destination,
NodePacket packet)
Event called when a Node sends a packet to a child. |
void |
setParameter(java.lang.String param)
Allows setting of a single behavior-specific parameter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AncestorRatingBehavior()
Method Detail |
---|
public void setParameter(java.lang.String param)
setParameter
in interface NodeBehavior
param
- non-null Stringpublic boolean allowChild(Node myNode, Node candidateChild)
allowChild
in interface NodeBehavior
myNode
- non-null Node to which this behavior belongs.candidateChild
- non-null Node that is not equal to myNode.
public boolean allowForward(Node myNode, Node target)
allowForward
in interface NodeBehavior
myNode
- non-null Node to which this behavior belongs.target
- non-null Node that is not equal to myNode.public void receivedPacket(Node myNode, NodePacket packet)
receivedPacket
in interface NodeBehavior
myNode
- non-null Node to which this behavior belongs.packet
- non-null NodePacket destined for this behavior's Node.public void sentPacket(Node myNode, Node destination, NodePacket packet)
sentPacket
in interface NodeBehavior
myNode
- non-null Node to which this behavior belongs.destination
- non-null Node where the packet is going.packet
- non-null NodePacket destined for this behavior's Node.public boolean hasConfidenceInformation()
hasConfidenceInformation
in interface NodeBehavior
public boolean hasDebtLevelInformation()
hasDebtLevelInformation
in interface NodeBehavior
public java.lang.Double getConfidence(Node n)
getConfidence
in interface NodeBehavior
n
- non-null Node to get information about
public java.lang.Double getDebtLevel(Node n)
getDebtLevel
in interface NodeBehavior
n
- non-null Node to get information about
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |