view src/pathfinder/mergetest/NetworkSimulator.java @ 154:6a3c982bd72a

*** empty log message ***
author pin
date Sun, 24 Aug 2008 13:43:50 +0900
parents b56b5950cb18
children
line wrap: on
line source

package pathfinder.mergetest;


public abstract class NetworkSimulator<P> {
	int logLevel;
	
	public abstract ChannelSimulator<P> connect();
	public abstract ChannelSimulator<P> accept();
	public abstract boolean checkAllCS();
	
	public abstract ChannelSimulator<P> getAcceptedSession(int i);
	
	public void writeLog(String log, int level){
		if ( level<=logLevel )
			System.out.println(log);
	}

	public void setLogLevel(int logLevel) {
		this.logLevel = logLevel;
	}
/*
	synchronized public P read(ChannelSimulator<P> cs){
		try {
			return cs.getReadQ().take();
		} catch (InterruptedException e) {
			e.printStackTrace();
			return null;
		}
	}
	synchronized public boolean write(ChannelSimulator<P> cs, P p){
		try {
			cs.getWriteQ().put(p);
			notifyAll();
			return true;
		} catch (InterruptedException e) {
			e.printStackTrace();
			return false;
		}
	}
*/
}