improved sync process (HB._encode)

This commit is contained in:
Kevin Jahns 2014-08-08 04:43:40 +02:00
parent 9e1d9e568f
commit 355cfba78e
64 changed files with 14549 additions and 447 deletions

View File

@ -2,7 +2,7 @@
var createIwcConnector; var createIwcConnector;
createIwcConnector = function(callback) { createIwcConnector = function(callback) {
var IwcConnector, duiClient, get_root_intent, init, iwcHandler, received_HB, root_element; var IwcConnector, duiClient, get_HB_intent, init, iwcHandler, received_HB;
iwcHandler = {}; iwcHandler = {};
duiClient = new DUIClient(); duiClient = new DUIClient();
duiClient.connect(function(intent) { duiClient.connect(function(intent) {
@ -14,11 +14,10 @@ createIwcConnector = function(callback) {
}) : void 0; }) : void 0;
}); });
duiClient.initOK(); duiClient.initOK();
root_element = null;
received_HB = null; received_HB = null;
IwcConnector = (function() { IwcConnector = (function() {
function IwcConnector(engine, HB, execution_listener, yatta) { function IwcConnector(engine, HB, execution_listener, yatta) {
var receive_, sendRootElement, send_; var receive_, sendHistoryBuffer, send_;
this.engine = engine; this.engine = engine;
this.HB = HB; this.HB = HB;
this.execution_listener = execution_listener; this.execution_listener = execution_listener;
@ -39,26 +38,21 @@ createIwcConnector = function(callback) {
}; };
})(this); })(this);
this.iwcHandler["Yatta_new_operation"] = [receive_]; this.iwcHandler["Yatta_new_operation"] = [receive_];
if (root_element != null) { if (received_HB != null) {
this.engine.applyOps(received_HB); this.engine.applyOpsCheckDouble(received_HB);
} }
sendRootElement = (function(_this) { sendHistoryBuffer = (function(_this) {
return function() { return function() {
var json; var json;
json = { json = {
root_element: _this.yatta.getRootElement(),
HB: _this.yatta.getHistoryBuffer()._encode() HB: _this.yatta.getHistoryBuffer()._encode()
}; };
return _this.sendIwcIntent("Yatta_push_root_element", json); return _this.sendIwcIntent("Yatta_push_HB_element", json);
}; };
})(this); })(this);
this.iwcHandler["Yatta_get_root_element"] = [sendRootElement]; this.iwcHandler["Yatta_get_HB_element"] = [sendHistoryBuffer];
} }
IwcConnector.prototype.getRootElement = function() {
return root_element;
};
IwcConnector.prototype.send = function(o) { IwcConnector.prototype.send = function(o) {
if (o.uid.creator === this.HB.getUserId() && (typeof o.uid.op_number !== "string")) { if (o.uid.creator === this.HB.getUserId() && (typeof o.uid.op_number !== "string")) {
return this.sendIwcIntent("Yatta_new_operation", o); return this.sendIwcIntent("Yatta_new_operation", o);
@ -90,31 +84,30 @@ createIwcConnector = function(callback) {
return IwcConnector; return IwcConnector;
})(); })();
get_root_intent = { get_HB_intent = {
action: "Yatta_get_root_element", action: "Yatta_get_HB_element",
component: "", component: "",
data: "", data: "",
dataType: "", dataType: "",
extras: {} extras: {}
}; };
init = function() { init = function() {
var is_initialized, receiveRootElement; var is_initialized, receiveHB;
duiClient.sendIntent(get_root_intent); duiClient.sendIntent(get_HB_intent);
is_initialized = false; is_initialized = false;
receiveRootElement = function(json) { receiveHB = function(json) {
var proposed_user_id; var proposed_user_id;
proposed_user_id = duiClient.getIwcClient()._componentName; proposed_user_id = duiClient.getIwcClient()._componentName;
root_element = json != null ? json.extras.root_element : void 0;
received_HB = json != null ? json.extras.HB : void 0; received_HB = json != null ? json.extras.HB : void 0;
if (!is_initialized) { if (!is_initialized) {
is_initialized = true; is_initialized = true;
return callback(IwcConnector, proposed_user_id); return callback(IwcConnector, proposed_user_id);
} }
}; };
iwcHandler["Yatta_push_root_element"] = [receiveRootElement]; iwcHandler["Yatta_push_HB_element"] = [receiveHB];
return setTimeout(receiveRootElement, 800); return setTimeout(receiveHB, 0);
}; };
setTimeout(init, Math.random() * 4000); setTimeout(init, Math.random() * 0);
return void 0; return void 0;
}; };
@ -145,6 +138,40 @@ Engine = (function() {
} }
}; };
Engine.prototype.applyOpsBundle = function(ops_json) {
var o, ops, _i, _j, _k, _len, _len1, _len2;
ops = [];
for (_i = 0, _len = ops_json.length; _i < _len; _i++) {
o = ops_json[_i];
ops.push(this.parseOperation(o));
}
for (_j = 0, _len1 = ops.length; _j < _len1; _j++) {
o = ops[_j];
this.HB.addOperation(o);
}
for (_k = 0, _len2 = ops.length; _k < _len2; _k++) {
o = ops[_k];
if (!o.execute()) {
this.unprocessed_ops.push(o);
}
}
return this.tryUnprocessed();
};
Engine.prototype.applyOpsCheckDouble = function(ops_json) {
var o, _i, _len, _results;
_results = [];
for (_i = 0, _len = ops_json.length; _i < _len; _i++) {
o = ops_json[_i];
if (this.HB.getOperation(o.uid) != null) {
_results.push(this.applyOp(o));
} else {
_results.push(void 0);
}
}
return _results;
};
Engine.prototype.applyOps = function(ops_json) { Engine.prototype.applyOps = function(ops_json) {
var o, _i, _len, _results; var o, _i, _len, _results;
_results = []; _results = [];
@ -153,26 +180,15 @@ Engine = (function() {
_results.push(this.applyOp(o)); _results.push(this.applyOp(o));
} }
return _results; return _results;
/*
ops = []
for o in ops_json
ops.push @parseOperation o
for o in ops
@HB.addOperation o
for o in ops
if not o.execute()
@unprocessed_ops.push o
@tryUnprocessed()
*/
}; };
Engine.prototype.applyOp = function(op_json) { Engine.prototype.applyOp = function(op_json) {
var o; var o;
o = this.parseOperation(op_json); o = this.parseOperation(op_json);
this.HB.addOperation(o);
if (!o.execute()) { if (!o.execute()) {
this.unprocessed_ops.push(o); this.unprocessed_ops.push(o);
} else {
this.HB.addOperation(o);
} }
return this.tryUnprocessed(); return this.tryUnprocessed();
}; };
@ -188,6 +204,8 @@ Engine = (function() {
op = _ref[_i]; op = _ref[_i];
if (!op.execute()) { if (!op.execute()) {
unprocessed.push(op); unprocessed.push(op);
} else {
this.HB.addOperation(op);
} }
} }
this.unprocessed_ops = unprocessed; this.unprocessed_ops = unprocessed;
@ -319,16 +337,39 @@ HistoryBuffer = (function() {
return res; return res;
}; };
HistoryBuffer.prototype._encode = function() { HistoryBuffer.prototype._encode = function(state_vector) {
var json, o, o_number, u_name, user, _ref; var json, o, o_json, o_next, o_number, o_prev, u_name, unknown, user, _ref;
if (state_vector == null) {
state_vector = {};
}
json = []; json = [];
unknown = function(user, o_number) {
if ((user == null) || (o_number == null)) {
throw new Error("dah!");
}
return (state_vector[user] == null) || state_vector[user] <= o_number;
};
_ref = this.buffer; _ref = this.buffer;
for (u_name in _ref) { for (u_name in _ref) {
user = _ref[u_name]; user = _ref[u_name];
for (o_number in user) { for (o_number in user) {
o = user[o_number]; o = user[o_number];
if (!isNaN(parseInt(o_number))) { if (!isNaN(parseInt(o_number)) && unknown(u_name, o_number)) {
json.push(o._encode()); o_json = o._encode();
if (o.next_cl != null) {
o_next = o.next_cl;
while ((o_next.next_cl != null) && unknown(o_next.creator, o_next.op_number)) {
o_next = o_next.next_cl;
}
o_json.next = o_next.getUid();
} else if (o.prev_cl != null) {
o_prev = o.prev_cl;
while ((o_prev.prev_cl != null) && unknown(o_next.creator, o_next.op_number)) {
o_prev = o_prev.prev_cl;
}
o_json.prev = o_prev.getUid();
}
json.push(o_json);
} }
} }
} }
@ -649,20 +690,39 @@ module.exports = function(HB) {
Delimiter = (function(_super) { Delimiter = (function(_super) {
__extends(Delimiter, _super); __extends(Delimiter, _super);
function Delimiter() { function Delimiter(uid, prev_cl, next_cl, origin) {
return Delimiter.__super__.constructor.apply(this, arguments); this.saveOperation('prev_cl', prev_cl);
this.saveOperation('next_cl', next_cl);
this.saveOperation('origin', prev_cl);
Delimiter.__super__.constructor.call(this, uid);
} }
Delimiter.prototype.isDeleted = function() {
return false;
};
Delimiter.prototype.execute = function() { Delimiter.prototype.execute = function() {
var l, _i, _len; var _ref, _ref1;
if (this.validateSavedOperations()) { if (((_ref = this.unchecked) != null ? _ref['next_cl'] : void 0) != null) {
for (_i = 0, _len = execution_listener.length; _i < _len; _i++) { return Delimiter.__super__.execute.apply(this, arguments);
l = execution_listener[_i]; } else if ((_ref1 = this.unchecked) != null ? _ref1['prev_cl'] : void 0) {
l(this._encode()); if (this.validateSavedOperations()) {
if (this.prev_cl.next_cl != null) {
throw new Error("Probably duplicated operations");
}
this.prev_cl.next_cl = this;
delete this.prev_cl.unchecked.next_cl;
return Delimiter.__super__.execute.apply(this, arguments);
} else {
return false;
} }
return this; } else if ((this.prev_cl != null) && (this.prev_cl.next_cl == null)) {
delete this.prev_cl.unchecked.next_cl;
return this.prev_cl.next_cl = this;
} else if ((this.prev_cl != null) || (this.next_cl != null)) {
return Delimiter.__super__.execute.apply(this, arguments);
} else { } else {
return false; throw new Error("Delimiter is unsufficient defined!");
} }
}; };
@ -678,7 +738,7 @@ module.exports = function(HB) {
return Delimiter; return Delimiter;
})(Insert); })(Operation);
parser['Delimiter'] = function(json) { parser['Delimiter'] = function(json) {
var next, prev, uid; var next, prev, uid;
uid = json['uid'], prev = json['prev'], next = json['next']; uid = json['uid'], prev = json['prev'], next = json['next'];
@ -941,9 +1001,8 @@ module.exports = function(HB) {
uid_beg.op_number = "_" + uid_beg.op_number + "_RM_" + this.name + "_beginning"; uid_beg.op_number = "_" + uid_beg.op_number + "_RM_" + this.name + "_beginning";
uid_end = this.map_manager.getUid(); uid_end = this.map_manager.getUid();
uid_end.op_number = "_" + uid_end.op_number + "_RM_" + this.name + "_end"; uid_end.op_number = "_" + uid_end.op_number + "_RM_" + this.name + "_end";
beg = HB.addOperation(new types.Delimiter(uid_beg, void 0, uid_end)); beg = HB.addOperation(new types.Delimiter(uid_beg, void 0, uid_end)).execute();
end = HB.addOperation(new types.Delimiter(uid_end, beg, void 0)).execute(); end = HB.addOperation(new types.Delimiter(uid_end, beg, void 0)).execute();
beg.execute();
this.map_manager.map[this.name] = HB.addOperation(new ReplaceManager(void 0, uid_r, beg, end)).execute(); this.map_manager.map[this.name] = HB.addOperation(new ReplaceManager(void 0, uid_r, beg, end)).execute();
} }
return AddName.__super__.execute.apply(this, arguments); return AddName.__super__.execute.apply(this, arguments);
@ -1240,7 +1299,7 @@ module.exports = function(HB) {
o = this.getOperationByPosition(position); o = this.getOperationByPosition(position);
_results = []; _results = [];
for (i = _i = 0; 0 <= length ? _i < length : _i > length; i = 0 <= length ? ++_i : --_i) { for (i = _i = 0; 0 <= length ? _i < length : _i > length; i = 0 <= length ? ++_i : --_i) {
d = HB.addOperation(new TextDelete(HB.getNextOperationIdentifier(), o)).execute(); d = HB.addOperation(new TextDelete(void 0, o)).execute();
o = o.next_cl; o = o.next_cl;
while (o.isDeleted()) { while (o.isDeleted()) {
if (o instanceof types.Delimiter) { if (o instanceof types.Delimiter) {
@ -1256,7 +1315,7 @@ module.exports = function(HB) {
Word.prototype.replaceText = function(text) { Word.prototype.replaceText = function(text) {
var word; var word;
if (this.replace_manager != null) { if (this.replace_manager != null) {
word = HB.addOperation(new Word(HB.getNextOperationIdentifier())).execute(); word = HB.addOperation(new Word(void 0)).execute();
word.insertText(0, text); word.insertText(0, text);
return this.replace_manager.replace(word); return this.replace_manager.replace(word);
} else { } else {

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
var createIwcConnector; var createIwcConnector;
createIwcConnector = function(callback) { createIwcConnector = function(callback) {
var IwcConnector, duiClient, get_root_intent, init, iwcHandler, received_HB, root_element; var IwcConnector, duiClient, get_HB_intent, init, iwcHandler, received_HB;
iwcHandler = {}; iwcHandler = {};
duiClient = new DUIClient(); duiClient = new DUIClient();
duiClient.connect(function(intent) { duiClient.connect(function(intent) {
@ -13,11 +13,10 @@ createIwcConnector = function(callback) {
}) : void 0; }) : void 0;
}); });
duiClient.initOK(); duiClient.initOK();
root_element = null;
received_HB = null; received_HB = null;
IwcConnector = (function() { IwcConnector = (function() {
function IwcConnector(engine, HB, execution_listener, yatta) { function IwcConnector(engine, HB, execution_listener, yatta) {
var receive_, sendRootElement, send_; var receive_, sendHistoryBuffer, send_;
this.engine = engine; this.engine = engine;
this.HB = HB; this.HB = HB;
this.execution_listener = execution_listener; this.execution_listener = execution_listener;
@ -38,26 +37,21 @@ createIwcConnector = function(callback) {
}; };
})(this); })(this);
this.iwcHandler["Yatta_new_operation"] = [receive_]; this.iwcHandler["Yatta_new_operation"] = [receive_];
if (root_element != null) { if (received_HB != null) {
this.engine.applyOps(received_HB); this.engine.applyOpsCheckDouble(received_HB);
} }
sendRootElement = (function(_this) { sendHistoryBuffer = (function(_this) {
return function() { return function() {
var json; var json;
json = { json = {
root_element: _this.yatta.getRootElement(),
HB: _this.yatta.getHistoryBuffer()._encode() HB: _this.yatta.getHistoryBuffer()._encode()
}; };
return _this.sendIwcIntent("Yatta_push_root_element", json); return _this.sendIwcIntent("Yatta_push_HB_element", json);
}; };
})(this); })(this);
this.iwcHandler["Yatta_get_root_element"] = [sendRootElement]; this.iwcHandler["Yatta_get_HB_element"] = [sendHistoryBuffer];
} }
IwcConnector.prototype.getRootElement = function() {
return root_element;
};
IwcConnector.prototype.send = function(o) { IwcConnector.prototype.send = function(o) {
if (o.uid.creator === this.HB.getUserId() && (typeof o.uid.op_number !== "string")) { if (o.uid.creator === this.HB.getUserId() && (typeof o.uid.op_number !== "string")) {
return this.sendIwcIntent("Yatta_new_operation", o); return this.sendIwcIntent("Yatta_new_operation", o);
@ -89,31 +83,30 @@ createIwcConnector = function(callback) {
return IwcConnector; return IwcConnector;
})(); })();
get_root_intent = { get_HB_intent = {
action: "Yatta_get_root_element", action: "Yatta_get_HB_element",
component: "", component: "",
data: "", data: "",
dataType: "", dataType: "",
extras: {} extras: {}
}; };
init = function() { init = function() {
var is_initialized, receiveRootElement; var is_initialized, receiveHB;
duiClient.sendIntent(get_root_intent); duiClient.sendIntent(get_HB_intent);
is_initialized = false; is_initialized = false;
receiveRootElement = function(json) { receiveHB = function(json) {
var proposed_user_id; var proposed_user_id;
proposed_user_id = duiClient.getIwcClient()._componentName; proposed_user_id = duiClient.getIwcClient()._componentName;
root_element = json != null ? json.extras.root_element : void 0;
received_HB = json != null ? json.extras.HB : void 0; received_HB = json != null ? json.extras.HB : void 0;
if (!is_initialized) { if (!is_initialized) {
is_initialized = true; is_initialized = true;
return callback(IwcConnector, proposed_user_id); return callback(IwcConnector, proposed_user_id);
} }
}; };
iwcHandler["Yatta_push_root_element"] = [receiveRootElement]; iwcHandler["Yatta_push_HB_element"] = [receiveHB];
return setTimeout(receiveRootElement, 800); return setTimeout(receiveHB, 0);
}; };
setTimeout(init, Math.random() * 4000); setTimeout(init, Math.random() * 0);
return void 0; return void 0;
}; };

View File

@ -6,5 +6,5 @@
"IwcConnector.coffee" "IwcConnector.coffee"
], ],
"names": [], "names": [],
"mappings": "AACA,IAAA,kBAAA;;AAAA,kBAAA,GAAqB,SAAC,QAAD,GAAA;AACnB,MAAA,qFAAA;AAAA,EAAA,UAAA,GAAa,EAAb,CAAA;AAAA,EACA,SAAA,GAAgB,IAAA,SAAA,CAAA,CADhB,CAAA;AAAA,EAGA,SAAS,CAAC,OAAV,CAAkB,SAAC,MAAD,GAAA;AAGhB,QAAA,IAAA;4DAAyB,CAAE,GAA3B,CAA+B,SAAC,CAAD,GAAA;aAC7B,UAAA,CAAW,SAAA,GAAA;eACP,CAAA,CAAE,MAAF,EADO;MAAA,CAAX,EAEI,CAFJ,EAD6B;IAAA,CAA/B,WAHgB;EAAA,CAAlB,CAHA,CAAA;AAAA,EAWA,SAAS,CAAC,MAAV,CAAA,CAXA,CAAA;AAAA,EAaA,YAAA,GAAe,IAbf,CAAA;AAAA,EAcA,WAAA,GAAc,IAdd,CAAA;AAAA,EAqBM;AACS,IAAA,sBAAE,MAAF,EAAW,EAAX,EAAgB,kBAAhB,EAAqC,KAArC,GAAA;AACX,UAAA,gCAAA;AAAA,MADY,IAAC,CAAA,SAAA,MACb,CAAA;AAAA,MADqB,IAAC,CAAA,KAAA,EACtB,CAAA;AAAA,MAD0B,IAAC,CAAA,qBAAA,kBAC3B,CAAA;AAAA,MAD+C,IAAC,CAAA,QAAA,KAChD,CAAA;AAAA,MAAA,IAAC,CAAA,SAAD,GAAa,SAAb,CAAA;AAAA,MACA,IAAC,CAAA,UAAD,GAAc,UADd,CAAA;AAAA,MAGA,KAAA,GAAQ,CAAA,SAAA,KAAA,GAAA;eAAA,SAAC,CAAD,GAAA;iBACN,KAAC,CAAA,IAAD,CAAM,CAAN,EADM;QAAA,EAAA;MAAA,CAAA,CAAA,CAAA,IAAA,CAHR,CAAA;AAAA,MAKA,IAAC,CAAA,kBAAkB,CAAC,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;AAAA,IAGA,QAAA,EAAU,EAHV;AAAA,IAIA,MAAA,EAAQ,EAJR;GAlEF,CAAA;AAAA,EAwEA,IAAA,GAAO,SAAA,GAAA;AACL,QAAA,yBAAA;AAAA,IAAA,SAAS,CAAC,UAAV,CAAqB,aAArB,CAAA,CAAA;AAAA,IAEA,cAAA,GAAiB,KAFjB,CAAA;AAAA,IAGA,SAAA,GAAY,SAAC,IAAD,GAAA;AACV,UAAA,gBAAA;AAAA,MAAA,gBAAA,GAAmB,SAAS,CAAC,YAAV,CAAA,CAAwB,CAAC,cAA5C,CAAA;AAAA,MACA,WAAA,kBAAc,IAAI,CAAE,MAAM,CAAC,WAD3B,CAAA;AAEA,MAAA,IAAG,CAAA,cAAH;AACE,QAAA,cAAA,GAAiB,IAAjB,CAAA;eACA,QAAA,CAAS,YAAT,EAAuB,gBAAvB,EAFF;OAHU;IAAA,CAHZ,CAAA;AAAA,IASA,UAAW,CAAA,uBAAA,CAAX,GAAsC,CAAC,SAAD,CATtC,CAAA;WAUA,UAAA,CAAW,SAAX,EAAsB,CAAtB,EAXK;EAAA,CAxEP,CAAA;AAAA,EAqFA,UAAA,CAAW,IAAX,EAAkB,IAAI,CAAC,MAAL,CAAA,CAAA,GAAc,CAAhC,CArFA,CAAA;SAuFA,OAxFmB;AAAA,CAArB,CAAA;;AAAA,MAyFM,CAAC,OAAP,GAAiB,kBAzFjB,CAAA;;;EA0FA,MAAM,CAAE,eAAR,GAA0B;CA1F1B"
} }

View File

@ -33,12 +33,6 @@ module.exports = function(user_list) {
return this.applied_operations; return this.applied_operations;
}; };
TestConnector.prototype.getRootElement = function() {
if (user_list.length > 0) {
return user_list[0].getRootElement().getUid();
}
};
TestConnector.prototype.send = function(o) { TestConnector.prototype.send = function(o) {
var user, _i, _len, _results; var user, _i, _len, _results;
if ((o.uid.creator === this.HB.getUserId()) && (typeof o.uid.op_number !== "string")) { if ((o.uid.creator === this.HB.getUserId()) && (typeof o.uid.op_number !== "string")) {

View File

@ -6,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3B,CAAgC,CAAhC,EAFO;IAAA,CAvBT,CAAA;;AAAA,4BA2BA,QAAA,GAAU,SAAC,IAAD,GAAA;AACR,UAAA,IAAA;AAAA,MAAA,kDAAoB,CAAE,gBAAnB,GAA4B,CAA/B;eACE,IAAC,CAAA,MAAM,CAAC,OAAR,CAAgB,IAAC,CAAA,UAAW,CAAA,IAAA,CAAK,CAAC,KAAlB,CAAA,CAAhB,EADF;OADQ;IAAA,CA3BV,CAAA;;AAAA,4BA+BA,cAAA,GAAgB,SAAA,GAAA;aACd,IAAC,CAAA,QAAD,CAAW,CAAC,CAAC,MAAF,CAAS,CAAT,EAAa,SAAS,CAAC,MAAV,GAAiB,CAA9B,CAAX,EADc;IAAA,CA/BhB,CAAA;;AAAA,4BAkCA,QAAA,GAAU,SAAA,GAAA;AACR,UAAA,YAAA;AAAA;AAAA,WAAA,SAAA;sBAAA;AACE,QAAA,IAAC,CAAA,MAAM,CAAC,QAAR,CAAiB,GAAjB,CAAA,CADF;AAAA,OAAA;aAEA,IAAC,CAAA,UAAD,GAAc,GAHN;IAAA,CAlCV,CAAA;;AAAA,4BAsCA,IAAA,GAAM,SAAA,GAAA;AACJ,YAAU,IAAA,KAAA,CAAM,uBAAN,CAAV,CADI;IAAA,CAtCN,CAAA;;yBAAA;;OANa;AAAA,CAFjB,CAAA"
} }

View File

@ -17,6 +17,40 @@ Engine = (function() {
} }
}; };
Engine.prototype.applyOpsBundle = function(ops_json) {
var o, ops, _i, _j, _k, _len, _len1, _len2;
ops = [];
for (_i = 0, _len = ops_json.length; _i < _len; _i++) {
o = ops_json[_i];
ops.push(this.parseOperation(o));
}
for (_j = 0, _len1 = ops.length; _j < _len1; _j++) {
o = ops[_j];
this.HB.addOperation(o);
}
for (_k = 0, _len2 = ops.length; _k < _len2; _k++) {
o = ops[_k];
if (!o.execute()) {
this.unprocessed_ops.push(o);
}
}
return this.tryUnprocessed();
};
Engine.prototype.applyOpsCheckDouble = function(ops_json) {
var o, _i, _len, _results;
_results = [];
for (_i = 0, _len = ops_json.length; _i < _len; _i++) {
o = ops_json[_i];
if (this.HB.getOperation(o.uid) != null) {
_results.push(this.applyOp(o));
} else {
_results.push(void 0);
}
}
return _results;
};
Engine.prototype.applyOps = function(ops_json) { Engine.prototype.applyOps = function(ops_json) {
var o, _i, _len, _results; var o, _i, _len, _results;
_results = []; _results = [];
@ -25,26 +59,15 @@ Engine = (function() {
_results.push(this.applyOp(o)); _results.push(this.applyOp(o));
} }
return _results; return _results;
/*
ops = []
for o in ops_json
ops.push @parseOperation o
for o in ops
@HB.addOperation o
for o in ops
if not o.execute()
@unprocessed_ops.push o
@tryUnprocessed()
*/
}; };
Engine.prototype.applyOp = function(op_json) { Engine.prototype.applyOp = function(op_json) {
var o; var o;
o = this.parseOperation(op_json); o = this.parseOperation(op_json);
this.HB.addOperation(o);
if (!o.execute()) { if (!o.execute()) {
this.unprocessed_ops.push(o); this.unprocessed_ops.push(o);
} else {
this.HB.addOperation(o);
} }
return this.tryUnprocessed(); return this.tryUnprocessed();
}; };
@ -60,6 +83,8 @@ Engine = (function() {
op = _ref[_i]; op = _ref[_i];
if (!op.execute()) { if (!op.execute()) {
unprocessed.push(op); unprocessed.push(op);
} else {
this.HB.addOperation(op);
} }
} }
this.unprocessed_ops = unprocessed; this.unprocessed_ops = unprocessed;

View File

@ -6,5 +6,5 @@
"Engine.coffee" "Engine.coffee"
], ],
"names": [], "names": [],
"mappings": "AAIA,IAAA,MAAA;;AAAA;AACe,EAAA,gBAAE,EAAF,EAAO,MAAP,GAAA;AACX,IADY,IAAC,CAAA,KAAA,EACb,CAAA;AAAA,IADiB,IAAC,CAAA,SAAA,MAClB,CAAA;AAAA,IAAA,IAAC,CAAA,eAAD,GAAmB,EAAnB,CADW;EAAA,CAAb;;AAAA,mBAGA,cAAA,GAAgB,SAAC,IAAD,GAAA;AACd,QAAA,UAAA;AAAA,IAAA,UAAA,GAAa,IAAC,CAAA,MAAO,CAAA,IAAI,CAAC,IAAL,CAArB,CAA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;AAGE,UAAA,IAAC,CAAA,EAAE,CAAC,YAAJ,CAAiB,EAAjB,CAAA,CAHF;SADF;AAAA,OAFA;AAAA,MAOA,IAAC,CAAA,eAAD,GAAmB,WAPnB,CAAA;AAQA,MAAA,IAAG,IAAC,CAAA,eAAe,CAAC,MAAjB,KAA2B,UAA9B;AACE,cADF;OAAA,MAAA;8BAAA;OATF;IAAA,CAAA;oBADc;EAAA,CAzDhB,CAAA;;gBAAA;;IADF,CAAA;;AAAA,MA0EM,CAAC,OAAP,GAAiB,MA1EjB,CAAA"
} }

View File

@ -30,16 +30,39 @@ HistoryBuffer = (function() {
return res; return res;
}; };
HistoryBuffer.prototype._encode = function() { HistoryBuffer.prototype._encode = function(state_vector) {
var json, o, o_number, u_name, user, _ref; var json, o, o_json, o_next, o_number, o_prev, u_name, unknown, user, _ref;
if (state_vector == null) {
state_vector = {};
}
json = []; json = [];
unknown = function(user, o_number) {
if ((user == null) || (o_number == null)) {
throw new Error("dah!");
}
return (state_vector[user] == null) || state_vector[user] <= o_number;
};
_ref = this.buffer; _ref = this.buffer;
for (u_name in _ref) { for (u_name in _ref) {
user = _ref[u_name]; user = _ref[u_name];
for (o_number in user) { for (o_number in user) {
o = user[o_number]; o = user[o_number];
if (!isNaN(parseInt(o_number))) { if (!isNaN(parseInt(o_number)) && unknown(u_name, o_number)) {
json.push(o._encode()); o_json = o._encode();
if (o.next_cl != null) {
o_next = o.next_cl;
while ((o_next.next_cl != null) && unknown(o_next.creator, o_next.op_number)) {
o_next = o_next.next_cl;
}
o_json.next = o_next.getUid();
} else if (o.prev_cl != null) {
o_prev = o.prev_cl;
while ((o_prev.prev_cl != null) && unknown(o_next.creator, o_next.op_number)) {
o_prev = o_prev.prev_cl;
}
o_json.prev = o_prev.getUid();
}
json.push(o_json);
} }
} }
} }

View File

@ -6,5 +6,5 @@
"HistoryBuffer.coffee" "HistoryBuffer.coffee"
], ],
"names": [], "names": [],
"mappings": "AAMA,IAAA,aAAA;;AAAA;AAMe,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A;WASA,IAV0B;EAAA,CA9D5B,CAAA;;AAAA,0BA2EA,YAAA,GAAc,SAAC,GAAD,GAAA;AACZ,QAAA,IAAA;AAAA,IAAA,IAAG,GAAA,YAAe,MAAlB;6DACwB,CAAA,GAAG,CAAC,SAAJ,WADxB;KAAA,MAEK,IAAO,WAAP;AAAA;KAAA,MAAA;AAEH,YAAU,IAAA,KAAA,CAAM,kCAAN,CAAV,CAFG;KAHO;EAAA,CA3Ed,CAAA;;AAAA,0BAoFA,YAAA,GAAc,SAAC,CAAD,GAAA;AACZ,IAAA,IAAO,8BAAP;AACE,MAAA,IAAC,CAAA,MAAO,CAAA,CAAC,CAAC,OAAF,CAAR,GAAqB,EAArB,CADF;KAAA;AAEA,IAAA,IAAO,yCAAP;AACE,MAAA,IAAC,CAAA,iBAAkB,CAAA,CAAC,CAAC,OAAF,CAAnB,GAAgC,CAAhC,CADF;KAFA;AAMA,IAAA,IAAG,2CAAH;AACE,YAAU,IAAA,KAAA,CAAM,oCAAN,CAAV,CADF;KANA;AAAA,IAQA,IAAC,CAAA,MAAO,CAAA,CAAC,CAAC,OAAF,CAAW,CAAA,CAAC,CAAC,SAAF,CAAnB,GAAkC,CARlC,CAAA;AASA,IAAA,IAAG,MAAA,CAAA,CAAQ,CAAC,SAAT,KAAsB,QAAtB,IAAmC,CAAC,CAAC,OAAF,KAAe,IAAC,CAAA,SAAD,CAAA,CAArD;AACE,MAAA,IAAC,CAAA,iBAAkB,CAAA,CAAC,CAAC,OAAF,CAAnB,EAAA,CADF;KATA;WAWA,EAZY;EAAA,CApFd,CAAA;;uBAAA;;IANF,CAAA;;AAAA,MAwGM,CAAC,OAAP,GAAiB,aAxGjB,CAAA"
} }

View File

@ -260,20 +260,39 @@ module.exports = function(HB) {
Delimiter = (function(_super) { Delimiter = (function(_super) {
__extends(Delimiter, _super); __extends(Delimiter, _super);
function Delimiter() { function Delimiter(uid, prev_cl, next_cl, origin) {
return Delimiter.__super__.constructor.apply(this, arguments); this.saveOperation('prev_cl', prev_cl);
this.saveOperation('next_cl', next_cl);
this.saveOperation('origin', prev_cl);
Delimiter.__super__.constructor.call(this, uid);
} }
Delimiter.prototype.isDeleted = function() {
return false;
};
Delimiter.prototype.execute = function() { Delimiter.prototype.execute = function() {
var l, _i, _len; var _ref, _ref1;
if (this.validateSavedOperations()) { if (((_ref = this.unchecked) != null ? _ref['next_cl'] : void 0) != null) {
for (_i = 0, _len = execution_listener.length; _i < _len; _i++) { return Delimiter.__super__.execute.apply(this, arguments);
l = execution_listener[_i]; } else if ((_ref1 = this.unchecked) != null ? _ref1['prev_cl'] : void 0) {
l(this._encode()); if (this.validateSavedOperations()) {
if (this.prev_cl.next_cl != null) {
throw new Error("Probably duplicated operations");
}
this.prev_cl.next_cl = this;
delete this.prev_cl.unchecked.next_cl;
return Delimiter.__super__.execute.apply(this, arguments);
} else {
return false;
} }
return this; } else if ((this.prev_cl != null) && (this.prev_cl.next_cl == null)) {
delete this.prev_cl.unchecked.next_cl;
return this.prev_cl.next_cl = this;
} else if ((this.prev_cl != null) || (this.next_cl != null)) {
return Delimiter.__super__.execute.apply(this, arguments);
} else { } else {
return false; throw new Error("Delimiter is unsufficient defined!");
} }
}; };
@ -289,7 +308,7 @@ module.exports = function(HB) {
return Delimiter; return Delimiter;
})(Insert); })(Operation);
parser['Delimiter'] = function(json) { parser['Delimiter'] = function(json) {
var next, prev, uid; var next, prev, uid;
uid = json['uid'], prev = json['prev'], next = json['next']; uid = json['uid'], prev = json['prev'], next = json['next'];

File diff suppressed because one or more lines are too long

View File

@ -71,9 +71,8 @@ module.exports = function(HB) {
uid_beg.op_number = "_" + uid_beg.op_number + "_RM_" + this.name + "_beginning"; uid_beg.op_number = "_" + uid_beg.op_number + "_RM_" + this.name + "_beginning";
uid_end = this.map_manager.getUid(); uid_end = this.map_manager.getUid();
uid_end.op_number = "_" + uid_end.op_number + "_RM_" + this.name + "_end"; uid_end.op_number = "_" + uid_end.op_number + "_RM_" + this.name + "_end";
beg = HB.addOperation(new types.Delimiter(uid_beg, void 0, uid_end)); beg = HB.addOperation(new types.Delimiter(uid_beg, void 0, uid_end)).execute();
end = HB.addOperation(new types.Delimiter(uid_end, beg, void 0)).execute(); end = HB.addOperation(new types.Delimiter(uid_end, beg, void 0)).execute();
beg.execute();
this.map_manager.map[this.name] = HB.addOperation(new ReplaceManager(void 0, uid_r, beg, end)).execute(); this.map_manager.map[this.name] = HB.addOperation(new ReplaceManager(void 0, uid_r, beg, end)).execute();
} }
return AddName.__super__.execute.apply(this, arguments); return AddName.__super__.execute.apply(this, arguments);

File diff suppressed because one or more lines are too long

View File

@ -94,7 +94,7 @@ module.exports = function(HB) {
o = this.getOperationByPosition(position); o = this.getOperationByPosition(position);
_results = []; _results = [];
for (i = _i = 0; 0 <= length ? _i < length : _i > length; i = 0 <= length ? ++_i : --_i) { for (i = _i = 0; 0 <= length ? _i < length : _i > length; i = 0 <= length ? ++_i : --_i) {
d = HB.addOperation(new TextDelete(HB.getNextOperationIdentifier(), o)).execute(); d = HB.addOperation(new TextDelete(void 0, o)).execute();
o = o.next_cl; o = o.next_cl;
while (o.isDeleted()) { while (o.isDeleted()) {
if (o instanceof types.Delimiter) { if (o instanceof types.Delimiter) {
@ -110,7 +110,7 @@ module.exports = function(HB) {
Word.prototype.replaceText = function(text) { Word.prototype.replaceText = function(text) {
var word; var word;
if (this.replace_manager != null) { if (this.replace_manager != null) {
word = HB.addOperation(new Word(HB.getNextOperationIdentifier())).execute(); word = HB.addOperation(new Word(void 0)).execute();
word.insertText(0, text); word.insertText(0, text);
return this.replace_manager.replace(word); return this.replace_manager.replace(word);
} else { } else {

View File

@ -6,5 +6,5 @@
"TextTypes.coffee" "TextTypes.coffee"
], ],
"names": [], "names": [],
"mappings": "AAAA,IAAA,8BAAA;EAAA;iSAAA;;AAAA,8BAAA,GAAiC,OAAA,CAAQ,0BAAR,CAAjC,CAAA;;AAAA,MAEM,CAAC,OAAP,GAAiB,SAAC,EAAD,GAAA;AACf,MAAA,6DAA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,CAAA,GAAG,CAAC,MAAL,CAAA,CAJH;OAAP,CAAA;AAMA,MAAA,IAAG,oBAAH;AACE,QAAA,IAAK,CAAA,MAAA,CAAL,GAAe,IAAC,CAAA,OAAO,CAAC,MAAT,CAAA,CAAf,CADF;OANA;AAQA,MAAA,IAAG,oBAAH;AACE,QAAA,IAAK,CAAA,MAAA,CAAL,GAAe,IAAC,CAAA,OAAO,CAAC,MAAT,CAAA,CAAf,CADF;OARA;AAUA,MAAA,IAAG,qBAAA,IAAa,IAAC,CAAA,MAAD,KAAa,IAAC,CAAA,OAA9B;AACE,QAAA,IAAK,CAAA,QAAA,CAAL,GAAiB,IAAC,CAAA,MAAM,CAAC,MAAR,CAAA,CAAjB,CADF;OAVA;aAYA,KAbO;IAAA,CA7DT,CAAA;;gBAAA;;KALiB,KAAK,CAAC,YAzEzB,CAAA;AAAA,EA0JA,MAAO,CAAA,MAAA,CAAP,GAAiB,SAAC,IAAD,GAAA;AACf,QAAA,uCAAA;AAAA,IACU,WAAR,MADF,EAEgB,iBAAd,YAFF,EAGU,WAAR,MAHF,EAIU,YAAR,OAJF,EAKU,YAAR,OALF,EAMa,cAAX,SANF,CAAA;WAQI,IAAA,IAAA,CAAK,GAAL,EAAU,SAAV,EAAqB,GAArB,EAA0B,IAA1B,EAAgC,IAAhC,EAAsC,MAAtC,EATW;EAAA,CA1JjB,CAAA;AAAA,EAqKA,KAAM,CAAA,YAAA,CAAN,GAAsB,UArKtB,CAAA;AAAA,EAsKA,KAAM,CAAA,YAAA,CAAN,GAAsB,UAtKtB,CAAA;AAAA,EAuKA,KAAM,CAAA,MAAA,CAAN,GAAgB,IAvKhB,CAAA;SAwKA,iBAzKe;AAAA,CAFjB,CAAA"
} }

View File

@ -342,7 +342,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -142,7 +142,7 @@ only one will AddName operation will be executed.</p>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -157,7 +157,7 @@ This result can be sent to other clients.</p>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -35,7 +35,7 @@
<tr> <tr>
<td>Inherits:</td> <td>Inherits:</td>
<td> <td>
<a href='../class/Insert.html'>Insert</a> <a href='../class/Operation.html'>Operation</a>
</td> </td>
</tr> </tr>
</table> </table>
@ -49,6 +49,18 @@ of the Engine is empty.</p>
</div> </div>
<h2>Instance Method Summary</h2> <h2>Instance Method Summary</h2>
<ul class='summary'> <ul class='summary'>
<li>
<span class='signature'>
<a href='#isDeleted-dynamic'>
#
(void)
<b>isDeleted</b><span>()</span>
</a>
</span>
<span class='desc'>
If isDeleted() is true this operation won&#39;t be maintained in the sl
</span>
</li>
<li> <li>
<span class='signature'> <span class='signature'>
<a href='#execute-dynamic'> <a href='#execute-dynamic'>
@ -78,21 +90,82 @@ of the Engine is empty.</p>
<small>Inherited Method Summary</small> <small>Inherited Method Summary</small>
<h3 class='inherited'> <h3 class='inherited'>
Methods inherited from Methods inherited from
<a href='../class/Insert.html'>Insert</a> <a href='../class/Operation.html'>Operation</a>
</h3> </h3>
<p class='inherited'> <p class='inherited'>
<a href='../class/Insert.html#applyDelete-dynamic'>#applyDelete</a>
<a href='../class/Insert.html#isDeleted-dynamic'>#isDeleted</a>
<a href='../class/Insert.html#getDistanceToOrigin-dynamic'>#getDistanceToOrigin</a>
<a href='../class/Insert.html#update_sl-dynamic'>#update_sl</a>
<a href='../class/Insert.html#execute-dynamic'>#execute</a>
<a href='../class/Operation.html#getUid-dynamic'>#getUid</a> <a href='../class/Operation.html#getUid-dynamic'>#getUid</a>
<a href='../class/Operation.html#execute-dynamic'>#execute</a>
<a href='../class/Operation.html#saveOperation-dynamic'>#saveOperation</a> <a href='../class/Operation.html#saveOperation-dynamic'>#saveOperation</a>
<a href='../class/Operation.html#validateSavedOperations-dynamic'>#validateSavedOperations</a> <a href='../class/Operation.html#validateSavedOperations-dynamic'>#validateSavedOperations</a>
</p> </p>
</h2> </h2>
<h2>Constructor Details</h2>
<div class='methods'>
<div class='method_details'>
<p class='signature' id='constructor-dynamic'>
#
(void)
<b>constructor</b><span>(uid, prev_cl, next_cl, origin)</span>
<br>
</p>
<div class='tags'>
<h3>Parameters:</h3>
<ul class='param'>
<li>
<span class='name'>uid</span>
<span class='type'>
(
<tt>Object</tt>
)
</span>
&mdash;
<span class='desc'>A unique identifier. If uid is undefined, a new uid will be created. </span>
</li>
<li>
<span class='name'>prev_cl</span>
<span class='type'>
(
<tt><a href='../class/Operation.html'>Operation</a></tt>
)
</span>
&mdash;
<span class='desc'>The predecessor of this operation in the complete-list (cl) </span>
</li>
<li>
<span class='name'>next_cl</span>
<span class='type'>
(
<tt><a href='../class/Operation.html'>Operation</a></tt>
)
</span>
&mdash;
<span class='desc'>The successor of this operation in the complete-list (cl) </span>
</li>
</ul>
<h3>See also:</h3>
<ul class='see'>
<li>
<a href='HistoryBuffer.getNextOperationIdentifier'>HistoryBuffer.getNextOperationIdentifier</a>
</li>
</ul>
</div>
</div>
</div>
<h2>Instance Method Details</h2> <h2>Instance Method Details</h2>
<div class='methods'> <div class='methods'>
<div class='method_details'>
<p class='signature' id='isDeleted-dynamic'>
#
(void)
<b>isDeleted</b><span>()</span>
<br>
</p>
<div class='docstring'>
<p>If isDeleted() is true this operation won&#39;t be maintained in the sl</p>
</div>
<div class='tags'>
</div>
</div>
<div class='method_details'> <div class='method_details'>
<p class='signature' id='execute-dynamic'> <p class='signature' id='execute-dynamic'>
# #
@ -118,7 +191,7 @@ of the Engine is empty.</p>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -49,6 +49,30 @@
<b>parseOperation</b><span>(json)</span> <b>parseOperation</b><span>(json)</span>
</a> </a>
</span> </span>
<span class='desc'>
Parses an operatio from the json format.
</span>
</li>
<li>
<span class='signature'>
<a href='#applyOpsBundle-dynamic'>
#
(void)
<b>applyOpsBundle</b><span>(ops_json)</span>
</a>
</span>
<span class='desc'>
Apply a set of operations.
</span>
</li>
<li>
<span class='signature'>
<a href='#applyOpsCheckDouble-dynamic'>
#
(void)
<b>applyOpsCheckDouble</b><span>(ops_json)</span>
</a>
</span>
<span class='desc'> <span class='desc'>
</span> </span>
</li> </li>
@ -61,6 +85,7 @@
</a> </a>
</span> </span>
<span class='desc'> <span class='desc'>
Apply a set of operations.
</span> </span>
</li> </li>
<li> <li>
@ -72,11 +97,7 @@
</a> </a>
</span> </span>
<span class='desc'> <span class='desc'>
<p>ops = [] for o in ops_json ops.push @parseOperation o Apply an operation that you received from another peer.
for o in ops @HB.addOperation o
for o in ops if not o.execute()
@unprocessed_ops.push o
@tryUnprocessed()</p>
</span> </span>
</li> </li>
<li> <li>
@ -88,6 +109,7 @@ for o in ops if not o.execute()
</a> </a>
</span> </span>
<span class='desc'> <span class='desc'>
Call this method when you applied a new operation.
</span> </span>
</li> </li>
</ul> </ul>
@ -112,6 +134,36 @@ for o in ops if not o.execute()
<b>parseOperation</b><span>(json)</span> <b>parseOperation</b><span>(json)</span>
<br> <br>
</p> </p>
<div class='docstring'>
<p>Parses an operatio from the json format. It uses the specified parser in your OperationType module.</p>
</div>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='applyOpsBundle-dynamic'>
#
(void)
<b>applyOpsBundle</b><span>(ops_json)</span>
<br>
</p>
<div class='docstring'>
<div class='note'>
<strong>Note:</strong>
You must not use this method when you already have ops in your HB!
</div>
<p>Apply a set of operations. E.g. the operations you received from another users HB.toJson().</p>
</div>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='applyOpsCheckDouble-dynamic'>
#
(void)
<b>applyOpsCheckDouble</b><span>(ops_json)</span>
<br>
</p>
</div> </div>
<div class='method_details'> <div class='method_details'>
@ -121,7 +173,17 @@ for o in ops if not o.execute()
<b>applyOps</b><span>(ops_json)</span> <b>applyOps</b><span>(ops_json)</span>
<br> <br>
</p> </p>
<div class='docstring'>
<p>Apply a set of operations. (Helper for using applyOp on Arrays)</p>
</div>
<div class='tags'>
<h3>See also:</h3>
<ul class='see'>
<li>
<a href='Engine.applyOp'>Engine.applyOp</a>
</li>
</ul>
</div>
</div> </div>
<div class='method_details'> <div class='method_details'>
<p class='signature' id='applyOp-dynamic'> <p class='signature' id='applyOp-dynamic'>
@ -131,12 +193,7 @@ for o in ops if not o.execute()
<br> <br>
</p> </p>
<div class='docstring'> <div class='docstring'>
<p>ops = [] <p>Apply an operation that you received from another peer.</p>
for o in ops_json ops.push @parseOperation o
for o in ops @HB.addOperation o
for o in ops if not o.execute()
@unprocessed_ops.push o
@tryUnprocessed()</p>
</div> </div>
<div class='tags'> <div class='tags'>
</div> </div>
@ -148,12 +205,17 @@ for o in ops if not o.execute()
<b>tryUnprocessed</b><span>()</span> <b>tryUnprocessed</b><span>()</span>
<br> <br>
</p> </p>
<div class='docstring'>
<p>Call this method when you applied a new operation.
It checks if operations that were previously not executable are now executable.</p>
</div>
<div class='tags'>
</div>
</div> </div>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -86,7 +86,7 @@
<a href='#_encode-dynamic'> <a href='#_encode-dynamic'>
# #
(void) (void)
<b>_encode</b><span>()</span> <b>_encode</b><span>(state_vector = {})</span>
</a> </a>
</span> </span>
<span class='desc'> <span class='desc'>
@ -206,7 +206,7 @@ This is why everybode must create the same operation with this uid.</p>
<p class='signature' id='_encode-dynamic'> <p class='signature' id='_encode-dynamic'>
# #
(void) (void)
<b>_encode</b><span>()</span> <b>_encode</b><span>(state_vector = {})</span>
<br> <br>
</p> </p>
@ -256,7 +256,7 @@ other operations (it wont executed)</p>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -156,7 +156,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -50,7 +50,6 @@ For the sake of efficiency we maintain two lists: - The short-list (abbrev. sl)
<h2>Direct Known Subclasses</h2> <h2>Direct Known Subclasses</h2>
<p class='children'> <p class='children'>
<a href='../class/ImmutableObject.html'>ImmutableObject</a> <a href='../class/ImmutableObject.html'>ImmutableObject</a>
<a href='../class/Delimiter.html'>Delimiter</a>
</p> </p>
<h2>Instance Method Summary</h2> <h2>Instance Method Summary</h2>
<ul class='summary'> <ul class='summary'>
@ -256,7 +255,7 @@ TODO (Unused)</p>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -50,17 +50,6 @@
</div> </div>
<h2>Instance Method Summary</h2> <h2>Instance Method Summary</h2>
<ul class='summary'> <ul class='summary'>
<li>
<span class='signature'>
<a href='#getRootElement-dynamic'>
#
(void)
<b>getRootElement</b><span>()</span>
</a>
</span>
<span class='desc'>
</span>
</li>
<li> <li>
<span class='signature'> <span class='signature'>
<a href='#send-dynamic'> <a href='#send-dynamic'>
@ -120,15 +109,6 @@
</div> </div>
<h2>Instance Method Details</h2> <h2>Instance Method Details</h2>
<div class='methods'> <div class='methods'>
<div class='method_details'>
<p class='signature' id='getRootElement-dynamic'>
#
(void)
<b>getRootElement</b><span>()</span>
<br>
</p>
</div>
<div class='method_details'> <div class='method_details'>
<p class='signature' id='send-dynamic'> <p class='signature' id='send-dynamic'>
# #
@ -168,7 +148,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -286,7 +286,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -121,7 +121,7 @@ console.log(w.newProperty == &quot;Awesome&quot;) # true!</code></pre>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -250,7 +250,7 @@ JsonYatta was initialized (Depending on the HistoryBuffer implementation).</p>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -208,7 +208,7 @@ Doesn&#39;t return left-right delimiter.</p>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -99,7 +99,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -46,6 +46,7 @@ val: in the case that the operation holds a value</p><p>Furthermore an encodable
<p class='children'> <p class='children'>
<a href='../class/Delete.html'>Delete</a> <a href='../class/Delete.html'>Delete</a>
<a href='../class/Insert.html'>Insert</a> <a href='../class/Insert.html'>Insert</a>
<a href='../class/Delimiter.html'>Delimiter</a>
</p> </p>
<h2>Instance Method Summary</h2> <h2>Instance Method Summary</h2>
<ul class='summary'> <ul class='summary'>
@ -284,7 +285,7 @@ an easy way to refer to these operations via an uid or object reference.</p><p>F
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -189,7 +189,7 @@ Each Replaceable holds a value that is now replaceable.</p><p>The Word-type has
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -191,7 +191,7 @@ This result can be send to other clients.</p>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -52,17 +52,6 @@
<span class='desc'> <span class='desc'>
</span> </span>
</li> </li>
<li>
<span class='signature'>
<a href='#getRootElement-dynamic'>
#
(void)
<b>getRootElement</b><span>()</span>
</a>
</span>
<span class='desc'>
</span>
</li>
<li> <li>
<span class='signature'> <span class='signature'>
<a href='#send-dynamic'> <a href='#send-dynamic'>
@ -152,15 +141,6 @@
<br> <br>
</p> </p>
</div>
<div class='method_details'>
<p class='signature' id='getRootElement-dynamic'>
#
(void)
<b>getRootElement</b><span>()</span>
<br>
</p>
</div> </div>
<div class='method_details'> <div class='method_details'>
<p class='signature' id='send-dynamic'> <p class='signature' id='send-dynamic'>
@ -219,7 +199,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -53,7 +53,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -173,7 +173,7 @@ This result can be send to other clients.</p>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -239,7 +239,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -233,7 +233,7 @@ to provide replace functionality.</p>
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -127,7 +127,7 @@
</a> </a>
<small class='parent'> <small class='parent'>
< <
Insert Operation
</small> </small>
<small class='namespace'> <small class='namespace'>

View File

@ -38,7 +38,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -62,7 +62,7 @@ There is also this awesome video on the Internet that will change your life <a h
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -103,7 +103,7 @@ window.onload = init
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -43,7 +43,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -84,7 +84,7 @@
</div> </div>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -39,7 +39,7 @@
</table> </table>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -58,7 +58,7 @@
</dl> </dl>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -68,7 +68,7 @@
</dl> </dl>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -60,7 +60,7 @@
</dl> </dl>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -58,7 +58,7 @@
</dl> </dl>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -39,7 +39,7 @@
</table> </table>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -39,7 +39,7 @@
</table> </table>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -39,7 +39,7 @@
</table> </table>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -39,7 +39,7 @@
</table> </table>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

View File

@ -39,7 +39,7 @@
</table> </table>
</div> </div>
<div id='footer'> <div id='footer'>
August 07, 14 21:48:38 by August 08, 14 04:37:31 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'> <a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo Codo
</a> </a>

File diff suppressed because one or more lines are too long

View File

@ -29,6 +29,14 @@
<input type='text'> <input type='text'>
</div> </div>
<ul> <ul>
<li>
<a href='class/ReplaceManager.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(ReplaceManager)
</small>
</li>
<li> <li>
<a href='class/Word.html#_encode-dynamic' target='main' title='_encode'> <a href='class/Word.html#_encode-dynamic' target='main' title='_encode'>
#_encode #_encode
@ -54,27 +62,11 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/ReplaceManager.html#_encode-dynamic' target='main' title='_encode'> <a href='class/Delimiter.html#_encode-dynamic' target='main' title='_encode'>
#_encode #_encode
</a> </a>
<small> <small>
(ReplaceManager) (Delimiter)
</small>
</li>
<li>
<a href='class/AddName.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(AddName)
</small>
</li>
<li>
<a href='class/JsonType.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(JsonType)
</small> </small>
</li> </li>
<li> <li>
@ -94,11 +86,11 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/Delimiter.html#_encode-dynamic' target='main' title='_encode'> <a href='class/AddName.html#_encode-dynamic' target='main' title='_encode'>
#_encode #_encode
</a> </a>
<small> <small>
(Delimiter) (AddName)
</small> </small>
</li> </li>
<li> <li>
@ -109,6 +101,14 @@
(ImmutableObject) (ImmutableObject)
</small> </small>
</li> </li>
<li>
<a href='class/JsonType.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(JsonType)
</small>
</li>
<li> <li>
<a href='class/HistoryBuffer.html#addOperation-dynamic' target='main' title='addOperation'> <a href='class/HistoryBuffer.html#addOperation-dynamic' target='main' title='addOperation'>
#addOperation #addOperation
@ -142,11 +142,27 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/JsonType.html#constructor-dynamic' target='main' title='constructor'> <a href='class/Engine.html#applyOpsBundle-dynamic' target='main' title='applyOpsBundle'>
#applyOpsBundle
</a>
<small>
(Engine)
</small>
</li>
<li>
<a href='class/Engine.html#applyOpsCheckDouble-dynamic' target='main' title='applyOpsCheckDouble'>
#applyOpsCheckDouble
</a>
<small>
(Engine)
</small>
</li>
<li>
<a href='class/ListManager.html#constructor-dynamic' target='main' title='constructor'>
#constructor #constructor
</a> </a>
<small> <small>
(JsonType) (ListManager)
</small> </small>
</li> </li>
<li> <li>
@ -166,27 +182,11 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/TestConnector.html#constructor-dynamic' target='main' title='constructor'> <a href='class/JsonType.html#constructor-dynamic' target='main' title='constructor'>
#constructor #constructor
</a> </a>
<small> <small>
(TestConnector) (JsonType)
</small>
</li>
<li>
<a href='class/TextInsert.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(TextInsert)
</small>
</li>
<li>
<a href='class/ReplaceManager.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(ReplaceManager)
</small> </small>
</li> </li>
<li> <li>
@ -198,11 +198,35 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/ListManager.html#constructor-dynamic' target='main' title='constructor'> <a href='class/JsonWrapper.html#constructor-dynamic' target='main' title='constructor'>
#constructor #constructor
</a> </a>
<small> <small>
(ListManager) (JsonWrapper)
</small>
</li>
<li>
<a href='class/AddName.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(AddName)
</small>
</li>
<li>
<a href='class/Delimiter.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Delimiter)
</small>
</li>
<li>
<a href='class/MapManager.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(MapManager)
</small> </small>
</li> </li>
<li> <li>
@ -214,11 +238,11 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/HistoryBuffer.html#constructor-dynamic' target='main' title='constructor'> <a href='class/ReplaceManager.html#constructor-dynamic' target='main' title='constructor'>
#constructor #constructor
</a> </a>
<small> <small>
(HistoryBuffer) (ReplaceManager)
</small> </small>
</li> </li>
<li> <li>
@ -230,11 +254,19 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/AddName.html#constructor-dynamic' target='main' title='constructor'> <a href='class/TextYatta.html#constructor-dynamic' target='main' title='constructor'>
#constructor #constructor
</a> </a>
<small> <small>
(AddName) (TextYatta)
</small>
</li>
<li>
<a href='class/Replaceable.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Replaceable)
</small> </small>
</li> </li>
<li> <li>
@ -253,14 +285,6 @@
(IwcConnector) (IwcConnector)
</small> </small>
</li> </li>
<li>
<a href='class/TextYatta.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(TextYatta)
</small>
</li>
<li> <li>
<a href='class/Operation.html#constructor-dynamic' target='main' title='constructor'> <a href='class/Operation.html#constructor-dynamic' target='main' title='constructor'>
#constructor #constructor
@ -270,27 +294,27 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/MapManager.html#constructor-dynamic' target='main' title='constructor'> <a href='class/TestConnector.html#constructor-dynamic' target='main' title='constructor'>
#constructor #constructor
</a> </a>
<small> <small>
(MapManager) (TestConnector)
</small> </small>
</li> </li>
<li> <li>
<a href='class/Replaceable.html#constructor-dynamic' target='main' title='constructor'> <a href='class/TextInsert.html#constructor-dynamic' target='main' title='constructor'>
#constructor #constructor
</a> </a>
<small> <small>
(Replaceable) (TextInsert)
</small> </small>
</li> </li>
<li> <li>
<a href='class/JsonWrapper.html#constructor-dynamic' target='main' title='constructor'> <a href='class/HistoryBuffer.html#constructor-dynamic' target='main' title='constructor'>
#constructor #constructor
</a> </a>
<small> <small>
(JsonWrapper) (HistoryBuffer)
</small> </small>
</li> </li>
<li> <li>
@ -318,27 +342,11 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/Operation.html#execute-dynamic' target='main' title='execute'> <a href='class/Delimiter.html#execute-dynamic' target='main' title='execute'>
#execute #execute
</a> </a>
<small> <small>
(Operation) (Delimiter)
</small>
</li>
<li>
<a href='class/AddName.html#execute-dynamic' target='main' title='execute'>
#execute
</a>
<small>
(AddName)
</small>
</li>
<li>
<a href='class/Replaceable.html#execute-dynamic' target='main' title='execute'>
#execute
</a>
<small>
(Replaceable)
</small> </small>
</li> </li>
<li> <li>
@ -350,11 +358,11 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/Delimiter.html#execute-dynamic' target='main' title='execute'> <a href='class/AddName.html#execute-dynamic' target='main' title='execute'>
#execute #execute
</a> </a>
<small> <small>
(Delimiter) (AddName)
</small> </small>
</li> </li>
<li> <li>
@ -365,6 +373,22 @@
(Insert) (Insert)
</small> </small>
</li> </li>
<li>
<a href='class/Replaceable.html#execute-dynamic' target='main' title='execute'>
#execute
</a>
<small>
(Replaceable)
</small>
</li>
<li>
<a href='class/Operation.html#execute-dynamic' target='main' title='execute'>
#execute
</a>
<small>
(Operation)
</small>
</li>
<li> <li>
<a href='class/TestConnector.html#flushAll-dynamic' target='main' title='flushAll'> <a href='class/TestConnector.html#flushAll-dynamic' target='main' title='flushAll'>
#flushAll #flushAll
@ -389,14 +413,6 @@
(TestConnector) (TestConnector)
</small> </small>
</li> </li>
<li>
<a href='class/TextYatta.html#getConnector-dynamic' target='main' title='getConnector'>
#getConnector
</a>
<small>
(TextYatta)
</small>
</li>
<li> <li>
<a href='class/JsonYatta.html#getConnector-dynamic' target='main' title='getConnector'> <a href='class/JsonYatta.html#getConnector-dynamic' target='main' title='getConnector'>
#getConnector #getConnector
@ -405,6 +421,14 @@
(JsonYatta) (JsonYatta)
</small> </small>
</li> </li>
<li>
<a href='class/TextYatta.html#getConnector-dynamic' target='main' title='getConnector'>
#getConnector
</a>
<small>
(TextYatta)
</small>
</li>
<li> <li>
<a href='class/Insert.html#getDistanceToOrigin-dynamic' target='main' title='getDistanceToOrigin'> <a href='class/Insert.html#getDistanceToOrigin-dynamic' target='main' title='getDistanceToOrigin'>
#getDistanceToOrigin #getDistanceToOrigin
@ -413,14 +437,6 @@
(Insert) (Insert)
</small> </small>
</li> </li>
<li>
<a href='class/TextYatta.html#getEngine-dynamic' target='main' title='getEngine'>
#getEngine
</a>
<small>
(TextYatta)
</small>
</li>
<li> <li>
<a href='class/JsonYatta.html#getEngine-dynamic' target='main' title='getEngine'> <a href='class/JsonYatta.html#getEngine-dynamic' target='main' title='getEngine'>
#getEngine #getEngine
@ -429,6 +445,14 @@
(JsonYatta) (JsonYatta)
</small> </small>
</li> </li>
<li>
<a href='class/TextYatta.html#getEngine-dynamic' target='main' title='getEngine'>
#getEngine
</a>
<small>
(TextYatta)
</small>
</li>
<li> <li>
<a href='class/ListManager.html#getFirstOperation-dynamic' target='main' title='getFirstOperation'> <a href='class/ListManager.html#getFirstOperation-dynamic' target='main' title='getFirstOperation'>
#getFirstOperation #getFirstOperation
@ -437,14 +461,6 @@
(ListManager) (ListManager)
</small> </small>
</li> </li>
<li>
<a href='class/JsonYatta.html#getHistoryBuffer-dynamic' target='main' title='getHistoryBuffer'>
#getHistoryBuffer
</a>
<small>
(JsonYatta)
</small>
</li>
<li> <li>
<a href='class/TextYatta.html#getHistoryBuffer-dynamic' target='main' title='getHistoryBuffer'> <a href='class/TextYatta.html#getHistoryBuffer-dynamic' target='main' title='getHistoryBuffer'>
#getHistoryBuffer #getHistoryBuffer
@ -453,6 +469,14 @@
(TextYatta) (TextYatta)
</small> </small>
</li> </li>
<li>
<a href='class/JsonYatta.html#getHistoryBuffer-dynamic' target='main' title='getHistoryBuffer'>
#getHistoryBuffer
</a>
<small>
(JsonYatta)
</small>
</li>
<li> <li>
<a href='class/ListManager.html#getLastOperation-dynamic' target='main' title='getLastOperation'> <a href='class/ListManager.html#getLastOperation-dynamic' target='main' title='getLastOperation'>
#getLastOperation #getLastOperation
@ -518,11 +542,11 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/IwcConnector.html#getRootElement-dynamic' target='main' title='getRootElement'> <a href='class/TextYatta.html#getRootElement-dynamic' target='main' title='getRootElement'>
#getRootElement #getRootElement
</a> </a>
<small> <small>
(IwcConnector) (TextYatta)
</small> </small>
</li> </li>
<li> <li>
@ -533,22 +557,6 @@
(JsonYatta) (JsonYatta)
</small> </small>
</li> </li>
<li>
<a href='class/TestConnector.html#getRootElement-dynamic' target='main' title='getRootElement'>
#getRootElement
</a>
<small>
(TestConnector)
</small>
</li>
<li>
<a href='class/TextYatta.html#getRootElement-dynamic' target='main' title='getRootElement'>
#getRootElement
</a>
<small>
(TextYatta)
</small>
</li>
<li> <li>
<a href='class/Operation.html#getUid-dynamic' target='main' title='getUid'> <a href='class/Operation.html#getUid-dynamic' target='main' title='getUid'>
#getUid #getUid
@ -557,14 +565,6 @@
(Operation) (Operation)
</small> </small>
</li> </li>
<li>
<a href='class/JsonYatta.html#getUserId-dynamic' target='main' title='getUserId'>
#getUserId
</a>
<small>
(JsonYatta)
</small>
</li>
<li> <li>
<a href='class/HistoryBuffer.html#getUserId-dynamic' target='main' title='getUserId'> <a href='class/HistoryBuffer.html#getUserId-dynamic' target='main' title='getUserId'>
#getUserId #getUserId
@ -582,11 +582,11 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/TextYatta.html#insertText-dynamic' target='main' title='insertText'> <a href='class/JsonYatta.html#getUserId-dynamic' target='main' title='getUserId'>
#insertText #getUserId
</a> </a>
<small> <small>
(TextYatta) (JsonYatta)
</small> </small>
</li> </li>
<li> <li>
@ -597,6 +597,22 @@
(Word) (Word)
</small> </small>
</li> </li>
<li>
<a href='class/TextYatta.html#insertText-dynamic' target='main' title='insertText'>
#insertText
</a>
<small>
(TextYatta)
</small>
</li>
<li>
<a href='class/Delimiter.html#isDeleted-dynamic' target='main' title='isDeleted'>
#isDeleted
</a>
<small>
(Delimiter)
</small>
</li>
<li> <li>
<a href='class/Insert.html#isDeleted-dynamic' target='main' title='isDeleted'> <a href='class/Insert.html#isDeleted-dynamic' target='main' title='isDeleted'>
#isDeleted #isDeleted
@ -717,14 +733,6 @@
(Word) (Word)
</small> </small>
</li> </li>
<li>
<a href='class/TestConnector.html#sync-dynamic' target='main' title='sync'>
#sync
</a>
<small>
(TestConnector)
</small>
</li>
<li> <li>
<a href='class/IwcConnector.html#sync-dynamic' target='main' title='sync'> <a href='class/IwcConnector.html#sync-dynamic' target='main' title='sync'>
#sync #sync
@ -733,6 +741,14 @@
(IwcConnector) (IwcConnector)
</small> </small>
</li> </li>
<li>
<a href='class/TestConnector.html#sync-dynamic' target='main' title='sync'>
#sync
</a>
<small>
(TestConnector)
</small>
</li>
<li> <li>
<a href='class/ListManager.html#toArray-dynamic' target='main' title='toArray'> <a href='class/ListManager.html#toArray-dynamic' target='main' title='toArray'>
#toArray #toArray
@ -758,11 +774,11 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/ImmutableObject.html#val-dynamic' target='main' title='val'> <a href='class/JsonType.html#val-dynamic' target='main' title='val'>
#val #val
</a> </a>
<small> <small>
(ImmutableObject) (JsonType)
</small> </small>
</li> </li>
<li> <li>
@ -773,22 +789,6 @@
(TextInsert) (TextInsert)
</small> </small>
</li> </li>
<li>
<a href='class/JsonType.html#val-dynamic' target='main' title='val'>
#val
</a>
<small>
(JsonType)
</small>
</li>
<li>
<a href='class/TextYatta.html#val-dynamic' target='main' title='val'>
#val
</a>
<small>
(TextYatta)
</small>
</li>
<li> <li>
<a href='class/Replaceable.html#val-dynamic' target='main' title='val'> <a href='class/Replaceable.html#val-dynamic' target='main' title='val'>
#val #val
@ -798,11 +798,19 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/MapManager.html#val-dynamic' target='main' title='val'> <a href='class/ImmutableObject.html#val-dynamic' target='main' title='val'>
#val #val
</a> </a>
<small> <small>
(MapManager) (ImmutableObject)
</small>
</li>
<li>
<a href='class/ReplaceManager.html#val-dynamic' target='main' title='val'>
#val
</a>
<small>
(ReplaceManager)
</small> </small>
</li> </li>
<li> <li>
@ -813,6 +821,14 @@
(JsonYatta) (JsonYatta)
</small> </small>
</li> </li>
<li>
<a href='class/TextYatta.html#val-dynamic' target='main' title='val'>
#val
</a>
<small>
(TextYatta)
</small>
</li>
<li> <li>
<a href='class/Word.html#val-dynamic' target='main' title='val'> <a href='class/Word.html#val-dynamic' target='main' title='val'>
#val #val
@ -822,11 +838,11 @@
</small> </small>
</li> </li>
<li> <li>
<a href='class/ReplaceManager.html#val-dynamic' target='main' title='val'> <a href='class/MapManager.html#val-dynamic' target='main' title='val'>
#val #val
</a> </a>
<small> <small>
(ReplaceManager) (MapManager)
</small> </small>
</li> </li>
<li> <li>

View File

@ -13,7 +13,6 @@ createIwcConnector = (callback)->
duiClient.initOK() duiClient.initOK()
root_element = null
received_HB = null received_HB = null
# #
@ -35,19 +34,15 @@ createIwcConnector = (callback)->
@receive o @receive o
@iwcHandler["Yatta_new_operation"] = [receive_] @iwcHandler["Yatta_new_operation"] = [receive_]
if root_element? if received_HB?
@engine.applyOps received_HB @engine.applyOpsCheckDouble received_HB
sendRootElement = ()=> sendHistoryBuffer = ()=>
json = { json = {
root_element : @yatta.getRootElement()
HB : @yatta.getHistoryBuffer()._encode() HB : @yatta.getHistoryBuffer()._encode()
} }
@sendIwcIntent "Yatta_push_root_element", json @sendIwcIntent "Yatta_push_HB_element", json
@iwcHandler["Yatta_get_root_element"] = [sendRootElement] @iwcHandler["Yatta_get_HB_element"] = [sendHistoryBuffer]
getRootElement: ()->
root_element
send: (o)-> send: (o)->
if o.uid.creator is @HB.getUserId() and (typeof o.uid.op_number isnt "string") if o.uid.creator is @HB.getUserId() and (typeof o.uid.op_number isnt "string")
@ -70,28 +65,27 @@ createIwcConnector = (callback)->
sync: ()-> sync: ()->
throw new Error "Can't use this a.t.m." throw new Error "Can't use this a.t.m."
get_root_intent = get_HB_intent =
action: "Yatta_get_root_element" action: "Yatta_get_HB_element"
component: "" component: ""
data: "" data: ""
dataType: "" dataType: ""
extras: {} extras: {}
init = ()-> init = ()->
duiClient.sendIntent(get_root_intent) duiClient.sendIntent(get_HB_intent)
is_initialized = false is_initialized = false
receiveRootElement = (json)-> receiveHB = (json)->
proposed_user_id = duiClient.getIwcClient()._componentName proposed_user_id = duiClient.getIwcClient()._componentName
root_element = json?.extras.root_element
received_HB = json?.extras.HB received_HB = json?.extras.HB
if not is_initialized if not is_initialized
is_initialized = true is_initialized = true
callback IwcConnector, proposed_user_id callback IwcConnector, proposed_user_id
iwcHandler["Yatta_push_root_element"] = [receiveRootElement] iwcHandler["Yatta_push_HB_element"] = [receiveHB]
setTimeout receiveRootElement, 800 setTimeout receiveHB, 0
setTimeout init, (Math.random()*4000) setTimeout init, (Math.random()*0)
undefined undefined
module.exports = createIwcConnector module.exports = createIwcConnector

View File

@ -24,10 +24,6 @@ module.exports = (user_list)->
getOpsInExecutionOrder: ()-> getOpsInExecutionOrder: ()->
@applied_operations @applied_operations
getRootElement: ()->
if user_list.length > 0
user_list[0].getRootElement().getUid()
send: (o)-> send: (o)->
if (o.uid.creator is @HB.getUserId()) and (typeof o.uid.op_number isnt "string") if (o.uid.creator is @HB.getUserId()) and (typeof o.uid.op_number isnt "string")
for user in user_list for user in user_list

View File

@ -6,6 +6,9 @@ class Engine
constructor: (@HB, @parser)-> constructor: (@HB, @parser)->
@unprocessed_ops = [] @unprocessed_ops = []
#
# Parses an operatio from the json format. It uses the specified parser in your OperationType module.
#
parseOperation: (json)-> parseOperation: (json)->
typeParser = @parser[json.type] typeParser = @parser[json.type]
if typeParser? if typeParser?
@ -13,10 +16,11 @@ class Engine
else else
throw new Error "You forgot to specify a parser for type #{json.type}. The message is #{JSON.stringify json}." throw new Error "You forgot to specify a parser for type #{json.type}. The message is #{JSON.stringify json}."
applyOps: (ops_json)-> #
for o in ops_json # Apply a set of operations. E.g. the operations you received from another users HB.toJson().
@applyOp o # @note You must not use this method when you already have ops in your HB!
### #
applyOpsBundle: (ops_json)->
ops = [] ops = []
for o in ops_json for o in ops_json
ops.push @parseOperation o ops.push @parseOperation o
@ -26,15 +30,36 @@ class Engine
if not o.execute() if not o.execute()
@unprocessed_ops.push o @unprocessed_ops.push o
@tryUnprocessed() @tryUnprocessed()
###
applyOpsCheckDouble: (ops_json)->
for o in ops_json
if @HB.getOperation(o.uid)?
@applyOp o
#
# Apply a set of operations. (Helper for using applyOp on Arrays)
# @see Engine.applyOp
applyOps: (ops_json)->
for o in ops_json
@applyOp o
#
# Apply an operation that you received from another peer.
#
applyOp: (op_json)-> applyOp: (op_json)->
# $parse_and_execute will return false if $o_json was parsed and executed, otherwise the parsed operadion # $parse_and_execute will return false if $o_json was parsed and executed, otherwise the parsed operadion
o = @parseOperation op_json o = @parseOperation op_json
@HB.addOperation o # @HB.addOperation o
if not o.execute() if not o.execute()
@unprocessed_ops.push o @unprocessed_ops.push o
else
@HB.addOperation o
@tryUnprocessed() @tryUnprocessed()
#
# Call this method when you applied a new operation.
# It checks if operations that were previously not executable are now executable.
#
tryUnprocessed: ()-> tryUnprocessed: ()->
while true while true
old_length = @unprocessed_ops.length old_length = @unprocessed_ops.length
@ -42,6 +67,8 @@ class Engine
for op in @unprocessed_ops for op in @unprocessed_ops
if not op.execute() if not op.execute()
unprocessed.push op unprocessed.push op
else
@HB.addOperation op
@unprocessed_ops = unprocessed @unprocessed_ops = unprocessed
if @unprocessed_ops.length is old_length if @unprocessed_ops.length is old_length
break break

View File

@ -42,12 +42,29 @@ class HistoryBuffer
res[user] = ctn res[user] = ctn
res res
_encode: ()-> _encode: (state_vector={})->
json = [] json = []
unknown = (user, o_number)->
if (not user?) or (not o_number?)
throw new Error "dah!"
not state_vector[user]? or state_vector[user] <= o_number
for u_name,user of @buffer for u_name,user of @buffer
for o_number,o of user for o_number,o of user
if not isNaN(parseInt(o_number)) if not isNaN(parseInt(o_number)) and unknown(u_name, o_number)
json.push o._encode() o_json = o._encode()
if o.next_cl?
o_next = o.next_cl
while o_next.next_cl? and unknown(o_next.creator, o_next.op_number)
o_next = o_next.next_cl
o_json.next = o_next.getUid()
else if o.prev_cl?
o_prev = o.prev_cl
while o_prev.prev_cl? and unknown(o_next.creator, o_next.op_number)
o_prev = o_prev.prev_cl
o_json.prev = o_prev.getUid()
json.push o_json
json json
# #

View File

@ -332,18 +332,48 @@ module.exports = (HB)->
# This is necessary in order to have a beginning and an end even if the content # This is necessary in order to have a beginning and an end even if the content
# of the Engine is empty. # of the Engine is empty.
# #
class Delimiter extends Insert class Delimiter extends Operation
#
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
# @param {Operation} prev_cl The predecessor of this operation in the complete-list (cl)
# @param {Operation} next_cl The successor of this operation in the complete-list (cl)
#
# @see HistoryBuffer.getNextOperationIdentifier
#
constructor: (uid, prev_cl, next_cl, origin)->
@saveOperation 'prev_cl', prev_cl
@saveOperation 'next_cl', next_cl
@saveOperation 'origin', prev_cl
super uid
#
# If isDeleted() is true this operation won't be maintained in the sl
#
isDeleted: ()->
false
# #
# @private # @private
# #
execute: ()-> execute: ()->
if @validateSavedOperations() if @unchecked?['next_cl']?
for l in execution_listener super
l @_encode() else if @unchecked?['prev_cl']
@ if @validateSavedOperations()
if @prev_cl.next_cl?
throw new Error "Probably duplicated operations"
@prev_cl.next_cl = @
delete @prev_cl.unchecked.next_cl
super
else
false
else if @prev_cl? and not @prev_cl.next_cl?
delete @prev_cl.unchecked.next_cl
@prev_cl.next_cl = @
else if @prev_cl? or @next_cl?
super
else else
false throw new Error "Delimiter is unsufficient defined!"
# #
# @private # @private

View File

@ -66,9 +66,9 @@ module.exports = (HB)->
uid_beg.op_number = "_#{uid_beg.op_number}_RM_#{@name}_beginning" uid_beg.op_number = "_#{uid_beg.op_number}_RM_#{@name}_beginning"
uid_end = @map_manager.getUid() uid_end = @map_manager.getUid()
uid_end.op_number = "_#{uid_end.op_number}_RM_#{@name}_end" uid_end.op_number = "_#{uid_end.op_number}_RM_#{@name}_end"
beg = HB.addOperation(new types.Delimiter uid_beg, undefined, uid_end) beg = HB.addOperation(new types.Delimiter uid_beg, undefined, uid_end).execute()
end = HB.addOperation(new types.Delimiter uid_end, beg, undefined).execute() end = HB.addOperation(new types.Delimiter uid_end, beg, undefined).execute()
beg.execute() #beg.execute()
@map_manager.map[@name] = HB.addOperation(new ReplaceManager undefined, uid_r, beg, end).execute() @map_manager.map[@name] = HB.addOperation(new ReplaceManager undefined, uid_r, beg, end).execute()
super super

View File

@ -98,7 +98,7 @@ module.exports = (HB)->
o = @getOperationByPosition position o = @getOperationByPosition position
for i in [0...length] for i in [0...length]
d = HB.addOperation(new TextDelete HB.getNextOperationIdentifier(), o).execute() d = HB.addOperation(new TextDelete undefined, o).execute()
o = o.next_cl o = o.next_cl
while o.isDeleted() while o.isDeleted()
if o instanceof types.Delimiter if o instanceof types.Delimiter
@ -115,7 +115,7 @@ module.exports = (HB)->
# #
replaceText: (text)-> replaceText: (text)->
if @replace_manager? if @replace_manager?
word = HB.addOperation(new Word HB.getNextOperationIdentifier()).execute() word = HB.addOperation(new Word undefined).execute()
word.insertText 0, text word.insertText 0, text
@replace_manager.replace(word) @replace_manager.replace(word)
else else

View File

@ -11,17 +11,17 @@ Yatta = require "../lib/Frameworks/JsonYatta.coffee"
Connector_uninitialized = require "../lib/Connectors/TestConnector.coffee" Connector_uninitialized = require "../lib/Connectors/TestConnector.coffee"
class Test class Test
constructor: ()-> constructor: (@name_suffix = "")->
@number_of_test_cases_multiplier = 1 @number_of_test_cases_multiplier = 1
@repeat_this = 1000 * @number_of_test_cases_multiplier @repeat_this = 5 * @number_of_test_cases_multiplier
@doSomething_amount = 5000 * @number_of_test_cases_multiplier @doSomething_amount = 1000 * @number_of_test_cases_multiplier
@number_of_engines = 10 + @number_of_test_cases_multiplier - 1 @number_of_engines = 10 + @number_of_test_cases_multiplier - 1
@time = 0 @time = 0
@ops = 0 @ops = 0
@time_now = 0 @time_now = 0
@debug = false @debug = true
@reinitialize() @reinitialize()
@ -30,8 +30,8 @@ class Test
@users = [] @users = []
@Connector = Connector_uninitialized @users @Connector = Connector_uninitialized @users
for i in [0...@number_of_engines] for i in [0...@number_of_engines]
@users.push(new Yatta i, @Connector) @users.push(new Yatta (i+@name_suffix), @Connector)
@users[0].val('name',"initial") @users[0].val('name',"i")
@flushAll() @flushAll()
getSomeUser: ()-> getSomeUser: ()->
@ -58,12 +58,12 @@ class Test
generateDeleteOp: (user_num)=> generateDeleteOp: (user_num)=>
if @users[user_num].val('name').val().length > 0 if @users[user_num].val('name').val().length > 0
pos = _.random 0, (@users[user_num].val('name').val().length-1) # TODO!!!! pos = _.random 0, (@users[user_num].val('name').val().length-1) # TODO!!!!
length = 1 # _.random 0, ot.val('name').length - pos TODO:!!! length = _.random 0, (@users[user_num].val('name').val().length - pos)
ops1 = @users[user_num].val('name').deleteText pos, length ops1 = @users[user_num].val('name').deleteText pos, length
undefined undefined
generateRandomOp: (user_num)=> generateRandomOp: (user_num)=>
op_gen = [@generateDeleteOp, @generateInsertOp]#, @generateReplaceOp] op_gen = [@generateInsertOp, @generateDeleteOp, @generateReplaceOp]
i = _.random (op_gen.length - 1) i = _.random (op_gen.length - 1)
op = op_gen[i](user_num) op = op_gen[i](user_num)
@ -94,19 +94,15 @@ class Test
ops_per_msek = Math.floor(@ops/@time) ops_per_msek = Math.floor(@ops/@time)
if test_number? if test_number?
console.log "#{test_number}/#{@repeat_this}: Every collaborator (#{@users.length}) applied #{number_of_created_operations} ops in a different order." + " Over all we consumed #{@ops} operations in #{@time/1000} seconds (#{ops_per_msek} ops/msek)." console.log "#{test_number}/#{@repeat_this}: Every collaborator (#{@users.length}) applied #{number_of_created_operations} ops in a different order." + " Over all we consumed #{@ops} operations in #{@time/1000} seconds (#{ops_per_msek} ops/msek)."
console.log @users.length
#console.log users[0].val('name').val() #console.log users[0].val('name').val()
for i in [0...(@users.length-1)] for i in [0...(@users.length-1)]
if not @debug if @debug
if (@users[i].val('name').val() isnt @users[i+1].val('name').val())
console.log "found error"
expect(@users[i].val('name').val()).to.equal(@users[i+1].val('name').val())
else
if ((@users[i].val('name').val() isnt @users[i+1].val('name').val()) )# and (number_of_created_operations <= 6 or true)) or found_error if ((@users[i].val('name').val() isnt @users[i+1].val('name').val()) )# and (number_of_created_operations <= 6 or true)) or found_error
printOpsInExecutionOrder = (otnumber, otherotnumber)=> printOpsInExecutionOrder = (otnumber, otherotnumber)=>
ops = @users[otnumber].getConnector().getOpsInExecutionOrder() ops = _.filter @users[otnumber].getConnector().getOpsInExecutionOrder(), (o)->
for s in ops typeof o.uid.op_name isnt 'string' and o.uid.creator isnt '_'
console.log JSON.stringify s for s,j in ops
console.log "op#{j} = " + (JSON.stringify s)
console.log "" console.log ""
s = "ops = [" s = "ops = ["
for o,j in ops for o,j in ops
@ -115,20 +111,23 @@ class Test
s += "op#{j}" s += "op#{j}"
s += "]" s += "]"
console.log s console.log s
console.log "@users[@last_user].ot.applyOps ops" console.log "@test_user.engine.applyOps ops"
console.log "expect(@users[@last_user].ot.val('name')).to.equal(\"#{@users[otherotnumber].val('name')}\")" console.log "expect(@test_user.val('name').val()).to.equal(\"#{@users[otherotnumber].val('name').val()}\")"
ops ops
console.log "" console.log ""
console.log "Found an OT Puzzle!" console.log "Found an OT Puzzle!"
console.log "OT states:" console.log "OT states:"
for u,j in @users for u,j in @users
console.log "OT#{j}: "+u.val('name') console.log "OT#{j}: "+u.val('name').val()
console.log "\nOT execution order (#{i},#{i+1}):" console.log "\nOT execution order (#{i},#{i+1}):"
printOpsInExecutionOrder i, i+1 printOpsInExecutionOrder i, i+1
console.log "" console.log ""
ops = printOpsInExecutionOrder i+1, i ops = printOpsInExecutionOrder i+1, i
console.log "" console.log ""
if (@users[i].val('name').val() isnt @users[i+1].val('name').val())
console.log "found error"
expect(@users[i].val('name').val()).to.equal(@users[i+1].val('name').val())
run: ()-> run: ()->
console.log '' console.log ''
@ -138,12 +137,22 @@ class Test
@doSomething() @doSomething()
@compareAll(times) @compareAll(times)
@reinitialize() @testHBencoding()
if times isnt @repeat_this
@reinitialize()
testHBencoding: ()->
user = new Yatta 'testuser', (Connector_uninitialized [])
user.engine.applyOps @users[0].HB._encode()
expect(user.value.name.val()).to.equal(@users[0].value.name.val())
describe "JsonYatta", -> describe "JsonYatta", ->
beforeEach (done)-> beforeEach (done)->
@timeout 50000 @timeout 50000
@yTest = new Test() @yTest = new Test()
@users = @yTest.users
@test_user = new Yatta 0, (Connector_uninitialized [])
done() done()
it "has a JsonWrapper", -> it "has a JsonWrapper", ->
@ -159,6 +168,20 @@ describe "JsonYatta", ->
expect(w.x).to.equal("dtrn") expect(w.x).to.equal("dtrn")
expect(w.set.x).to.equal("x") expect(w.set.x).to.equal("x")
it "handles double-late-join", ->
test = new Test("doubble")
test.run()
@yTest.run()
u1 = test.users[0]
u2 = @yTest.users[1]
ops1 = u1.HB._encode()
ops2 = u2.HB._encode()
u1.engine.applyOps ops2
u2.engine.applyOps ops1
expect(u2.value.name.val()).to.equal(u2.value.name.val())
it "can handle creaton of complex json", -> it "can handle creaton of complex json", ->
@yTest.getSomeUser().val('x', {'a':'b'}) @yTest.getSomeUser().val('x', {'a':'b'})
@yTest.getSomeUser().val('a', {'a':{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}}) @yTest.getSomeUser().val('a', {'a':{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}})
@ -183,6 +206,18 @@ describe "JsonYatta", ->
it "can handle many engines, many operations, concurrently (random)", -> it "can handle many engines, many operations, concurrently (random)", ->
@yTest.run() @yTest.run()
it "converges t1", ->
op0 = {"type":"Delimiter","uid":{"creator":0,"op_number":0},"next":{"creator":0,"op_number":1}}
op1 = {"type":"Delimiter","uid":{"creator":0,"op_number":1},"prev":{"creator":0,"op_number":0}}
op2 = {"type":"Word","uid":{"creator":0,"op_number":2},"beginning":{"creator":0,"op_number":0},"end":{"creator":0,"op_number":1}}
op3 = {"type":"AddName","uid":{"creator":0,"op_number":3},"map_manager":{"creator":"_","op_number":"_"},"name":"name"}
op4 = {"type":"Replaceable","content":{"creator":0,"op_number":2},"ReplaceManager":{"creator":"_","op_number":"___RM_name"},"prev":{"creator":"_","op_number":"___RM_name_beginning"},"next":{"creator":"_","op_number":"___RM_name_end"},"uid":{"creator":0,"op_number":4}}
op5 = {"type":"TextInsert","content":"u","uid":{"creator":1,"op_number":2},"prev":{"creator":1,"op_number":0},"next":{"creator":1,"op_number":1}}
op6 = {"type":"TextInsert","content":"w","uid":{"creator":2,"op_number":0},"prev":{"creator":0,"op_number":0},"next":{"creator":0,"op_number":1}}
op7 = {"type":"TextInsert","content":"d","uid":{"creator":1,"op_number":0},"prev":{"creator":0,"op_number":0},"next":{"creator":2,"op_number":0}}
op8 = {"type":"TextInsert","content":"a","uid":{"creator":1,"op_number":1},"prev":{"creator":1,"op_number":0},"next":{"creator":2,"op_number":0}}
ops = [op0, op1, op2, op3, op4, op5, op6, op7, op8]
@test_user.engine.applyOps ops
expect(@test_user.val('name').val()).to.equal("duaw")