Mercurial > hg > RemoteEditor > Eclipse
view src/pathfinder/SeMaEmulator.java @ 68:735e70091564
EditorSimulator1 in TestNetwork
author | kent |
---|---|
date | Thu, 08 Nov 2007 12:56:56 +0900 |
parents | 2e5bd7bffa4b |
children | 3c9b8371681d |
line wrap: on
line source
package pathfinder; import java.util.ArrayList; import java.util.List; public class SeMaEmulator<P> implements Runnable { private List<ChannelSimulator<P>> csList; public SeMaEmulator(){ csList = new ArrayList<ChannelSimulator<P>>(); } public ChannelSimulator<P> addChannelSimulator(ChannelSimulator<P> cs){ csList.add(cs); return cs; } public void run(){ int i=0; P packet; ChannelSimulator<P> cs = csList.get(1); /* Main Loop */ while(true){ packet=cs.read(); i = (i+1)%csList.size(); cs = csList.get(i+1); if (packet!=null) cs.write(packet); } } }