// Path: src/jbenchmarker/core/Operation.java
// public abstract class Operation {
//     private TraceOperation originalOp;       // Trace operation issuing this one
// 
//     public TraceOperation getOriginalOp() {
//         return originalOp;
//     }
// 
//     public void setOriginalOp(TraceOperation originalOp) {
//         this.originalOp = originalOp;
//     }
//     
//     public Operation(TraceOperation o) {
//         this.originalOp = o;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == null) {
//             return false;
//         }
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
//         final Operation other = (Operation) obj;
//         if (this.originalOp != other.originalOp && (this.originalOp == null || !this.originalOp.equals(other.originalOp))) {
//             return false;
//         }
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int hash = 3;
//         hash = 17 * hash + (this.originalOp != null ? this.originalOp.hashCode() : 0);
//         return hash;
//     }
//     
//     abstract public Operation clone();
// }
// 
// Path: src/jbenchmarker/trace/TraceOperation.java
// public class TraceOperation {
//     public enum OpType { ins, del }; 
//     
//     private int replica;                  // replica number
//     private OpType type;                  // type of operation : insert or delete
//     private int position;                 // position in the document
//     private int offset;                   // length of a del
//     private String content;          // content of an ins
//     private VectorClock VC;               // Vector clock 
// 
//     
//     public VectorClock getVC() {
//         return VC;
//     }
// 
//     public String getContent() {
//         return content;
//     }
// 
//     public int getOffset() {
//         return offset;
//     }
// 
//     public int getPosition() {
//         return position;
//     }
// 
// 
//     public int getReplica() {
//         return replica;
//     }
// 
// 
//     public OpType getType() {
//         return type;
//     }
// 
//     public TraceOperation(OpType type, int replica, int position, int offset, String content, VectorClock VC) {
//         this.type = type;
//         this.replica = replica;
//         this.position = position;
//         this.offset = offset;
//         this.content = content;
//         this.VC = VC;
//     }
// 
//     /*
//      * Construction of an insert operation 
//      */
//     static public TraceOperation insert(int replica, int position, String content, VectorClock VC) {
//         return new TraceOperation(OpType.ins, replica, position, 0, content, VC);
//     }
//     
//     /*
//      * Construction of an insert operation 
//      */
//     static public TraceOperation delete(int replica, int position, int offset, VectorClock VC) {
//         return new TraceOperation(OpType.del, replica, position, offset, null, VC);
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == null) {
//             return false;
//         }
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
//         final TraceOperation other = (TraceOperation) obj;
//         if (this.replica != other.replica) {
//             return false;
//         }
//         if (this.type != other.type) {
//             return false;
//         }
//         if (this.position != other.position) {
//             return false;
//         }
//         if (this.offset != other.offset) {
//             return false;
//         }
//         if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
//             return false;
//         }
//         if (this.VC != other.VC && (this.VC == null || !this.VC.equals(other.VC))) {
//             return false;
//         }
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int hash = 7;
//         hash = 53 * hash + this.replica;
//         hash = 53 * hash + (this.type != null ? this.type.hashCode() : 0);
//         hash = 53 * hash + this.position;
//         hash = 53 * hash + this.offset;
//         hash = 53 * hash + (this.content != null ? this.content.hashCode() : 0);
//         hash = 53 * hash + (this.VC != null ? this.VC.hashCode() : 0);
//         return hash;
//     }
// 
//     @Override
//     public String toString() {
//         return "TraceOperation{" + "replica=" + replica + ", VC=" + VC + ", type=" + type + ", position=" + position + (type==OpType.del ? ", offset=" + offset : ", content=" + content) + '}';
//     }
//     
//     
// }
// 
// Path: src/jbenchmarker/trace/TraceOperation.java
// public enum OpType { ins, del }; 


import jbenchmarker.core.Operation;
import jbenchmarker.trace.TraceOperation;
import jbenchmarker.trace.TraceOperation.OpType;
/**
 *   This file is part of ReplicationBenchmark.
 *
 *   ReplicationBenchmark is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   ReplicationBenchmark is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with ReplicationBenchmark.  If not, see <http://www.gnu.org/licenses/>.
 *
 **/

package jbenchmarker.rga;


/**
*
* @author Roh
*/
public class RGAOperation extends Operation {
	
	public static boolean LOCAL 		= true;
	public static boolean REMOTE 	= false;
	
	private RGAS4Vector 	s4vpos;
	private RGAS4Vector  s4vtms;
	private char 				content;
	private boolean			lor;  // to be local or remote
	private int					intpos;
	
	public RGAOperation(TraceOperation o) {
		super(o);
		lor = LOCAL; 
	}
	
	public void setLocal(){
		lor = LOCAL;
	}
	
	public void setRemote(){
		lor = REMOTE;
	} 
	
	public boolean getLoR(){
		return lor;
	}
	
	public String toString(){
		String ret =new String();
		if(getType()==TraceOperation.OpType.del) ret +="del(";
// Path: src/jbenchmarker/core/Operation.java
// public abstract class Operation {
//     private TraceOperation originalOp;       // Trace operation issuing this one
// 
//     public TraceOperation getOriginalOp() {
//         return originalOp;
//     }
// 
//     public void setOriginalOp(TraceOperation originalOp) {
//         this.originalOp = originalOp;
//     }
//     
//     public Operation(TraceOperation o) {
//         this.originalOp = o;
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == null) {
//             return false;
//         }
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
//         final Operation other = (Operation) obj;
//         if (this.originalOp != other.originalOp && (this.originalOp == null || !this.originalOp.equals(other.originalOp))) {
//             return false;
//         }
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int hash = 3;
//         hash = 17 * hash + (this.originalOp != null ? this.originalOp.hashCode() : 0);
//         return hash;
//     }
//     
//     abstract public Operation clone();
// }
// 
// Path: src/jbenchmarker/trace/TraceOperation.java
// public class TraceOperation {
//     public enum OpType { ins, del }; 
//     
//     private int replica;                  // replica number
//     private OpType type;                  // type of operation : insert or delete
//     private int position;                 // position in the document
//     private int offset;                   // length of a del
//     private String content;          // content of an ins
//     private VectorClock VC;               // Vector clock 
// 
//     
//     public VectorClock getVC() {
//         return VC;
//     }
// 
//     public String getContent() {
//         return content;
//     }
// 
//     public int getOffset() {
//         return offset;
//     }
// 
//     public int getPosition() {
//         return position;
//     }
// 
// 
//     public int getReplica() {
//         return replica;
//     }
// 
// 
//     public OpType getType() {
//         return type;
//     }
// 
//     public TraceOperation(OpType type, int replica, int position, int offset, String content, VectorClock VC) {
//         this.type = type;
//         this.replica = replica;
//         this.position = position;
//         this.offset = offset;
//         this.content = content;
//         this.VC = VC;
//     }
// 
//     /*
//      * Construction of an insert operation 
//      */
//     static public TraceOperation insert(int replica, int position, String content, VectorClock VC) {
//         return new TraceOperation(OpType.ins, replica, position, 0, content, VC);
//     }
//     
//     /*
//      * Construction of an insert operation 
//      */
//     static public TraceOperation delete(int replica, int position, int offset, VectorClock VC) {
//         return new TraceOperation(OpType.del, replica, position, offset, null, VC);
//     }
// 
//     @Override
//     public boolean equals(Object obj) {
//         if (obj == null) {
//             return false;
//         }
//         if (getClass() != obj.getClass()) {
//             return false;
//         }
//         final TraceOperation other = (TraceOperation) obj;
//         if (this.replica != other.replica) {
//             return false;
//         }
//         if (this.type != other.type) {
//             return false;
//         }
//         if (this.position != other.position) {
//             return false;
//         }
//         if (this.offset != other.offset) {
//             return false;
//         }
//         if ((this.content == null) ? (other.content != null) : !this.content.equals(other.content)) {
//             return false;
//         }
//         if (this.VC != other.VC && (this.VC == null || !this.VC.equals(other.VC))) {
//             return false;
//         }
//         return true;
//     }
// 
//     @Override
//     public int hashCode() {
//         int hash = 7;
//         hash = 53 * hash + this.replica;
//         hash = 53 * hash + (this.type != null ? this.type.hashCode() : 0);
//         hash = 53 * hash + this.position;
//         hash = 53 * hash + this.offset;
//         hash = 53 * hash + (this.content != null ? this.content.hashCode() : 0);
//         hash = 53 * hash + (this.VC != null ? this.VC.hashCode() : 0);
//         return hash;
//     }
// 
//     @Override
//     public String toString() {
//         return "TraceOperation{" + "replica=" + replica + ", VC=" + VC + ", type=" + type + ", position=" + position + (type==OpType.del ? ", offset=" + offset : ", content=" + content) + '}';
//     }
//     
//     
// }
// 
// Path: src/jbenchmarker/trace/TraceOperation.java
// public enum OpType { ins, del }; 


// Path: src/jbenchmarker/rga/RGAOperation.java
import jbenchmarker.core.Operation;
import jbenchmarker.trace.TraceOperation;
import jbenchmarker.trace.TraceOperation.OpType;

/**
 *   This file is part of ReplicationBenchmark.
 *
 *   ReplicationBenchmark is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   ReplicationBenchmark is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with ReplicationBenchmark.  If not, see <http://www.gnu.org/licenses/>.
 *
 **/

package jbenchmarker.rga;


/**
*
* @author Roh
*/
public class RGAOperation extends Operation {
	
	public static boolean LOCAL 		= true;
	public static boolean REMOTE 	= false;
	
	private RGAS4Vector 	s4vpos;
	private RGAS4Vector  s4vtms;
	private char 				content;
	private boolean			lor;  // to be local or remote
	private int					intpos;
	
	public RGAOperation(TraceOperation o) {
		super(o);
		lor = LOCAL; 
	}
	
	public void setLocal(){
		lor = LOCAL;
	}
	
	public void setRemote(){
		lor = REMOTE;
	} 
	
	public boolean getLoR(){
		return lor;
	}
	
	public String toString(){
		String ret =new String();
		if(getType()==TraceOperation.OpType.del) ret +="del(";
		else ret+="ins(\'"+content+"\',";