Академический Документы
Профессиональный Документы
Культура Документы
/**
* iterated over.
* @config
*/
/**
*/
super(prefix);
pids[i] = Configuration.lookupPid(protnames[i]);
}
// =============== methods =============================================
/**
*/
if( getpair_rand )
node = Network.get(CDState.r.nextInt(Network.size()));
node = Network.get(rperm.next());
else
node = Network.get(j);
CDState.setNode(node);
CDState.setCycleT(j);
// associated scheduler.
if (!protSchedules[pid].active(cycle))
continue;
CDState.setPid(pid);
((CDProtocol)protocol).nextCycle(node, pid);
return false;
try
loadSystemResource(resource);
+resource+" loaded.");
catch( Exception e )
{
System.err.println("ConfigProperties: " + e );
try
load( pars[i] );
System.err.println(
pars[i] = "";
catch( IOException e )
try
loadPropertyString( pars[i] );
catch( Exception e2 )
System.err.println("ConfigProperties: " + e2 );
}
}
catch( Exception e )
System.err.println("ConfigProperties: " + e );
/**
* {@link #load}.
*/
load( fileName );
/**
*/
super( props );
/**
*/
/**
*/
load( fis );
fis.close();
/**
* Adds the properties from the given property file. Searches in the class path
*/
ClassLoader cl = getClass().getClassLoader();
load( cl.getResourceAsStream( n ) );
/**
*/
/**
* @config
*/
/**
* IndexOutOfBoundsException.
*/
/**
/**
* Sets the index of this node in the internal representation of the node list.
*/
/**
* change during a simulation, it is not a fixed id. If you need that, use
* {@link #getID}.
* @see Network#get
*/
/**
* during the entire simulation, that is, there will be no different Node
* objects with the same ID in the system during one invocation of the JVM.
* Preferably nodes
*/
public long getID();
/**
* <code>throws</code> clause.
*/
maxsize=Configuration.getInt(prefix+"."+PAR_MAX,Integer.MAX_VALUE);
}
// Methods
// ---------------------------------------------------------------------
/**
* Fills a {@link SearchProtocol} with the keywords representing the
/**
* Fills a {@link SearchProtocol} with the queries it will initiate.
* @param proto
* the protocol to initialize
*/
System.err
.println("Warn: the TTL probably too large for maxCycles...");
break;
}
break;
}
proto.addQueryData(cycle, query);
}
}
/**
continue;
}
return keys;
}
continue;
keys.add(Integer.valueOf(key));
}
}
return result;
}
initializeData(proto);
if (i < query_nodes)
initializeQueries(proto);
}
return false;
/**
* Extracts random values according to a power distribution.
*
* @param base
* base
* @param a
* scaling exponent
* @return
*/
return -1 * b * Math.log(CommonState.r.nextDouble());
}
public SearchObserver(String name) {
this.name = name;
continue;
+ stats.toString());
// System.out.println(stats);
}
}
this.nbHits = 0;
this.nbMessages = 0;
// this.nbExtraProbes = 0;
this.seq = seq;
this.age = age;
this.ttl = ttl;
}
// Methods
public void update(int msgs, int hits) {
++nbSeen;
nbHits += hits;
nbMessages += msgs;
}
}
public int getAge() {
return age;
}
this.age = age;
}
}
public void setTtl(int ttl) {
this.ttl = ttl;
}
public int getNbSeen() {
return nbSeen;
}
}
this.type = type;
this.hops = hops;
this.payload = payload;
this.seq = ++seq_generator;
this.start = CDState.getCycle();
}
public Object clone() throws CloneNotSupportedException {
}
// Methods
public int hashCode() {
return seq;
}
}
/** Creates a new instance of RWProtocol */
public RWProtocol(String prefix) {
super(prefix);
if (match)
this.notifyOriginator(mes);
this.forward(neighbor, mes);
if (data != null) {
System.err.println("DATA");
// For ttl <=3 we use flooding and for ttl >3 we use K-Walker Random Walk where K is
prespecified walker number.
if (ttl <=3)
{
for (int i = 0; i <= this.degree(); i++)
{
this.send((Node) this.getNeighbor(i), m);
}
}
else
{
for (int i = 0; i < this.walkers; i++)
{
this.send((Node) this.getNeighbor(i), m);
}
}
}
}
# PEERSIM EXAMPLE iSEARCH
random.seed 1234567890
simulation.cycles 100
control.0 peersim.cdsim.Shuffle
network.size 10000
#network.maxsize 1000
include.protocol Hybrid_Search
protocol.topo peersim.core.IdleProtocol
protocol.topo.capacity 10
protocol.Hybrid_Search peersim.extras.gj.isearch.RWProtocol
#protocol.Hybrid_Search.linkable topo
protocol.Hybrid_Search.ttl 20
init.0 peersim.dynamics.WireKOut
#init.0.protocol topo
init.0.protocol Hybrid_Search
init.0.k 20
init.1 peersim.extras.gj.isearch.SearchDataInitializer
init.1.protocol Hybrid_Search
init.1.keywords 1000
init.1.query_nodes 1
init.1.query_interval 1
init.1.max_queries 1
control.0 peersim.extras.gj.isearch.SearchObserver
control.0.protocol Hybrid_Search
control.0.verbosity 1
control.1 peersim.reports.DegreeStats
control.1.protocol Hybrid_Search
control.1.method list