資源簡介
本資源包含一次項目研究的全部資料。詳細分析了PeerSim的用法,并對當前P2P仿真狀況進行了研究,最后,作為示例,作者設計了一個簡單的P2P信任協議并移植到了PeerSim中,以使人們更加了解PeerSim的運行流程。資源中包含的代碼都有詳細的注釋。本資源稍加修改就可作為一次本科畢業設計直接上交
代碼片段和文件信息
/*
?*?Copyright?(c)?2003-2005?The?BISON?Project
?*
?*?This?program?is?free?software;?you?can?redistribute?it?and/or?modify
?*?it?under?the?terms?of?the?GNU?Lesser?General?Public?License?version?2?as
?*?published?by?the?Free?Software?Foundation.
?*
?*?This?program?is?distributed?in?the?hope?that?it?will?be?useful
?*?but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
?*?MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
?*?GNU?Lesser?General?Public?License?for?more?details.
?*
?*?You?should?have?received?a?copy?of?the?GNU?Lesser?General?Public?License
?*?along?with?this?program;?if?not?write?to?the?Free?Software
?*?Foundation?Inc.?675?Mass?Ave?Cambridge?MA?02139?USA.
?*
?*/
package?example.aggregation;
import?peersim.core.*;
import?peersim.config.FastConfig;
import?peersim.vector.SingleValueHolder;
import?peersim.cdsim.CDProtocol;
/**
?*?This?class?provides?an?implementation?for?the?averaging?function?in?the
?*?aggregation?framework.?When?a?pair?of?nodes?interact?their?values?are
?*?averaged.?The?class?subclasses?{@link?SingleValueHolder}?in
?*?order?to?provide?a?consistent?access?to?the?averaging?variable?value.
?*
?*?Note?that?this?class?does?not?override?the?clone?method?because?it?does
?*?not?have?any?state?other?than?what?is?inheritred?from
?*?{@link?SingleValueHolder}.
?*?
?*?@author?Alberto?Montresor
?*?@version?$Revision:?1.10?$
?*/
public?class?AverageFunction?extends?SingleValueHolder?implements?CDProtocol?{
????/**
?????*?Creates?a?new?{@link?example.aggregation.AverageFunction}?protocol
?????*?instance.
?????*?
?????*?@param?prefix
?????*????????????the?component?prefix?declared?in?the?configuration?file.
?????*/
????public?AverageFunction(String?prefix)?{
????????super(prefix);
????}
????/**
?????*?Using?an?underlying?{@link?linkable}?protocol?choses?a?neighbor?and
?????*?performs?a?variance?reduction?step.
?????*?
?????*?@param?node
?????*????????????the?node?on?which?this?component?is?run.
?????*?@param?protocolID
?????*????????????the?id?of?this?protocol?in?the?protocol?array.
?????*/
????public?void?nextCycle(Node?node?int?protocolID)?{
????????int?linkableID?=?FastConfig.getlinkable(protocolID);
????????linkable?linkable?=?(linkable)?node.getProtocol(linkableID);
????????if?(linkable.degree()?>?0)?{
????????????Node?peer?=?linkable.getNeighbor(CommonState.r.nextInt(linkable
????????????????????.degree()));
????????????//?Failure?handling
????????????if?(!peer.isUp())
????????????????return;
????????????AverageFunction?neighbor?=?(AverageFunction)?peer
????????????????????.getProtocol(protocolID);
????????????double?mean?=?(this.value?+?neighbor.value)?/?2;
????????????this.value?=?mean;
????????????neighbor.value?=?mean;
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???10387008??2010-08-19?22:15??P2P仿真\P2P仿真.chm
?????文件?????547840??2010-09-10?10:26??P2P仿真\P2P仿真實習報告?.doc
?????文件?????741376??2010-08-20?11:02??P2P仿真\P2P仿真實習報告.ppt
????..A.SH.??????5120??2010-08-06?11:31??P2P仿真\P2P仿真調研報告\Thumbs.db
????..A..H.???????162??2010-08-16?09:59??P2P仿真\P2P仿真調研報告\~$-P2P仿真調研報告.doc
?????文件?????581632??2010-09-10?10:29??P2P仿真\P2P仿真調研報告\P2P仿真調研報告.doc
?????文件?????968192??2010-09-10?10:31??P2P仿真\P2P仿真調研報告\P2P仿真調研報告.ppt
?????文件????????389??2010-08-05?17:18??P2P仿真\代碼\TrustModelSimulation\.classpath
?????文件????????396??2008-03-13?21:52??P2P仿真\代碼\TrustModelSimulation\.project
?????文件?????136404??2007-12-24?06:47??P2P仿真\代碼\TrustModelSimulation\djep-1.0.0.jar
?????文件??????75818??2007-12-24?06:47??P2P仿真\代碼\TrustModelSimulation\jep-2.3.0.jar
?????文件??????17483??2005-09-01?20:58??P2P仿真\代碼\TrustModelSimulation\slacer.jar
?????文件??????41811??2010-08-19?20:01??P2P仿真\代碼\TrustModelSimulation\data\TrustMonitor.dat
?????文件?????????13??2010-08-19?20:01??P2P仿真\代碼\TrustModelSimulation\data\BadPeerNumCount.dat
?????文件??????43690??2010-08-19?20:01??P2P仿真\代碼\TrustModelSimulation\data\MaliceAttackCount.dat
?????文件???????4790??2010-08-19?20:01??P2P仿真\代碼\TrustModelSimulation\data\BadPeerTrustValue.dat
?????文件??????37021??2010-08-19?20:01??P2P仿真\代碼\TrustModelSimulation\data\GoodPeerTrustValue.dat
?????文件????????685??2010-08-19?20:01??P2P仿真\代碼\TrustModelSimulation\data\AverageTrustValuePerCycle.dat
?????文件????????685??2010-08-19?20:01??P2P仿真\代碼\TrustModelSimulation\data\GoodPeerAverageTrustValuePerCycle.dat
?????文件????????658??2010-08-19?20:01??P2P仿真\代碼\TrustModelSimulation\data\BadPeerAverageTrustValuePerCycle.dat
?????文件??????80218??2010-08-19?20:01??P2P仿真\代碼\TrustModelSimulation\data\PeerSuccessfulDownloadPercentage.dat
?????文件????????432??2010-08-19?19:52??P2P仿真\代碼\TrustModelSimulation\config\slacer-conf1.cfg
?????文件???????2743??2008-03-13?21:52??P2P仿真\代碼\TrustModelSimulation\example\aggregation\AverageFunction.java
?????文件???????3851??2008-03-13?21:52??P2P仿真\代碼\TrustModelSimulation\example\aggregation\AverageObserver.java
?????文件???????3155??2008-03-13?21:52??P2P仿真\代碼\TrustModelSimulation\example\aggregation\PeakDistributionInitializer.java
?????文件???????1512??2010-08-19?19:29??P2P仿真\代碼\TrustModelSimulation\example\aggregation\PeakDistributionInitializer.class
?????文件???????1998??2010-08-19?19:29??P2P仿真\代碼\TrustModelSimulation\example\aggregation\AverageObserver.class
?????文件???????1324??2010-08-19?19:29??P2P仿真\代碼\TrustModelSimulation\example\aggregation\AverageFunction.class
?????文件???????3309??2008-03-13?21:52??P2P仿真\代碼\TrustModelSimulation\example\edaggregation\AverageED.java
?????文件????????453??2010-08-19?19:29??P2P仿真\代碼\TrustModelSimulation\example\edaggregation\AverageMessage.class
............此處省略304個文件信息
- 上一篇:天地偉業 2011校招 計算機 筆試題
- 下一篇:itext5.5.11
評論
共有 條評論