⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 replicasetmessage.java

📁 p2p仿真器。开发者可以工作在覆盖层中进行创造和测试逻辑算法或者创建和测试新的服务。PlanetSim还可以将仿真代码平稳转换为在Internet上的实验代码
💻 JAVA
字号:
package planet.scribe.messaging;
import java.util.Vector;
import planet.commonapi.Id;
/**
 * Message of data to be send a request of the replica set of an another node
 * 
 * @author Ruben Mondejar
 * @author <a href="mailto: jordi.pujol@estudiants.urv.es">Jordi Pujol </a>
 *         Date: 02/07/2004
 */
public class ReplicaSetMessage implements planet.commonapi.Message {
	private Id messageKey = null;
	private Id sourceId = null;
	private boolean request = false;
	private Vector replicaSet = null;
	private int maxRank = 0;
	
	/**
	 * Builds the message to inform the maximum number of replica
	 * set that is required.
	 * @param sourceId Key from which to find the replica set.
	 * @param maxRank Maximum number of the replica set.
	 */
	public ReplicaSetMessage(Id sourceId, int maxRank) {
		this.messageKey = sourceId;
		this.request = true;
		this.maxRank = maxRank;
	}
	
	/**
	 * Builds the message to inform the required replica set.
	 * @param sourceId Key from which to find the replica set.
	 * @param replicaSet Replica set for this key.
	 */
	public ReplicaSetMessage(Id sourceId, Vector replicaSet) {
		this.messageKey = sourceId;
		this.request = false;
		this.replicaSet = replicaSet;
	}
	
	/**
	 * @return Returns the messageKey.
	 */
	public Id getMessageKey() {
		return messageKey;
	}
	
	/**
	 * @param messageKey
	 *            The messageKey to set.
	 */
	public void setMessageKey(Id messageKey) {
		this.messageKey = messageKey;
	}
	
	/**
	 * @return Returns true if is request type.
	 */
	public boolean isRequest() {
		return request;
	}
	
	/**
	 * @param request true if is request type.
	 */
	public void setRequest(boolean request) {
		this.request = request;
	}
	
	/**
	 * @return Returns the replicaSet.
	 */
	public Vector getReplicaSet() {
		return replicaSet;
	}

	/**
	 * @param replicaSet
	 *            Node replica set. 
	 */
	public void setReplicaSet(Vector replicaSet) {
		this.replicaSet = replicaSet;
	}
	
	public String toString() {
		if (request)
			return "ReplicaSetMessage: Key[" + messageKey + "] request";
		else
			return "ReplicaSetMessage: Key[" + messageKey
					+ "] reply with ReplicaSet = " + replicaSet;
	}
	
	/**
	 * @return Returns the maxRank.
	 */
	public int getMaxRank() {
		return maxRank;
	}
	
	/**
	 * @param maxRank
	 *            The maxRank to set.
	 */
	public void setMaxRank(int maxRank) {
		this.maxRank = maxRank;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -