diff rep/channel/SelectionKeySimulator.java @ 143:785a3e8ea858

*** empty log message ***
author kent
date Wed, 27 Aug 2008 22:48:10 +0900
parents 9faacdd6c9cb
children 72252e970a8b
line wrap: on
line diff
--- a/rep/channel/SelectionKeySimulator.java	Wed Aug 27 21:31:21 2008 +0900
+++ b/rep/channel/SelectionKeySimulator.java	Wed Aug 27 22:48:10 2008 +0900
@@ -1,16 +1,17 @@
 package rep.channel;
 
+import java.nio.channels.SelectableChannel;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 
-public class SelectionKeySimulator extends SelectionKey{
+public class SelectionKeySimulator<P> extends SelectionKey{
 	
 	private int interestOpt;
-	private SelectableChannelSimulator channel;
+	private SelectableChannel channel;
 	private int ready;
 	public Selector selector;
 
-	public SelectionKeySimulator(SelectableChannelSimulator cs, int opt, Selector _selector) {
+	public SelectionKeySimulator(SelectableChannel cs, int opt, Selector _selector) {
 		channel = cs;
 		interestOpt = opt;
 		selector = _selector;
@@ -28,26 +29,26 @@
 	}
 
 	public void setFlag() {
+		SelectableChannelSimulator<?> scs = (SelectableChannelSimulator<?>) channel;
 		ready = 0;
-		if(channel.isAcceptable()) ready |= OP_ACCEPT;
-		if(channel.isReadable()) ready |= OP_READ;
-		if(channel.isWritable()) ready |= OP_WRITE;
+		if(scs.isAcceptable()) ready |= OP_ACCEPT;
+		if(scs.isReadable()) ready |= OP_READ;
+		if(scs.isWritable()) ready |= OP_WRITE;
 	}
 
-	public SelectableChannelSimulator channel() {
+	public SelectableChannel channel() {
 		return channel;
 	}
 
 
 	@Override
 	public void cancel() {
-		// TODO Auto-generated method stub
-		
+		System.err.println("cancel is not implemented yet.");
+		//selector.
 	}
 
 	@Override
 	public int interestOps() {
-		// TODO Auto-generated method stub
 		return interestOpt;
 	}
 
@@ -69,7 +70,6 @@
 
 	@Override
 	public Selector selector() {
-		// TODO Auto-generated method stub
 		return selector;
 	}