changeset 71:eda73e0a0388

generic
author kent
date Thu, 08 Nov 2007 15:14:36 +0900
parents 9c19d6d61a03
children a77ddf4fc5c9
files src/pathfinder/ChannelSimulator.java
diffstat 1 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/pathfinder/ChannelSimulator.java	Thu Nov 08 15:11:13 2007 +0900
+++ b/src/pathfinder/ChannelSimulator.java	Thu Nov 08 15:14:36 2007 +0900
@@ -5,34 +5,33 @@
 
 public class ChannelSimulator<P> {
 	public NetworkSimulator<P> ns;
-	public Queue<P>[] q;
+	public Queue<P> q0;
+	public Queue<P> q1;
 /*
 	public ChannelSimulator(NetworkSimulator<P> ns){
-		q = new Queue<P>[2];
-		q[0] = new LinkedList<P>(); 
-		q[1] = new LinkedList<P>(); 
+		q0 = new LinkedList<P>(); 
+		q1 = new LinkedList<P>(); 
 		this.ns = ns;
 	}
 */
 	public ChannelSimulator(NetworkSimulator<P> _ns){
 		this(new LinkedList<P>(), new LinkedList<P>(), _ns);
 	}
-	public ChannelSimulator(Queue<P> _a, Queue<P> _b, NetworkSimulator<P> ns){
-		q = new Queue[2];
-		q[0] = _a;
-		q[1] = _b;
-		this.ns = ns;
+	public ChannelSimulator(Queue<P> _a, Queue<P> _b, NetworkSimulator<P> _ns){
+		q0 = _a;
+		q1 = _b;
+		ns = _ns;
 	}
 
 	public P read(){
-		return ns.read(q[0]);
+		return ns.read(q0);
 	}
 
 	public boolean write(P p){
-		return ns.write(q[1],p);
+		return ns.write(q1,p);
 	}
 
 	public ChannelSimulator<P> getServerChannel() {
-		return new ChannelSimulator<P>(q[1], q[0],ns);
+		return new ChannelSimulator<P>(q1, q0,ns);
 	}
 }