Mercurial > hg > RemoteEditor > REPSessionManager
changeset 132:70fc1e70652c
*** empty log message ***
author | kent |
---|---|
date | Wed, 27 Aug 2008 18:22:36 +0900 |
parents | 617a47cb0150 |
children | 8dce4348966c |
files | rep/Editor.java rep/EditorList.java rep/REPPacketSend.java rep/SessionList.java |
diffstat | 4 files changed, 15 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/rep/Editor.java Wed Aug 27 18:17:16 2008 +0900 +++ b/rep/Editor.java Wed Aug 27 18:22:36 2008 +0900 @@ -8,8 +8,8 @@ public class Editor { private int eid; - private REPSocketChannel myChannel; - private REPSocketChannel nextChannel; + private REPSocketChannel<REPCommand> myChannel; + private REPSocketChannel<REPCommand> nextChannel; private String host; private String port; //public int getEID; @@ -17,12 +17,12 @@ private LinkedList<REPCommand> undoCommandList = new LinkedList<REPCommand>(); private LinkedList<Integer> temp = new LinkedList<Integer>(); - public Editor(int editorNo, REPSocketChannel channel){ + public Editor(int editorNo, REPSocketChannel<REPCommand> channel){ this.eid = editorNo; this.myChannel = channel; } - public Editor(REPSocketChannel channel) { + public Editor(REPSocketChannel<REPCommand> channel) { this.myChannel = channel; setHostAndPort(myChannel); } @@ -30,7 +30,7 @@ public Editor() { } - private void setHostAndPort(REPSocketChannel myChannel2) { + private void setHostAndPort(REPSocketChannel<REPCommand> myChannel2) { String socketString = myChannel2.socket().getRemoteSocketAddress().toString(); String[] split = socketString.split("/"); int length = split.length; @@ -40,7 +40,8 @@ port = split[1]; } - public REPSocketChannel getChannel() { + public REPSocketChannel<REPCommand> getChannel() { + return myChannel; }
--- a/rep/EditorList.java Wed Aug 27 18:17:16 2008 +0900 +++ b/rep/EditorList.java Wed Aug 27 18:22:36 2008 +0900 @@ -33,13 +33,13 @@ send.send(command); } - public int addEditor(REPSocketChannel channel, REPCommand repCmd) { + public int addEditor(REPSocketChannel<REPCommand> channel, REPCommand repCmd) { numberOfEditor++; editorList.add(new Editor(numberOfEditor, channel)); return numberOfEditor; } - public void addEditor(REPSocketChannel channel) { + public void addEditor(REPSocketChannel<REPCommand> channel) { editorList.add(new Editor(0, channel)); } @@ -66,12 +66,12 @@ } - public void sendPutAck(SocketChannel channel, REPCommand repCmd) { + public void sendPutAck(REPSocketChannel<REPCommand> channel, REPCommand repCmd) { REPPacketSend send = new REPPacketSend(channel); send.send(repCmd); } - public void send(SocketChannel channel, REPCommand command){ + public void send(REPSocketChannel<REPCommand> channel, REPCommand command){ REPPacketSend send = new REPPacketSend(channel); send.send(command); }
--- a/rep/REPPacketSend.java Wed Aug 27 18:17:16 2008 +0900 +++ b/rep/REPPacketSend.java Wed Aug 27 18:22:36 2008 +0900 @@ -11,11 +11,11 @@ public class REPPacketSend { - REPSocketChannel socketchannel; + REPSocketChannel<REPCommand> socketchannel; // JIS/S-JIS = 2, UTF-8 = 3, UTF-?? = 5 final int CHAR_ORDER = 5; - public REPPacketSend(REPSocketChannel channel){ + public REPPacketSend(REPSocketChannel<REPCommand> channel){ socketchannel = channel; }
--- a/rep/SessionList.java Wed Aug 27 18:17:16 2008 +0900 +++ b/rep/SessionList.java Wed Aug 27 18:22:36 2008 +0900 @@ -125,7 +125,7 @@ // this.getSession(sid); LinkedList <Editor> editorList = sessionLinkedList.get(repCmd.sid-1).getEditorList(); //ここもforループで検索しないといけないよ。 for(Editor editor : editorList){ - SocketChannel channel2 = editor.getChannel(); + REPSocketChannel<REPCommand> channel2 = editor.getChannel(); if(channel.equals(channel2)){ editor2 = editor; } @@ -181,7 +181,7 @@ send.send(new REPCommand(REP.SMCMD_SELECT, sid, 0, 0, 0, 0, "")); } - public void addSession(SocketChannel channel, String string, int i) { + public void addSession(REPSocketChannel<REPCommand> channel, String string, int i) { tmpSessionList.add(new Session(0, string, channel)); }