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

📄 olddestinationset.java

📁 发布/订阅系统路由重配算法,可应用于ad hoc环境
💻 JAVA
字号:
///*// * Created on May 4, 2005// *// * To change the template for this generated file go to// * Window>Preferences>Java>Code Generation>Code and Comments// *///package broker;////import java.util.*;///**// * @author parzy// *// * To change the template for this generated type comment go to// * Window>Preferences>Java>Code Generation>Code and Comments// *///public class OldDestinationSet {////	public static class Entry{////		public Broker broker;//		public Object message;////		private Entry(Map.Entry entry){//			this.broker = (Broker)entry.getKey();//			this.message = entry.getValue();//		}//		//		public Broker getBroker(){//			return broker;//		}//		public Object getMessage(){//			return message;//		}//	}//	//	private class SetIterator implements Iterator{//		Iterator iterator;//		//		private SetIterator(){//			iterator = OldDestinationSet.this.destinations.entrySet().iterator();//		}//		//		public boolean hasNext(){//			return iterator.hasNext();//		}//		//		public Object next(){//			return new OldDestinationSet.Entry((Map.Entry)iterator.next());//		}//		//		public void remove(){//			iterator.remove();//		}//	}//	//	protected final int SUBSCRIPTION = 1;//	protected final int UNSUBSCRIPTION = 2;//	protected final int NOTIFICATION = 3;//	protected final int BROADCAST = 4;//	protected final int REQUEST = 5;//	//	protected Broker local = null;//	protected Broker from = null;//	protected Hashtable destinations = new Hashtable();//	protected Object message = null;//	protected int type = 0;//	protected boolean fixed = false;//	//	public OldDestinationSet(){}//	//	public OldDestinationSet(Broker local, Broker from, Subscription s){//		this.local = local;//		this.from = from;//		this.message = s;//		this.type = SUBSCRIPTION;//		this.fixed = true;//	}//	//	public OldDestinationSet(Broker local, Broker from, Unsubscription u){//		this.local = local;//		this.from = from;//		this.message = u;//		this.type = UNSUBSCRIPTION;//		this.fixed = true;//	}//	//	public OldDestinationSet(Broker local, Broker from, Notification n){//		Broker neighbor;//		//		this.local = local;//		this.from = from;//		this.message = n;//		this.type = NOTIFICATION;////		for(Iterator it = local.getNeighbors().iterator(); it.hasNext(); ){//			neighbor = (Broker) it.next();//			if (!neighbor.equals(from)) {//				destinations.put(neighbor, message);//			}//		}//	}//	//	//	public OldDestinationSet(Broker local, Broker from, Broadcast b){//		Broker neighbor;//		//		//this.local = local;//		//this.from = from;//		//this.message = b;//		this.type = BROADCAST;//		this.fixed = true;//		//		if (b.getTTL()>0) {//			for (Iterator it = local.getNeighbors().iterator(); it.hasNext(); ){//				neighbor = (Broker) it.next();//				if (!neighbor.equals(from)) {//					destinations.put(neighbor, b);//				}//			}//		}//	}//	//	public OldDestinationSet(Broker local, Broker from, Request r){//		this.local = local;//		this.from = from;//		this.message = r;//		this.type = REQUEST;//	}//	//	//	public Iterator iterator(){//		return new SetIterator();//	}//	//	public void includeLocal(){//		if(type != NOTIFICATION){//			throw new IllegalStateException();//		}//		//		if(fixed){//			return;//		}////		destinations.put(local, message);//		fixed = true;//	}////	public int size(){//		return destinations.size();//	}//	//	public boolean isFixed(){//		return fixed;//	}//	//	public boolean containsBroker(Broker b){//		return destinations.containsKey(b);//	}//	//	public void add(Broker b){//		//	}//}

⌨️ 快捷键说明

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