Query Cycle Simulator HEADER

qcsim.impl
Class InitializationManagerImpl

java.lang.Object
  |
  +--qcsim.impl.InitializationManagerImpl
All Implemented Interfaces:
InitializationManager

public class InitializationManagerImpl
extends java.lang.Object
implements InitializationManager

Creates and initializes system components.

Version:
1.0
Author:
unascribed

Constructor Summary
InitializationManagerImpl(QueryCycleManager manager)
          Constructor
 
Method Summary
 void content(int categories, int minCategories, int distribution)
          This is used to establish the desired content parameters.
 void errorFraction(double error, int type)
          This will setup the upload error fraction for a given type of peer.
 void establishCollective(java.util.Vector peers, int collective, int type)
          This method is used to establish malicious collectives.
 void goodPeerResponseSelector(int selector)
          This method will setup the method of choosing which responses each good peer chooses to download.
 void highTrustPeerCategoryPref(int pref)
          This method will setup highly trusted peers to have extra category preference.
 void maliciousPeerCategoryPref(int pref)
          This method will setup malicious peers to have extra category preference.
 PeerManager peerManager()
          This module is responsible for initializing the peer manager.
 void peers(int gp, int gpn, int mp, int mpn, int htp, int htpn)
          This function will setup the number of desired peers in the system.
 void setPeerActivity(java.util.Vector peers, int activity)
          This will setup the peer's activity during the simulation.
 Simulator simulator()
          This module is responsible for initializing the simulator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InitializationManagerImpl

public InitializationManagerImpl(QueryCycleManager manager)
Constructor

Method Detail

peers

public void peers(int gp,
                  int gpn,
                  int mp,
                  int mpn,
                  int htp,
                  int htpn)
This function will setup the number of desired peers in the system.

Specified by:
peers in interface InitializationManager
Parameters:
gp - The number of good peers.
gpn - The number of neighbors each good peer should have.
mp - The number of malicious peers.
mpn - The number of neighbors each malicious peer should have.
htp - The number of highly trusted peers.
htpn - The number of neighbors each highly trusted peers should have.

content

public void content(int categories,
                    int minCategories,
                    int distribution)
This is used to establish the desired content parameters.

Specified by:
content in interface InitializationManager
Parameters:
categories - The total number of categories in the system.
minCategories - Each peer will maintain at least this number of categories.
distribution - Specifies how files are distributed among peers.

maliciousPeerCategoryPref

public void maliciousPeerCategoryPref(int pref)
This method will setup malicious peers to have extra category preference. For example if you call this with argument Content.TOP_CATEGORY, then each malicious peer will choose from the top 1/3 most popular categories during content initialization.

Specified by:
maliciousPeerCategoryPref in interface InitializationManager
Parameters:
pref - The type of preference

highTrustPeerCategoryPref

public void highTrustPeerCategoryPref(int pref)
This method will setup highly trusted peers to have extra category preference. For example if you call this with argument PeerContentManager.TOP_CATEGORY, then each highly trusted peer will choose from the top 1/3 most popular categories during content initialization.

Specified by:
highTrustPeerCategoryPref in interface InitializationManager
Parameters:
pref - The type of preference

goodPeerResponseSelector

public void goodPeerResponseSelector(int selector)
This method will setup the method of choosing which responses each good peer chooses to download. For example A peer will send a query for a particular file and receive a number of responses. Setting this method to PeerBehavior.RPB_RANDOM will cause the peer to choose responses in random order.

Specified by:
goodPeerResponseSelector in interface InitializationManager
Parameters:
selector - response selector (see PeerBehavior.RPB_*).

errorFraction

public void errorFraction(double error,
                          int type)
This will setup the upload error fraction for a given type of peer.

Specified by:
errorFraction in interface InitializationManager
Parameters:
error - The fraction of time a peer makes a mistake.
type - The type of peer that has this error fraction.

setPeerActivity

public void setPeerActivity(java.util.Vector peers,
                            int activity)
This will setup the peer's activity during the simulation. See PeerBehavior.ACTIVITY_* for more information.

Specified by:
setPeerActivity in interface InitializationManager
Parameters:
peers - A vector of peers to initialize.
activity - The activity model the peers will follow.

establishCollective

public void establishCollective(java.util.Vector peers,
                                int collective,
                                int type)
This method is used to establish malicious collectives. The vector of peers should be only malicious peers. Passing in good or highly trusted peers will be ignored.

Specified by:
establishCollective in interface InitializationManager
Parameters:
peers - The peers that will be apart of the collective.
collective - The colletive type.
type - The type of configuration.

peerManager

public PeerManager peerManager()
This module is responsible for initializing the peer manager. Once the proper parameters (following a call to peers(..)) have been set you can call this method to get the peer manager.

Specified by:
peerManager in interface InitializationManager
Returns:
The peer manager (or null if not yet ready).

simulator

public Simulator simulator()
This module is responsible for initializing the simulator. Calling this method will provide that simulator.

Specified by:
simulator in interface InitializationManager
Returns:
The system simulator.

Query Cycle Simulator HEADER