planet.generic.commonapi.behaviours
Class BehavioursRoleSelectorImpl

java.lang.Object
  extended byplanet.generic.commonapi.behaviours.BehavioursRoleSelectorImpl
All Implemented Interfaces:
BehavioursRoleSelector, java.io.Serializable

public class BehavioursRoleSelectorImpl
extends java.lang.Object
implements BehavioursRoleSelector

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

  1. BEHAVIOURS_PROPERTIES_FAULTY_NODES: percentatge of faulty nodes within the network.
  2. BEHAVIOURS_PROPERTIES_MALICIOUS_DISTRIBUTION: type of distribution of the faulty nodes:
    1. BehaviourPropertiesImpl.BEHAVIOUR_UNIFORM_MALICIOUS_DISTRIBUTION_MASK: faulty nodes distributed uniformly along the network.
    2. BehaviourPropertiesImpl.BEHAVIOUR_CHAIN_MALICIOUS_DISTRIBUTION_MASK: faulty nodes forming a continous chain of faulty nodes.

Author:
Marc Sánchez *
See Also:
Serialized Form

Constructor Summary
BehavioursRoleSelectorImpl()
           
 
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

BehavioursRoleSelectorImpl

public BehavioursRoleSelectorImpl()
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 BehavioursRoleSelector
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.