?? peer.java
字號:
/*
* @(#)Peer.java ver 1.2 6/20/2005
*
* Copyright 2005 Weishuai Yang (wyang@cs.binghamton.edu).
* All rights reserved.
*
*/
package gps.protocol;
import java.util.HashMap;
/**
* Peer base class, all specific protocol peers inherit from it.
*
*
* @author Weishuai Yang
* @version 1.2, 6/20/2005
*/
public class Peer extends Agent {
public HashMap mDocDBbyKey = new HashMap();
/**
* dummy constructor
*
*/
public Peer() {}
/**
* constructs a Peer with peer id
*/
public Peer(int i) {
super(i);
}
/**
* resets status of the peer
*/
public void reset(){
super.reset();
mDocDBbyKey.clear();
mDocDBbyKey = new HashMap();
}
/**
* add a document to this peer, to be overriden
*
* @param doc the Document
*/
public void ownDocument(Document doc){
mDocDBbyKey.put(doc.getKey(),doc);
}
/**
* retrieve a document by key
*
* @param key
* @return Document
*/
public Document getDocument(String key){
return (Document)mDocDBbyKey.get(key);
}
/**
* gets string description
*
* @return string description
*
*/
public String toString(){
return "Peer("+mAgentID+"/"+getNode().getID()+")";
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -