changeset 130:fc15d8fd1326

*** empty log message ***
author kent
date Wed, 27 Aug 2008 18:17:12 +0900
parents 63a473db5cbf
children 617a47cb0150
files rep/SessionList.java
diffstat 1 files changed, 15 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/rep/SessionList.java	Wed Aug 27 18:16:59 2008 +0900
+++ b/rep/SessionList.java	Wed Aug 27 18:17:12 2008 +0900
@@ -2,6 +2,8 @@
 
 import java.nio.channels.SocketChannel;
 import java.util.LinkedList;
+
+import rep.channel.REPSocketChannel;
 import rep.xml.SessionXMLEncoder;
 
 public class SessionList {
@@ -12,7 +14,6 @@
 	private int sessionID = 0;
 	private int editorCount = 0;
 
-	private SocketChannel smchannel;
 	private boolean channelequals = false;
 	private LinkedList<Session> tmpSessionList = new LinkedList<Session>();
 	private String maxHost;
@@ -24,7 +25,7 @@
 		makeDefaultSession();
 	}
 	
-	public void add(SocketChannel channel) {
+	public void add(REPSocketChannel<REPCommand> channel) {
 		
 	}
 	
@@ -38,11 +39,11 @@
 		
 	}
 
-	public void add(SocketChannel channel, int sid) {
+	public void add(REPSocketChannel<REPCommand> channel, int sid) {
 		
 	}
 
-	public int addSession(SocketChannel channel, String string) {
+	public int addSession(REPSocketChannel<REPCommand> channel, String string) {
 		sessionID++;
 //		session3.put(sessionID, new Session(sessionID, string, channel));
 		sessionLinkedList.add(new Session(sessionID, string, channel));
@@ -50,7 +51,7 @@
 		
 	}
 
-	public void addEditor(SocketChannel channel, int sid, REPCommand repCmd) {
+	public void addEditor(REPSocketChannel<REPCommand> channel, int sid, REPCommand repCmd) {
 		int editorID = repCmd.eid;
 //		if(session3.get(sid) == null) System.out.println("ぬるぽ!");
 //		session3.get(sid).addEditor(editorID, channel);
@@ -65,12 +66,12 @@
 		editorCount++;
 		return editorCount;
 	}
-	
-	public void sendCmd(SocketChannel channel2, REPCommand repCmd) {
+
+	public void sendCmd(REPSocketChannel<REPCommand> channel2, REPCommand repCmd) {
 //		LinkedList <Editor> editorList = session3.get(repCmd.sid).getEditorList();
 		LinkedList <Editor> editorList = sessionLinkedList.get(repCmd.sid).getEditorList();	//ここもforループで検索しないといけないよ。
 		for(Editor editor : editorList){
-			SocketChannel channel = editor.getChannel();
+			REPSocketChannel<REPCommand> channel = editor.getChannel();
 			if(channel.equals(channel2)) {
 				System.out.println("equals");
 				continue;
@@ -80,12 +81,12 @@
 		}
 	}
 	
-	public void sendCmd(SocketChannel channel, REPCommand repCmd, boolean ring){
+	public void sendCmd(REPSocketChannel<REPCommand> channel, REPCommand repCmd, boolean ring){
 //		LinkedList <Editor> editorList = session3.get(repCmd.sid).getEditorList();
 		LinkedList <Editor> editorList = sessionLinkedList.get(repCmd.sid).getEditorList();	//ここもforループで検索しないといけないよ。
 		REPPacketSend repsend = null;
 		for(Editor editor : editorList){
-			SocketChannel channel2 = editor.getChannel();
+			REPSocketChannel<REPCommand> channel2 = editor.getChannel();
 			if(channel.equals(channel2)){
 				System.out.println("equals");
 				channelequals = true;
@@ -97,7 +98,6 @@
 	}
 
 	public void addSessionManager(SocketChannel channel, REPCommand repCmd) {
-		smchannel = channel;
 		
 	}
 
@@ -118,7 +118,7 @@
 		return "{}";
 	}
 
-	public void sendToNextEditor(SocketChannel channel, REPCommand repCmd) {
+	public void sendToNextEditor(REPSocketChannel<REPCommand> channel, REPCommand repCmd) {
 		Editor editor2 = null;
 		Editor editor3;
 //		LinkedList <Editor> editorList = session3.get(repCmd.sid).getEditorList();
@@ -169,14 +169,14 @@
 		return kindOfCmd;
 	}
 
-	public void addEditor(SocketChannel editorChannel, int sid, int eid) {
+	public void addEditor(REPSocketChannel<REPCommand> editorChannel, int sid, int eid) {
 //		session3.get(sid).addEditor(eid, editorChannel);
 		sessionLinkedList.get(sid-1).addEditor(eid, editorChannel);
 	}
 
 	public void sendSelect(int sid) {
 //		SocketChannel channel = session3.get(sid).getMaster().getChannel();
-		SocketChannel channel = sessionLinkedList.get(sid-1).getMaster().getChannel();
+		REPSocketChannel<REPCommand> channel = sessionLinkedList.get(sid-1).getMaster().getChannel();
 		REPPacketSend send = new REPPacketSend(channel);
 		send.send(new REPCommand(REP.SMCMD_SELECT, sid, 0, 0, 0, 0, ""));
 	}
@@ -297,7 +297,7 @@
 		sessionLinkedList = list;
 	}
 
-	public void update(SocketChannel channel, SessionList receivedSessionList) {
+	public void update(REPSocketChannel<REPCommand> channel, SessionList receivedSessionList) {
 		LinkedList<Session> list = receivedSessionList.getList();
 		int i = 0;
 		for(Session session : list){