planet.behaviour
Class BehaviourRoleSelectorImpl

java.lang.Object
  extended by planet.behaviour.BehaviourRoleSelectorImpl
All Implemented Interfaces:
BehaviourRoleSelector

public class BehaviourRoleSelectorImpl
extends java.lang.Object
implements BehaviourRoleSelector

BehaviourRoleSelectorImpl provides a default implementation for BehaviourRoleSelector interface The node's role can only be determined on behaviour's context. It uses the following several from behaviour properties file:

  1. ~ DEFAULT_FAULTY_NODES: percentatge of faulty nodes within the network.
  2. ~ DEFAULT_MALICIOUS_DISTRIBUTION: type of distribution of the faulty nodes:
    1. ~ BehaviourProperties.UNIFORM: faulty nodes distributed uniformaly along the network.
    2. ~ BehaviourProperties.CHAIN: faulty nodes forming a continous chain of faulty nodes.

Author:
Marc Sánchez *

Constructor Summary
BehaviourRoleSelectorImpl()
           
 
Method Summary
 java.util.Set select(java.util.Iterator network, double percentage, int distribution)
          This methods selects malicious nodes from the overlay according to a percentage and distribution of them along the network.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BehaviourRoleSelectorImpl

public BehaviourRoleSelectorImpl()
Method Detail

select

public java.util.Set select(java.util.Iterator network,
                            double percentage,
                            int distribution)
This methods selects malicious nodes from the overlay according to a percentage and distribution of them along the network.

Specified by:
select in interface BehaviourRoleSelector
Parameters:
network - Iterator of all ids.
percentage - Percentage of faulty nodes.
distribution - Distribution's type of faulty nodes: chain or uniform.
Returns:
Returns a set with Ids of malicious nodes.
Throws:
java.lang.ClassCastException - if network is not a collection of id's objects.