view rep/EditorPlus.java @ 359:fa041bae35f1

all code written for distributed session except gather.
author kono
date Sun, 19 Oct 2008 19:24:38 +0900
parents b18c24dcc5d2
children
line wrap: on
line source

package rep;

import rep.channel.REPSocketChannel;

public class EditorPlus {

	public int eid; // globally unique
	public int sid=-1; // globally unique
	public String host;
	public String file;
	public REPSocketChannel<REPCommand> channel;
	
	public EditorPlus() {
		
	}
	
	public EditorPlus(int eid, REPSocketChannel<REPCommand> channel) {
		this.eid = eid;
		this.channel = channel;
	}

	public String getName() {
		return file;
	}

	public void setName(String string) {
		file = string;
	}


	public void setSID(int sid) {
		this.sid = sid;
	}
	
	public int getSID() {
		return sid;
	}

	public boolean hasSession() {
		return sid != -1;
	}
	
	public String toString(){
		return ("Editor:" + eid);
	}

	public void setEID(int eid) {
		this.eid = eid;
	}
	
	public int getEID(){
		return eid;
	}

	public void setHost(String host){
		if (channel!=null)
			this.host = host;
	}

	
	public String getHost(){
		return host;
	}
	public REPSocketChannel<REPCommand> getChannel(){
		return channel;
		
	}
	public void setChannel(REPSocketChannel<REPCommand> channel) {
		this.channel = channel;		
	}

	public void merge(EditorPlus editor) {
		if (sid==-1) sid = editor.sid;
		if (file==null) file = editor.file;
		if (host==null) host = editor.host;
	}
}