91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 308KB
    文件類(lèi)型: .gz
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-27
  • 語(yǔ)言: 其他
  • 標(biāo)簽: peersim??pastry??

資源簡(jiǎn)介

用peersim實(shí)現(xiàn)的pastry算法,可以在eclipse下運(yùn)行

資源截圖

代碼片段和文件信息

package?peersim.pastry;

import?peersim.core.CommonState;
import?peersim.config.Configuration;
import?peersim.core.Network;
import?java.math.BigInteger;

//______________________________________________________________________________________________
/**
?*?This?control?initializes?the?whole?network?(that?was?already?created?by?peersim)?by?assigning?a
?*?unique?NodeId?randomly?generated?to?every?node?(it?does?nothing?else).
?*?

title:?MSPASTRY


?*
?*?

Description:?MsPastry?implementation?for?PeerSim


?*
?*?

Copyright:?Copyright?(c)?2007


?*
?*?

Company:?The?Pastry?Group


?*
?*?@author?Elisa?Bisoffi?Manuel?Cortella
?*?@version?1.0
?*/
public?class?CustomDistribution?implements?peersim.core.Control?{

????//______________________________________________________________________________________________
????private?static?final?String?PAR_PROT?=?“protocol“;

????private?int?protocolID;
????private?UniformRandomGenerator?urg;


????//______________________________________________________________________________________________
????public?CustomDistribution(String?prefix)?{

????????protocolID?=?Configuration.getPid(prefix?+?“.“?+?PAR_PROT);
????????urg?=?new?UniformRandomGenerator(MSPastryCommonConfig.BITS?CommonState.r);
????}


????//______________________________________________________________________________________________
????/**
?????*?Scan?over?the?nodes?in?the?network?and?assign?a?randomly?generated?NodeId?in?the?space
?????*?0..2^BITS?where?BITS?is?a?parameter?from?the?pastry?protocol?(usually?128)
?????*?@return?boolean?always?false
?????*/
????public?boolean?execute()?{
???????BigInteger?tmp;
???????for?(int?i?=?0;?i????????????tmp?=?urg.generate();
???????????((MSPastryProtocol)(Network.get(i).getProtocol(protocolID))).setNodeId(tmp);
???????}

????????return?false;
????}

????//______________________________________________________________________________________________
}?//?End?of?class

評(píng)論

共有 條評(píng)論