org.coweb.oe.HistoryBuffer Maven / Gradle / Ivy
package org.coweb.oe;
import java.util.Collection;
import java.util.HashMap;
import java.util.Vector;
import java.util.Stack;
import java.util.Arrays;
import java.util.Comparator;
import java.util.logging.Logger;
public class HistoryBuffer {
private static final Logger log = Logger.getLogger(HistoryBuffer.class
.getName());
private HashMap ops = null;
private int size = 0;
public HistoryBuffer() {
this.ops = new HashMap();
this.size = 0;
}
@Override
public String toString() {
StringBuffer b = new StringBuffer();
b.append("{ops : " + this.ops);
b.append(",size : " + this.size);
b.append("}");
return b.toString();
}
/**
* Serializes the history buffer contents to seed a remote instance.
*
* @return {Object[]} Serialized operations in the history
*/
public Object[] getState() {
Vector