?? peerinfobundle.java
字號:
/* * Created by IntelliJ IDEA. * User: fsommers * Date: Apr 28, 2002 * Time: 5:43:50 PM * To change template for new class use * Code Style | Class Templates options (Tools | IDE Options). */package primecruncher;import net.jxta.protocol.ModuleSpecAdvertisement;import net.jxta.protocol.PeerAdvertisement;import net.jxta.protocol.PipeAdvertisement;import net.jxta.peer.PeerID;import net.jxta.pipe.PipeID;import net.jxta.id.ID;/** * Hold information about a discovered peer. Information includes: * peer's advertisment * peer's ModuleSpecAdvertisement * Performance Metics for the peer * * TODO: Implement persistence mechanism */class PeerInfoBundle { private PeerAdvertisement peerAdvertisement = null; private ModuleSpecAdvertisement moduleSpecAdvertisement = null; private PeerMetrics peerMetrics = null; PeerInfoBundle(PeerAdvertisement adv, ModuleSpecAdvertisement mAdv) { this.peerAdvertisement = adv; this.moduleSpecAdvertisement = mAdv; peerMetrics = new PeerMetrics(); } protected PeerAdvertisement getPeerAdvertisement() { return peerAdvertisement; } protected ModuleSpecAdvertisement getModuleSpecAdvertisement() { return moduleSpecAdvertisement; } protected PeerMetrics getPeerMetrics() { return peerMetrics; } /** * Two peer info bundles are equal if, and only if, they contain the same * pipe advertisement inside the module spec advertisement. */ public boolean equals(Object o) { if (o instanceof PeerInfoBundle) { PeerInfoBundle b = (PeerInfoBundle)o; ID bPipd = b.moduleSpecAdvertisement.getPipeAdvertisement().getPipeID(); ID ourID = moduleSpecAdvertisement.getPipeAdvertisement().getPipeID(); return ourID.getUniqueValue().equals(bPipd.getUniqueValue()); } return false; } /** * Return the hashCode() semantics for the pipe ID embedded in the module spec * advertisement. */ public int hashCode() { return moduleSpecAdvertisement.getPipeAdvertisement().getPipeID().getUniqueValue().hashCode(); } class PeerMetrics { }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -