Added cool json features (JsonWrapper)

This commit is contained in:
Kevin Jahns 2014-08-04 23:35:50 +02:00
parent 5ba735701c
commit 6c34d97432
72 changed files with 2237 additions and 889 deletions

View File

@ -77,8 +77,8 @@ module.exports = (grunt) ->
'dest/browser/Frameworks/JsonIwcYatta.js': ['./lib/Frameworks/JsonYatta.coffee', './lib/Connectors/IwcConnector.coffee']
options:
transform: ['coffeeify']
debug: false
bundleOptions: {debug: false}
debug: true
bundleOptions: {debug: true}
# Serve files via http-server
connect:
server:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -23,7 +23,7 @@
console.log("initialized!");
});
}
setTimeout(f, 1000)
setTimeout(f, 8000)
}
$(document).ready(init)
</script>

File diff suppressed because one or more lines are too long

View File

@ -50,7 +50,7 @@ createIwcConnector = function(callback) {
var json;
json = {
root_element: _this.yatta.getRootElement(),
HB: _this.yatta.getHistoryBuffer().toJson()
HB: _this.yatta.getHistoryBuffer()._encode()
};
return _this.sendIwcIntent("Yatta_push_root_element", json);
};
@ -122,7 +122,7 @@ createIwcConnector = function(callback) {
module.exports = createIwcConnector;
if (typeof window !== "undefined" && window !== null) {
window.createIwcConnector = createIwcConnector;
window.createConnector = createIwcConnector;
}
//# sourceMappingURL=IwcConnector.js.map

View File

@ -6,5 +6,5 @@
"IwcConnector.coffee"
],
"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,CAAA,SAAA,KAAA,GAAA;WAAA,SAAC,MAAD,GAAA;AAChB,UAAA,IAAA;AAAA,MAAA,OAAO,CAAC,GAAR,CAAa,uBAAA,GAAsB,CAAA,IAAI,CAAC,SAAL,CAAe,MAAf,CAAA,CAAnC,CAAA,CAAA;AAAA,MACA,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AAA,EAsEA,eAAA,GACE;AAAA,IAAA,MAAA,EAAQ,wBAAR;AAAA,IACA,SAAA,EAAW,EADX;AAAA,IAEA,IAAA,EAAM,EAFN;AAAA,IAGA,QAAA,EAAU,EAHV;AAAA,IAIA,MAAA,EAAQ,EAJR;GAvEF,CAAA;AAAA,EA6EA,IAAA,GAAO,SAAA,GAAA;AACL,QAAA,kCAAA;AAAA,IAAA,SAAS,CAAC,aAAV,CAAwB,eAAxB,CAAA,CAAA;AAAA,IAEA,cAAA,GAAiB,KAFjB,CAAA;AAAA,IAGA,kBAAA,GAAqB,SAAC,IAAD,GAAA;AACnB,MAAA,YAAA,kBAAe,IAAI,CAAE,MAAM,CAAC,qBAA5B,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,EAFF;OAHmB;IAAA,CAHrB,CAAA;AAAA,IASA,UAAW,CAAA,yBAAA,CAAX,GAAwC,CAAC,kBAAD,CATxC,CAAA;WAUA,UAAA,CAAW,kBAAX,EAA+B,IAA/B,EAXK;EAAA,CA7EP,CAAA;AAAA,EA0FA,UAAA,CAAW,IAAX,EAAiB,EAAjB,CA1FA,CAAA;SA4FA,OA7FmB;AAAA,CAArB,CAAA;;AAAA,MA8FM,CAAC,OAAP,GAAiB,kBA9FjB,CAAA;;;EA+FA,MAAM,CAAE,eAAR,GAA0B;CA/F1B"
}

View File

@ -24,7 +24,7 @@ module.exports = function(user_list) {
})(this);
this.execution_listener.push(appliedOperationsListener);
if (!((user_list != null ? user_list.length : void 0) === 0)) {
this.engine.applyOps(user_list[0].getHistoryBuffer().toJson());
this.engine.applyOps(user_list[0].getHistoryBuffer()._encode());
}
this.unexecuted = {};
}

View File

@ -6,5 +6,5 @@
"TestConnector.coffee"
],
"names": [],
"mappings": "AACA,IAAA,CAAA;;AAAA,CAAA,G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0B;OAA1B;aACA,IAAC,CAAA,UAAW,CAAA,CAAC,CAAC,OAAF,CAAU,CAAC,IAAvB,CAA4B,CAA5B,EAFO;IAAA,CA3BT,CAAA;;AAAA,4BA+BA,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,CA/BV,CAAA;;AAAA,4BAmCA,cAAA,GAAgB,SAAA,GAAA;aACd,IAAC,CAAA,QAAD,CAAW,CAAC,CAAC,MAAF,CAAS,CAAT,EAAa,SAAS,CAAC,MAAV,GAAiB,CAA9B,CAAX,EADc;IAAA,CAnChB,CAAA;;AAAA,4BAsCA,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,CAtCV,CAAA;;AAAA,4BA0CA,IAAA,GAAM,SAAA,GAAA;AACJ,YAAU,IAAA,KAAA,CAAM,uBAAN,CAAV,CADI;IAAA,CA1CN,CAAA;;yBAAA;;OANa;AAAA,CAFjB,CAAA"
}

View File

@ -34,10 +34,20 @@ Engine = (function() {
this.unprocessed_ops.push(o);
}
}
return this.cleanUp();
return this.tryUnprocessed();
};
Engine.prototype.cleanUp = function() {
Engine.prototype.applyOp = function(op_json) {
var o;
o = this.parseOperation(op_json);
this.HB.addOperation(o);
if (!o.execute()) {
this.unprocessed_ops.push(o);
}
return this.tryUnprocessed();
};
Engine.prototype.tryUnprocessed = function() {
var old_length, op, unprocessed, _i, _len, _ref, _results;
_results = [];
while (true) {
@ -60,16 +70,6 @@ Engine = (function() {
return _results;
};
Engine.prototype.applyOp = function(op_json) {
var o;
o = this.parseOperation(op_json);
this.HB.addOperation(o);
if (!o.execute()) {
this.unprocessed_ops.push(o);
}
return this.cleanUp();
};
return Engine;
})();

View File

@ -6,5 +6,5 @@
"Engine.coffee"
],
"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,CAAA;AACA,IAAA,IAAG,kBAAH;aACE,UAAA,CAAW,IAAX,EADF;KAAA,MAAA;AAGE,YAAU,IAAA,KAAA,CAAO,0CAAA,GAAyC,IAAI,CAAC,IAA9C,GAAoD,mBAApD,GAAsE,CAAA,IAAI,CAAC,SAAL,CAAe,IAAf,CAAA,CAAtE,GAA2F,GAAlG,CAAV,CAHF;KAFc;EAAA,CAHhB,CAAA;;AAAA,mBAUA,QAAA,GAAU,SAAC,QAAD,GAAA;AACR,QAAA,sCAAA;AAAA,IAAA,GAAA,GAAM,EAAN,CAAA;AACA,SAAA,+CAAA;uBAAA;AACE,MAAA,GAAG,CAAC,IAAJ,CAAS,IAAC,CAAA,cAAD,CAAgB,CAAhB,CAAT,CAAA,CADF;AAAA,KADA;AAGA,SAAA,4CAAA;kBAAA;AACE,MAAA,IAAC,CAAA,EAAE,CAAC,YAAJ,CAAiB,CAAjB,CAAA,CADF;AAAA,KAHA;AAKA,SAAA,4CAAA;kBAAA;AACE,MAAA,IAAG,CAAA,CAAK,CAAC,OAAF,CAAA,CAAP;AACE,QAAA,IAAC,CAAA,eAAe,CAAC,IAAjB,CAAsB,CA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,MAAA,IAAC,CAAA,eAAe,CAAC,IAAjB,CAAsB,CAAtB,CAAA,CADF;KAFA;WAIA,IAAC,CAAA,cAAD,CAAA,EANO;EAAA,CArBT,CAAA;;AAAA,mBA6BA,cAAA,GAAgB,SAAA,GAAA;AACd,QAAA,qDAAA;AAAA;WAAM,IAAN,GAAA;AACE,MAAA,UAAA,GAAa,IAAC,CAAA,eAAe,CAAC,MAA9B,CAAA;AAAA,MACA,WAAA,GAAc,EADd,CAAA;AAEA;AAAA,WAAA,2CAAA;sBAAA;AACE,QAAA,IAAG,CAAA,EAAM,CAAC,OAAH,CAAA,CAAP;AACE,UAAA,WAAW,CAAC,IAAZ,CAAiB,EAAjB,CAAA,CADF;SADF;AAAA,OAFA;AAAA,MAKA,IAAC,CAAA,eAAD,GAAmB,WALnB,CAAA;AAMA,MAAA,IAAG,IAAC,CAAA,eAAe,CAAC,MAAjB,KAA2B,UAA9B;AACE,cADF;OAAA,MAAA;8BAAA;OAPF;IAAA,CAAA;oBADc;EAAA,CA7BhB,CAAA;;gBAAA;;IADF,CAAA;;AAAA,MA4CM,CAAC,OAAP,GAAiB,MA5CjB,CAAA"
}

View File

@ -40,12 +40,20 @@ JsonYatta = (function() {
return this.HB;
};
JsonYatta.prototype.setMutableDefault = function(mutable) {
return this.root_element.setMutableDefault(mutable);
};
JsonYatta.prototype.getUserId = function() {
return this.HB.getUserId();
};
JsonYatta.prototype.val = function(name, content) {
return this.root_element.val(name, content);
JsonYatta.prototype.val = function(name, content, mutable) {
return this.root_element.val(name, content, mutable);
};
JsonYatta.prototype.value = function() {
return this.root_element.value;
};
return JsonYatta;

View File

@ -6,5 +6,5 @@
"JsonYatta.coffee"
],
"names": [],
"mappings": "AACA,IAAA,0DAAA;;AAAA,wBAAA,GAA2B,OAAA,CAAQ,2BAAR,CAA3B,CAAA;;AAAA,aACA,GAAgB,OAAA,CAAQ,yBAAR,CADhB,CAAA;;AAAA,MAEA,GAAS,OAAA,CAAQ,kBAAR,CAFT,CA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AZF,CAAA;;;EA4EA,MAAM,CAAE,SAAR,GAAoB;CA5EpB;;AAAA,MA6EM,CAAC,OAAP,GAAiB,SA7EjB,CAAA"
}

View File

@ -23,7 +23,7 @@ HistoryBuffer = (function() {
return res;
};
HistoryBuffer.prototype.toJson = function() {
HistoryBuffer.prototype._encode = function() {
var json, o, o_number, u_name, user, _ref;
json = [];
_ref = this.buffer;
@ -32,7 +32,7 @@ HistoryBuffer = (function() {
for (o_number in user) {
o = user[o_number];
if (!isNaN(parseInt(o_number))) {
json.push(o.toJson());
json.push(o._encode());
}
}
}

View File

@ -6,5 +6,5 @@
"HistoryBuffer.coffee"
],
"names": [],
"mappings": "AAMA,IAAA,aAAA;;AAAA;AAMe,EAAA,uBAAE,OAAF,GAAA;AACX,IADY,IAAC,CAAA,UAAA,OACb,CAAA;AAAA,IAAA,IAAC,CAAA,iBAAD,GAAqB,EAArB,CAAA;AAAA,IACA,IAAC,CAAA,MAAD,GAAU,EADV,CAAA;AAAA,IAEA,IAAC,CAAA,gBAAD,GAAoB,EAFpB,CADW;EAAA,CAAb;;AAAA,0BAQA,SAAA,GAAW,SAAA,GAAA;WACT,IAAC,CAAA,QADQ;EAAA,CARX,CAAA;;AAAA,0BAcA,mBAAA,GAAqB,SAAA,GAAA;AACnB,QAAA,oBAAA;AAAA,IAAA,GAAA,GAAM,EAAN,CAAA;AACA;AAAA,SAAA,YAAA;uBAAA;AACE,MAAA,GAAI,CAAA,IAAA,CAAJ,GAAY,GAAZ,CADF;AAAA,KADA;WAGA,IAJmB;EAAA,CAdrB,CAAA;;AAAA,0BAoBA,MAAA,GAAQ,SAAA,GAAA;AACN,QAAA,qCAAA;AAAA,IAAA,IAAA,GAAO,EAAP,CAAA;AACA;AAAA,SAAA,cAAA;0BAAA;AACE,WAAA,gBAAA;2BAAA;AACE,QAAA,IAAG,CAAA,KAAI,CAAM,QAAA,CAAS,QAAT,CAAN,CAAP;AACE,UAAA,IAAI,CAAC,IAAL,CAAU,CAAC,CAAC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,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,CAvDd,CAAA;;uBAAA;;IANF,CAAA;;AAAA,MA2EM,CAAC,OAAP,GAAiB,aA3EjB,CAAA"
}

View File

@ -2,11 +2,14 @@ var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
module.exports = function(HB) {
var Delete, Delimiter, Insert, Operation, execution_listener, parser;
var Delete, Delimiter, ImmutableObject, Insert, Operation, execution_listener, parser;
parser = {};
execution_listener = [];
Operation = (function() {
function Operation(uid) {
if (uid == null) {
uid = HB.getNextOperationIdentifier();
}
this.creator = uid['creator'], this.op_number = uid['op_number'];
}
@ -22,7 +25,7 @@ module.exports = function(HB) {
this.is_executed = true;
for (_i = 0, _len = execution_listener.length; _i < _len; _i++) {
l = execution_listener[_i];
l(this.toJson());
l(this._encode());
}
return this;
};
@ -71,7 +74,7 @@ module.exports = function(HB) {
Delete.__super__.constructor.call(this, uid);
}
Delete.prototype.toJson = function() {
Delete.prototype._encode = function() {
return {
'type': "Delete",
'uid': this.getUid(),
@ -212,13 +215,48 @@ module.exports = function(HB) {
}
};
Insert.prototype.val = function() {
throw new Error("Implement this function!");
};
return Insert;
})(Operation);
ImmutableObject = (function(_super) {
__extends(ImmutableObject, _super);
function ImmutableObject(uid, content, prev, next, origin) {
this.content = content != null ? content : "";
ImmutableObject.__super__.constructor.call(this, uid, prev, next, origin);
}
ImmutableObject.prototype.val = function() {
return this.content;
};
ImmutableObject.prototype._encode = function() {
var json;
json = {
'type': "ImmutableObject",
'uid': this.getUid(),
'content': this.content
};
if (this.prev_cl != null) {
json['prev'] = this.prev_cl.getUid();
}
if (this.next_cl != null) {
json['next'] = this.next_cl.getUid();
}
if ((this.origin != null) && this.origin !== this.prev_cl) {
json["origin"] = this.origin.getUid();
}
return json;
};
return ImmutableObject;
})(Insert);
parser['ImmutableObject'] = function(json) {
var content, next, origin, prev, uid;
uid = json['uid'], content = json['content'], prev = json['prev'], next = json['next'], origin = json['origin'];
return new ImmutableObject(uid, content, prev, next, origin);
};
Delimiter = (function(_super) {
__extends(Delimiter, _super);
@ -226,20 +264,12 @@ module.exports = function(HB) {
return Delimiter.__super__.constructor.apply(this, arguments);
}
Delimiter.prototype.isDeleted = function() {
return false;
};
Delimiter.prototype.getDistanceToOrigin = function() {
return 0;
};
Delimiter.prototype.execute = function() {
var l, _i, _len;
if (this.validateSavedOperations()) {
for (_i = 0, _len = execution_listener.length; _i < _len; _i++) {
l = execution_listener[_i];
l(this.toJson());
l(this._encode());
}
return this;
} else {
@ -247,7 +277,7 @@ module.exports = function(HB) {
}
};
Delimiter.prototype.toJson = function() {
Delimiter.prototype._encode = function() {
var _ref, _ref1;
return {
'type': "Delimiter",
@ -270,7 +300,8 @@ module.exports = function(HB) {
'Delete': Delete,
'Insert': Insert,
'Delimiter': Delimiter,
'Operation': Operation
'Operation': Operation,
'ImmutableObject': ImmutableObject
},
'parser': parser,
'execution_listener': execution_listener

File diff suppressed because one or more lines are too long

View File

@ -5,14 +5,62 @@ var text_types_uninitialized,
text_types_uninitialized = require("./TextTypes.coffee");
module.exports = function(HB) {
var JsonType, parser, text_types, types;
var JsonType, createJsonWrapper, parser, text_types, types;
text_types = text_types_uninitialized(HB);
types = text_types.types;
parser = text_types.parser;
createJsonWrapper = function(_jsonType) {
var JsonWrapper;
JsonWrapper = (function() {
function JsonWrapper(jsonType) {
var name, obj, _fn, _ref;
_ref = jsonType.map;
_fn = function(name, obj) {
return Object.defineProperty(JsonWrapper.prototype, name, {
get: function() {
var x;
x = obj.val();
if (x instanceof JsonType) {
return createJsonWrapper(x);
} else if (x instanceof types.ImmutableObject) {
return x.val();
} else {
return x;
}
},
set: function(o) {
var o_name, o_obj, overwrite, _results;
if (o.constructor === {}.constructor) {
overwrite = jsonType.val(name);
_results = [];
for (o_name in o) {
o_obj = o[o_name];
_results.push(overwrite.val(o_name, o_obj, 'immutable'));
}
return _results;
} else {
return jsonType.val(name, o, 'immutable');
}
},
enumerable: true,
configurable: false
});
};
for (name in _ref) {
obj = _ref[name];
_fn(name, obj);
}
}
return JsonWrapper;
})();
return new JsonWrapper(_jsonType);
};
JsonType = (function(_super) {
__extends(JsonType, _super);
function JsonType(uid, initial_value) {
function JsonType(uid, initial_value, mutable) {
var name, o;
JsonType.__super__.constructor.call(this, uid);
if (initial_value != null) {
@ -21,30 +69,83 @@ module.exports = function(HB) {
}
for (name in initial_value) {
o = initial_value[name];
this.val(name, o);
this.val(name, o, mutable);
}
}
}
JsonType.prototype.val = function(name, content) {
var json, word;
if ((name != null) && (content != null)) {
if (typeof content === 'string') {
word = HB.addOperation(new types.Word(HB.getNextOperationIdentifier(), content)).execute();
JsonType.__super__.val.call(this, name, word);
} else if (typeof content === 'object') {
json = HB.addOperation(JsonType(HB.getNextOperationIdentifier(), content)).execute();
JsonType.__super__.val.call(this, name, json);
} else {
throw new Error("You must not set " + (typeof content) + "-types in collaborative Json-objects!");
JsonType.prototype.mutable_default = true;
JsonType.prototype.setMutableDefault = function(mutable) {
if (mutable === true || mutable === 'mutable') {
JsonType.prototype.mutable_default = true;
} else if (mutable === false || mutable === 'immutable') {
JsonType.prototype.mutable_default = false;
} else {
throw new Error('Set mutable either "mutable" or "immutable"!');
}
return 'OK';
};
JsonType.prototype.val = function(name, content, mutable) {
var json, o, o_name, obj, word;
if (typeof name === 'object') {
for (o_name in name) {
o = name[o_name];
this.val(o_name, o, content);
}
return this;
} else if ((name != null) && (content != null)) {
if (mutable != null) {
if (mutable === true || mutable === 'mutable') {
mutable = true;
} else {
mutable = false;
}
} else {
mutable = this.mutable_default;
}
if (typeof content === 'function') {
return this;
} else if (((!mutable) || typeof content === 'number') && content.constructor !== Object) {
obj = HB.addOperation(new types.ImmutableObject(void 0, content)).execute();
return JsonType.__super__.val.call(this, name, obj);
} else {
if (typeof content === 'string') {
word = HB.addOperation(new types.Word(HB.getNextOperationIdentifier(), content)).execute();
return JsonType.__super__.val.call(this, name, word);
} else if (content.constructor === Object) {
json = HB.addOperation(new JsonType(HB.getNextOperationIdentifier(), content, mutable)).execute();
return JsonType.__super__.val.call(this, name, json);
} else {
throw new Error("You must not set " + (typeof content) + "-types in collaborative Json-objects!");
}
}
} else {
return JsonType.__super__.val.call(this, name, content);
}
};
JsonType.prototype.toJson = function() {
Object.defineProperty(JsonType.prototype, 'value', {
get: function() {
return createJsonWrapper(this);
},
set: function(o) {
var o_name, o_obj, _results;
if (o.constructor === {}.constructor) {
_results = [];
for (o_name in o) {
o_obj = o[o_name];
_results.push(this.val(o_name, o_obj, 'immutable'));
}
return _results;
} else {
throw new Error("You must only set Object values!");
}
}
});
JsonType.prototype._encode = function() {
return {
'type': "JsonType",
'uid': this.getUid()

View File

@ -6,5 +6,5 @@
"JsonTypes.coffee"
],
"names": [],
"mappings": "AAAA,IAAA,wBAAA;EAAA;iSAAA;;AAAA,wBAAA,GAA2B,OAAA,CAAQ,oBAAR,CAA3B,CAAA;;AAAA,MAEM,CAAC,OAAP,GAAiB,SAAC,EAAD,GAAA;AACf,MAAA,mCAAA;AAAA,EAAA,UAAA,GAAa,wBAAA,CAAyB,EAAzB,CAAb,CAAA;AAAA,EACA,KAAA,GAAQ,UAAU,CAAC,KADnB,CAAA;AAAA,EAEA,MAAA,GAAS,UAAU,CAAC,MAFpB,CAAA;AAAA,EAOM;AACJ,+BAAA,CAAA;;AAAa,IAAA,kBAAC,GAAD,EAAM,aAAN,GAAA;AACX,UAAA,OAAA;AAAA,MAAA,0CAAM,GAAN,CAAA,CAAA;AACA,MAAA,IAAG,qBAAH;AACE,QAAA,IAAG,MAAA,CAAA,aAAA,KAA0B,QAA7B;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AQ,IAAC,CAAA,MAAD,CAAA,CAFV;QADO;IAAA,CAhFT,CAAA;;oBAAA;;KAPqB,KAAK,CAAC,WAzF7B,CAAA;AAAA,EAsLA,MAAO,CAAA,UAAA,CAAP,GAAqB,SAAC,IAAD,GAAA;AACnB,QAAA,GAAA;AAAA,IACU,MACN,KADF,MADF,CAAA;WAGI,IAAA,QAAA,CAAS,GAAT,EAJe;EAAA,CAtLrB,CAAA;AAAA,EA+LA,KAAM,CAAA,UAAA,CAAN,GAAoB,QA/LpB,CAAA;SAiMA,WAlMe;AAAA,CAFjB,CAAA"
}

View File

@ -18,20 +18,30 @@ module.exports = function(HB) {
}
MapManager.prototype.val = function(name, content) {
var o, result, _ref, _ref1;
var o, obj, result, _ref, _ref1;
if (content != null) {
if (this.map[name] == null) {
HB.addOperation(new AddName(HB.getNextOperationIdentifier(), this, name)).execute();
}
return this.map[name].replace(content);
this.map[name].replace(content);
return this;
} else if (name != null) {
return (_ref = this.map[name]) != null ? _ref.val() : void 0;
obj = (_ref = this.map[name]) != null ? _ref.val() : void 0;
if (obj instanceof types.ImmutableObject) {
return obj.val();
} else {
return obj;
}
} else {
result = {};
_ref1 = this.map;
for (name in _ref1) {
o = _ref1[name];
result[name] = o.val();
obj = o.val();
if (obj instanceof types.ImmutableObject || obj instanceof MapManager) {
obj = obj.val();
}
result[name] = obj;
}
return result;
}
@ -70,7 +80,7 @@ module.exports = function(HB) {
}
};
AddName.prototype.toJson = function() {
AddName.prototype._encode = function() {
return {
'type': "AddName",
'uid': this.getUid(),
@ -172,7 +182,7 @@ module.exports = function(HB) {
return o.val();
};
ReplaceManager.prototype.toJson = function() {
ReplaceManager.prototype._encode = function() {
var json;
json = {
'type': "ReplaceManager",
@ -231,7 +241,7 @@ module.exports = function(HB) {
}
};
Replaceable.prototype.toJson = function() {
Replaceable.prototype._encode = function() {
var json;
json = {
'type': "Replaceable",

File diff suppressed because one or more lines are too long

View File

@ -47,7 +47,7 @@ module.exports = function(HB) {
}
};
TextInsert.prototype.toJson = function() {
TextInsert.prototype._encode = function() {
var json;
json = {
'type': "TextInsert",
@ -105,7 +105,7 @@ module.exports = function(HB) {
}
o = o.next_cl;
}
_results.push(d.toJson());
_results.push(d._encode());
}
return _results;
};
@ -145,7 +145,7 @@ module.exports = function(HB) {
return this.validateSavedOperations;
};
Word.prototype.toJson = function() {
Word.prototype._encode = function() {
var json;
json = {
'type': "Word",

View File

@ -6,5 +6,5 @@
"TextTypes.coffee"
],
"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,6DAAA;AAAA,EAAA,gBAAA,GAAmB,8BAAA,CAA+B,EAA/B,CAAnB,CAAA;AAAA,EACA,KAAA,GAAQ,gBAAgB,CAAC,KADzB,CAAA;AAAA,EAEA,MAAA,GAAS,gBAAgB,CAAC,MAF1B,CAAA;AAAA,EAQM;AAAN,iCAAA,CAAA;;;;KAAA;;sBAAA;;KAAyB,KAAK,CAAC,OAR/B,CAAA;AAAA,EASA,MAAO,CAAA,YAAA,CAAP,GAAuB,MAAO,CAAA,QAAA,CAT9B,CAAA;AAAA,EAcM;AACJ,iCAAA,CAAA;;AAAa,IAAA,oBAAE,OAAF,EAAW,GAAX,EAAgB,IAAhB,EAAsB,IAAtB,EAA4B,MAA5B,GAAA;AACX,MADY,IAAC,CAAA,UAAA,OACb,CAAA;AAAA,MAAA,IAAG,CAAA,CAAK,cAAA,IAAU,cAAX,CAAP;AACE,cAAU,IAAA,KAAA,CAAM,sDAAN,CAAV,CADF;OAAA;AAAA,MAEA,4CAAM,GAAN,EAAW,IAAX,EAAiB,IAAjB,EAAuB,MAAvB,CAFA,CADW;IAAA,CAAb;;AAAA,yBAOA,SAAA,GAAW,SAAA,GAAA;AACT,MAAA,IAAG,IAAC,CAAA,SAAD,CAAA,CAAH;eACE,EADF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AC,MAAR,CAAA,CAAjB,CADF;OAVA;aAYA,KAbO;IAAA,CA9DT,CAAA;;gBAAA;;KANiB,KAAK,CAAC,YAzEzB,CAAA;AAAA,EA4JA,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,MAAV,EAAqB,SAArB,EAAgC,GAAhC,EAAqC,IAArC,EAA2C,IAA3C,EAAiD,MAAjD,EATW;EAAA,CA5JjB,CAAA;AAAA,EAuKA,KAAM,CAAA,YAAA,CAAN,GAAsB,UAvKtB,CAAA;AAAA,EAwKA,KAAM,CAAA,YAAA,CAAN,GAAsB,UAxKtB,CAAA;AAAA,EAyKA,KAAM,CAAA,MAAA,CAAN,GAAgB,IAzKhB,CAAA;SA0KA,iBA3Ke;AAAA,CAFjB,CAAA"
}

View File

@ -6,5 +6,5 @@
"XmlTypes.coffee"
],
"names": [],
"mappings": "AAqKkB"
"mappings": "AA6KkB"
}

View File

@ -28,11 +28,12 @@
this.generateReplaceOp = __bind(this.generateReplaceOp, this);
this.generateInsertOp = __bind(this.generateInsertOp, this);
this.number_of_test_cases_multiplier = 1;
this.repeat_this = 100 * this.number_of_test_cases_multiplier;
this.repeat_this = 10 * this.number_of_test_cases_multiplier;
this.doSomething_amount = 200 * this.number_of_test_cases_multiplier;
this.number_of_engines = 12 + this.number_of_test_cases_multiplier - 1;
this.time = 0;
this.ops = 0;
this.time_now = 0;
this.reinitialize();
}
@ -49,6 +50,12 @@
return _results;
};
Test.prototype.getSomeUser = function() {
var i;
i = _.random(0, this.users.length - 1);
return this.users[i];
};
Test.prototype.getRandomText = function() {
var chars, length, nextchar, text;
chars = "abcdefghijklmnopqrstuvwxyz";
@ -115,69 +122,74 @@
return _results;
};
Test.prototype.compareAll = function(test_number) {
var i, j, number_of_created_operations, ops, ops_per_msek, printOpsInExecutionOrder, u, _i, _j, _k, _len, _ref, _ref1, _results;
this.flushAll();
this.time += (new Date()).getTime() - this.time_now;
number_of_created_operations = 0;
for (i = _i = 0, _ref = this.users.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
number_of_created_operations += this.users[i].getConnector().getOpsInExecutionOrder().length;
}
this.ops += number_of_created_operations * this.users.length;
ops_per_msek = Math.floor(this.ops / this.time);
if (test_number != null) {
console.log(("" + test_number + "/" + this.repeat_this + ": Every collaborator (" + this.users.length + ") applied " + this.number_of_created_operations + " ops in a different order.") + (" Over all we consumed " + this.ops + " operations in " + (this.time / 1000) + " seconds (" + ops_per_msek + " ops/msek)."));
}
_results = [];
for (i = _j = 0, _ref1 = this.users.length - 1; 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
if (this.users[i].val('name').val() !== this.users[i + 1].val('name').val()) {
printOpsInExecutionOrder = function(otnumber, otherotnumber) {
var j, o, ops, s, _k, _l, _len, _len1;
ops = this.users[otnumber].getConnector().getOpsInExecutionOrder();
for (_k = 0, _len = ops.length; _k < _len; _k++) {
s = ops[_k];
console.log(JSON.stringify(s));
}
console.log("");
s = "ops = [";
for (j = _l = 0, _len1 = ops.length; _l < _len1; j = ++_l) {
o = ops[j];
if (j !== 0) {
s += ", ";
}
s += "op" + j;
}
s += "]";
console.log(s);
console.log("@users[@last_user].ot.applyOps ops");
console.log("expect(@users[@last_user].ot.val('name')).to.equal(\"" + (users[otherotnumber].val('name')) + "\")");
return ops;
};
console.log("");
console.log("Found an OT Puzzle!");
console.log("OT states:");
for (j = _k = 0, _len = users.length; _k < _len; j = ++_k) {
u = users[j];
console.log(("OT" + j + ": ") + u.val('name'));
}
console.log("\nOT execution order (" + i + "," + (i + 1) + "):");
printOpsInExecutionOrder(i, i + 1);
console.log("");
ops = printOpsInExecutionOrder(i + 1, i);
_results.push(console.log(""));
} else {
_results.push(void 0);
}
}
return _results;
};
Test.prototype.run = function() {
var i, j, number_of_created_operations, ops, ops_per_msek, printOpsInExecutionOrder, time_now, times, u, _i, _j, _k, _ref, _ref1, _ref2, _results;
var i, times, _i, _j, _ref, _ref1, _results;
console.log('');
_results = [];
for (times = _i = 1, _ref = this.repeat_this; 1 <= _ref ? _i <= _ref : _i >= _ref; times = 1 <= _ref ? ++_i : --_i) {
this.reinitialize();
time_now = (new Date).getTime();
this.time_now = (new Date).getTime();
for (i = _j = 1, _ref1 = this.doSomething_amount; 1 <= _ref1 ? _j <= _ref1 : _j >= _ref1; i = 1 <= _ref1 ? ++_j : --_j) {
this.doSomething();
}
this.flushAll();
this.time += (new Date()).getTime() - time_now;
number_of_created_operations = 0;
for (i = _k = 0, _ref2 = this.users.length; 0 <= _ref2 ? _k < _ref2 : _k > _ref2; i = 0 <= _ref2 ? ++_k : --_k) {
number_of_created_operations += this.users[i].getConnector().getOpsInExecutionOrder().length;
}
this.ops += number_of_created_operations * this.users.length;
ops_per_msek = Math.floor(this.ops / this.time);
console.log(("" + times + "/" + this.repeat_this + ": Every collaborator (" + this.users.length + ") applied " + this.number_of_created_operations + " ops in a different order.") + (" Over all we consumed " + this.ops + " operations in " + (this.time / 1000) + " seconds (" + ops_per_msek + " ops/msek)."));
_results.push((function() {
var _l, _len, _m, _ref3, _results1;
_results1 = [];
for (i = _l = 0, _ref3 = this.users.length - 1; 0 <= _ref3 ? _l < _ref3 : _l > _ref3; i = 0 <= _ref3 ? ++_l : --_l) {
if (this.users[i].val('name').val() !== this.users[i + 1].val('name').val()) {
printOpsInExecutionOrder = function(otnumber, otherotnumber) {
var j, o, ops, s, _len, _len1, _m, _n;
ops = this.users[otnumber].getConnector().getOpsInExecutionOrder();
for (_m = 0, _len = ops.length; _m < _len; _m++) {
s = ops[_m];
console.log(JSON.stringify(s));
}
console.log("");
s = "ops = [";
for (j = _n = 0, _len1 = ops.length; _n < _len1; j = ++_n) {
o = ops[j];
if (j !== 0) {
s += ", ";
}
s += "op" + j;
}
s += "]";
console.log(s);
console.log("@users[@last_user].ot.applyOps ops");
console.log("expect(@users[@last_user].ot.val('name')).to.equal(\"" + (users[otherotnumber].val('name')) + "\")");
return ops;
};
console.log("");
console.log("Found an OT Puzzle!");
console.log("OT states:");
for (j = _m = 0, _len = users.length; _m < _len; j = ++_m) {
u = users[j];
console.log(("OT" + j + ": ") + u.val('name'));
}
console.log("\nOT execution order (" + i + "," + (i + 1) + "):");
printOpsInExecutionOrder(i, i + 1);
console.log("");
ops = printOpsInExecutionOrder(i + 1, i);
_results1.push(console.log(""));
} else {
_results1.push(void 0);
}
}
return _results1;
}).call(this));
this.compareAll(times);
_results.push(this.reinitialize());
}
return _results;
};
@ -187,10 +199,58 @@
})();
describe("JsonYatta", function() {
beforeEach(function(done) {
this.yTest = new Test();
return done();
});
it("has a JsonWrapper", function() {
var w, y;
y = this.yTest.getSomeUser().root_element;
y.val('x', "dtrn", 'immutable');
y.val('set', {
x: "x"
}, 'immutable');
w = y.value;
w.x;
w.set = {
y: ""
};
w.x;
w.set;
w.set.x;
expect(w.x).to.equal("dtrn");
return expect(w.set.x).to.equal("x");
});
it("can handle creaton of complex json", function() {
this.yTest.getSomeUser().val('x', {
'a': 'b'
});
this.yTest.getSomeUser().val('a', {
'a': {
q: "dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"
}
});
this.yTest.getSomeUser().val('b', {
'a': {}
});
this.yTest.getSomeUser().val('c', {
'a': 'b'
});
return this.yTest.compareAll();
});
it("handles some immutable tests", function() {
this.yTest.getSomeUser().val('string', "text", "immutable");
this.yTest.getSomeUser().val('number', 4, "immutable");
this.yTest.getSomeUser().val('object', {
q: "rr"
}, "immutable");
this.yTest.compareAll();
expect(this.yTest.getSomeUser().val('string')).to.equal("text");
expect(this.yTest.getSomeUser().val('number')).to.equal(4);
return expect(this.yTest.getSomeUser().val('object').val('q')).to.equal("rr");
});
return it("can handle many engines, many operations, concurrently (random)", function() {
var yTest;
yTest = new Test();
return yTest.run();
return this.yTest.run();
});
});

View File

@ -90,6 +90,11 @@
Insert
</a>
</li>
<li>
<a href='class/ImmutableObject.html'>
ImmutableObject
</a>
</li>
</ul>
</ul>
<ul>
@ -100,6 +105,11 @@
JsonYatta
</a>
</li>
<li>
<a href='class/JsonWrapper.html'>
JsonWrapper
</a>
</li>
<li>
<a href='class/JsonType.html'>
JsonType
@ -322,7 +332,7 @@
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -63,10 +63,10 @@ only one will AddName operation will be executed.</p>
</li>
<li>
<span class='signature'>
<a href='#toJson-dynamic'>
<a href='#_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
</a>
</span>
<span class='desc'>
@ -82,7 +82,41 @@ only one will AddName operation will be executed.</p>
<b>constructor</b><span>(uid, map_manager, name)</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'>map_manager</span>
<span class='type'>
(
<tt>Object</tt>
)
</span>
&mdash;
<span class='desc'>Uid or reference to the MapManager. </span>
</li>
<li>
<span class='name'>name</span>
<span class='type'>
(
<tt>String</tt>
)
</span>
&mdash;
<span class='desc'>Name of the property that will be added. </span>
</li>
</ul>
</div>
</div>
</div>
<h2>Instance Method Details</h2>
@ -97,10 +131,10 @@ only one will AddName operation will be executed.</p>
</div>
<div class='method_details'>
<p class='signature' id='toJson-dynamic'>
<p class='signature' id='_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
<br>
</p>
@ -108,7 +142,7 @@ only one will AddName operation will be executed.</p>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -49,12 +49,13 @@
<ul class='summary'>
<li>
<span class='signature'>
<a href='#toJson-dynamic'>
<a href='#_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
Convert all relevant information of this operation to the json-format.
</span>
@ -67,6 +68,7 @@
<b>execute</b><span>()</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
Apply the deletion.
</span>
@ -94,16 +96,41 @@
<b>constructor</b><span>(uid, deletes)</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'>deletes</span>
<span class='type'>
(
<tt>Object</tt>
)
</span>
&mdash;
<span class='desc'>UID or reference of the operation that this to be deleted. </span>
</li>
</ul>
</div>
</div>
</div>
<h2>Instance Method Details</h2>
<div class='methods'>
<div class='method_details'>
<p class='signature' id='toJson-dynamic'>
<p class='signature' id='_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='docstring'>
@ -118,6 +145,7 @@ This result can be sent to other clients.</p>
#
(void)
<b>execute</b><span>()</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='docstring'>
@ -129,7 +157,7 @@ This result can be sent to other clients.</p>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -49,28 +49,6 @@ of the Engine is empty.</p>
</div>
<h2>Instance Method Summary</h2>
<ul class='summary'>
<li>
<span class='signature'>
<a href='#isDeleted-dynamic'>
#
(void)
<b>isDeleted</b><span>()</span>
</a>
</span>
<span class='desc'>
</span>
</li>
<li>
<span class='signature'>
<a href='#getDistanceToOrigin-dynamic'>
#
(void)
<b>getDistanceToOrigin</b><span>()</span>
</a>
</span>
<span class='desc'>
</span>
</li>
<li>
<span class='signature'>
<a href='#execute-dynamic'>
@ -79,17 +57,19 @@ of the Engine is empty.</p>
<b>execute</b><span>()</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
</span>
</li>
<li>
<span class='signature'>
<a href='#toJson-dynamic'>
<a href='#_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
</span>
</li>
@ -106,7 +86,6 @@ of the Engine is empty.</p>
<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/Insert.html#val-dynamic'>#val</a>
<a href='../class/Operation.html#getUid-dynamic'>#getUid</a>
<a href='../class/Operation.html#saveOperation-dynamic'>#saveOperation</a>
<a href='../class/Operation.html#validateSavedOperations-dynamic'>#validateSavedOperations</a>
@ -114,46 +93,32 @@ of the Engine is empty.</p>
</h2>
<h2>Instance Method Details</h2>
<div class='methods'>
<div class='method_details'>
<p class='signature' id='isDeleted-dynamic'>
#
(void)
<b>isDeleted</b><span>()</span>
<br>
</p>
</div>
<div class='method_details'>
<p class='signature' id='getDistanceToOrigin-dynamic'>
#
(void)
<b>getDistanceToOrigin</b><span>()</span>
<br>
</p>
</div>
<div class='method_details'>
<p class='signature' id='execute-dynamic'>
#
(void)
<b>execute</b><span>()</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='toJson-dynamic'>
<p class='signature' id='_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='tags'>
</div>
</div>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -65,10 +65,10 @@
</li>
<li>
<span class='signature'>
<a href='#cleanUp-dynamic'>
<a href='#applyOp-dynamic'>
#
(void)
<b>cleanUp</b><span>()</span>
<b>applyOp</b><span>(op_json)</span>
</a>
</span>
<span class='desc'>
@ -76,10 +76,10 @@
</li>
<li>
<span class='signature'>
<a href='#applyOp-dynamic'>
<a href='#tryUnprocessed-dynamic'>
#
(void)
<b>applyOp</b><span>(op_json)</span>
<b>tryUnprocessed</b><span>()</span>
</a>
</span>
<span class='desc'>
@ -117,15 +117,6 @@
<br>
</p>
</div>
<div class='method_details'>
<p class='signature' id='cleanUp-dynamic'>
#
(void)
<b>cleanUp</b><span>()</span>
<br>
</p>
</div>
<div class='method_details'>
<p class='signature' id='applyOp-dynamic'>
@ -136,10 +127,19 @@
</p>
</div>
<div class='method_details'>
<p class='signature' id='tryUnprocessed-dynamic'>
#
(void)
<b>tryUnprocessed</b><span>()</span>
<br>
</p>
</div>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -71,10 +71,10 @@
</li>
<li>
<span class='signature'>
<a href='#toJson-dynamic'>
<a href='#_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
</a>
</span>
<span class='desc'>
@ -175,10 +175,10 @@
</div>
</div>
<div class='method_details'>
<p class='signature' id='toJson-dynamic'>
<p class='signature' id='_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
<br>
</p>
@ -228,7 +228,7 @@ other operations (it wont executed)</p>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -49,6 +49,7 @@ For the sake of efficiency we maintain two lists: - The short-list (abbrev. sl)
</div>
<h2>Direct Known Subclasses</h2>
<p class='children'>
<a href='../class/ImmutableObject.html'>ImmutableObject</a>
<a href='../class/Delimiter.html'>Delimiter</a>
</p>
<h2>Instance Method Summary</h2>
@ -61,6 +62,7 @@ For the sake of efficiency we maintain two lists: - The short-list (abbrev. sl)
<b>applyDelete</b><span>(o)</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
</span>
</li>
@ -84,6 +86,7 @@ For the sake of efficiency we maintain two lists: - The short-list (abbrev. sl)
<b>getDistanceToOrigin</b><span>()</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
The amount of positions that $this operation was moved to the right.
</span>
@ -96,6 +99,7 @@ For the sake of efficiency we maintain two lists: - The short-list (abbrev. sl)
<b>update_sl</b><span>()</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
Update the short list TODO (Unused)
@ -109,21 +113,11 @@ For the sake of efficiency we maintain two lists: - The short-list (abbrev. sl)
<b>execute</b><span>()</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
Include this operation in the associative lists.
</span>
</li>
<li>
<span class='signature'>
<a href='#val-dynamic'>
#
(void)
<b>val</b><span>()</span>
</a>
</span>
<span class='desc'>
</span>
</li>
</ul>
<h2>
<small>Inherited Method Summary</small>
@ -151,24 +145,14 @@ For the sake of efficiency we maintain two lists: - The short-list (abbrev. sl)
<h3>Parameters:</h3>
<ul class='param'>
<li>
<span class='name'>creator</span>
<span class='name'>uid</span>
<span class='type'>
(
<tt>Object</tt>
)
</span>
&mdash;
<span class='desc'>A unique user identifier </span>
</li>
<li>
<span class='name'>op_number</span>
<span class='type'>
(
<tt>Integer</tt>
)
</span>
&mdash;
<span class='desc'>This Number was assigned via getNextOperationIdentifier(). </span>
<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>
@ -207,9 +191,11 @@ For the sake of efficiency we maintain two lists: - The short-list (abbrev. sl)
#
(void)
<b>applyDelete</b><span>(o)</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='isDeleted-dynamic'>
@ -229,6 +215,7 @@ For the sake of efficiency we maintain two lists: - The short-list (abbrev. sl)
#
(void)
<b>getDistanceToOrigin</b><span>()</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='docstring'>
@ -242,6 +229,7 @@ For the sake of efficiency we maintain two lists: - The short-list (abbrev. sl)
#
(void)
<b>update_sl</b><span>()</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='docstring'>
@ -256,6 +244,7 @@ TODO (Unused)</p>
#
(void)
<b>execute</b><span>()</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='docstring'>
@ -264,19 +253,10 @@ TODO (Unused)</p>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='val-dynamic'>
#
(void)
<b>val</b><span>()</span>
<br>
</p>
</div>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -168,7 +168,7 @@
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -45,31 +45,53 @@
</div>
<div class='tags'>
</div>
<h2>Variables Summary</h2>
<dl class='constants'>
<dt id='mutable_default-variable'>
mutable_default
=
</dt>
<dd>
<pre><code class='coffeescript'>true</code></pre>
</dd>
</dl>
<h2>Instance Method Summary</h2>
<ul class='summary'>
<li>
<span class='signature'>
<a href='#val-dynamic'>
~
<a href='#setMutableDefault-dynamic'>
#
(void)
<b>val</b><span>()</span>
<b>setMutableDefault</b><span>(mutable)</span>
</a>
</span>
<span class='desc'>
Get this as a Json object.
</span>
</li>
<li>
<span class='signature'>
<a href='#toJson-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<a href='#val-dynamic'>
~
(Json)
<b>val</b><span>()</span>
</a>
</span>
<span class='desc'>
</span>
</li>
<li>
<span class='signature'>
<a href='#_encode-dynamic'>
#
(void)
<b>_encode</b><span>()</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
</span>
</li>
</ul>
<h2>Constructor Details</h2>
<div class='methods'>
@ -77,57 +99,102 @@
<p class='signature' id='constructor-dynamic'>
#
(void)
<b>constructor</b><span>(uid, initial_value)</span>
<b>constructor</b><span>(uid, initial_value, mutable)</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'>initial_value</span>
<span class='type'>
(
<tt>Object</tt>
)
</span>
&mdash;
<span class='desc'>Create this operation with an initial value. </span>
</li>
<li>
<span class='name'>Whether</span>
<span class='type'>
(
<tt>String|Boolean</tt>
)
</span>
&mdash;
<span class='desc'>the initial_value should be created as mutable. (Optional - see setMutableDefault) </span>
</li>
</ul>
</div>
</div>
</div>
<h2>Instance Method Details</h2>
<div class='methods'>
<div class='method_details'>
<p class='signature' id='setMutableDefault-dynamic'>
#
(void)
<b>setMutableDefault</b><span>(mutable)</span>
<br>
</p>
</div>
<div class='method_details'>
<p class='signature' id='val-dynamic'>
~
(void)
(Json)
<b>val</b><span>()</span>
<br>
~
(void)
(JsonType|Word|String|Object)
<b>val</b><span>(name)</span>
<br>
~
(void)
(JsonType)
<b>val</b><span>(name, content)</span>
<br>
</p>
<div class='docstring'>
<p>Get this as a Json object. Note that none of the values of the result is of type Operation.
Get value of a property.
Set a new property.</p>
</div>
<div class='tags'>
<div class='tags'>
<div class='overloads'>
<h3>Overloads:</h3>
<div class='overload'>
<p class='signature'>
~
(void)
(Json)
<b>val</b><span>()</span>
</p>
<div class='docstring'>
<p>@results [Json]</p>
<p>Get this as a Json object.</p>
</div>
<div class='tags'>
<h3>Returns:</h3>
<ul class='return'>
<li>
<span class='type'></span>
<tt>Json</tt>
</li>
</ul>
</div>
</div>
<div class='overload'>
<p class='signature'>
~
(void)
(JsonType|Word|String|Object)
<b>val</b><span>(name)</span>
</p>
<div class='docstring'>
<p>@results [JsonType|WordType]</p>
<p>Get value of a property.</p>
</div>
<div class='tags'>
<h3>Parameters:</h3>
@ -143,15 +210,29 @@ Set a new property.</p>
<span class='desc'>Name of the object property. </span>
</li>
</ul>
<h3>Returns:</h3>
<ul class='return'>
<li>
<span class='type'></span>
(
<tt>JsonType|Word|String|Object</tt>
)
&mdash;
<span class='desc'>Depending on the value of the property. If mutable it will return a Operation-type object, if immutable it will return String/Object. </span>
</li>
</ul>
</div>
</div>
<div class='overload'>
<p class='signature'>
~
(void)
(JsonType)
<b>val</b><span>(name, content)</span>
</p>
<div class='tags'>
<div class='docstring'>
<p>Set a new property.</p>
</div>
<div class='tags'>
<h3>Parameters:</h3>
<ul class='param'>
<li>
@ -175,24 +256,37 @@ Set a new property.</p>
<span class='desc'>Content of the object property. </span>
</li>
</ul>
<h3>Returns:</h3>
<ul class='return'>
<li>
<span class='type'></span>
(
<tt><a href='../class/JsonType.html'>JsonType</a></tt>
)
&mdash;
<span class='desc'>This object. (supports chaining) </span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class='method_details'>
<p class='signature' id='toJson-dynamic'>
<p class='signature' id='_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='tags'>
</div>
</div>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -35,7 +35,13 @@
</table>
<h2>Overview</h2>
<div class='docstring'>
<p>Framework for arbitrary Json data-structures.</p>
<p>Framework for Json data-structures.
Known values that are supported:</p><ul>
<li>String</li>
<li>Integer</li>
<li>Array</li>
</ul>
</div>
<div class='tags'>
</div>
@ -50,6 +56,7 @@
</a>
</span>
<span class='desc'>
@result JsonType
</span>
</li>
<li>
@ -72,6 +79,7 @@
</a>
</span>
<span class='desc'>
Get the initialized connector.
</span>
</li>
<li>
@ -87,21 +95,44 @@
</li>
<li>
<span class='signature'>
<a href='#getUserId-dynamic'>
<a href='#setMutableDefault-dynamic'>
#
(void)
<b>getUserId</b><span>()</span>
<b>setMutableDefault</b><span>(mutable)</span>
</a>
</span>
<span class='desc'>
</span>
</li>
<li>
<span class='signature'>
<a href='#getUserId-dynamic'>
#
(void)
<b>getUserId</b><span>()</span>
</a>
</span>
<span class='desc'>
Get the UserId from the HistoryBuffer object.
</span>
</li>
<li>
<span class='signature'>
<a href='#val-dynamic'>
#
(void)
<b>val</b><span>(name, content)</span>
<b>val</b><span>(name, content, mutable)</span>
</a>
</span>
<span class='desc'>
</span>
</li>
<li>
<span class='signature'>
<a href='#value-dynamic'>
#
(void)
<b>value</b><span>()</span>
</a>
</span>
<span class='desc'>
@ -129,7 +160,11 @@
<b>getRootElement</b><span>()</span>
<br>
</p>
<div class='docstring'>
<p>@result JsonType</p>
</div>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='getEngine-dynamic'>
@ -138,7 +173,14 @@
<b>getEngine</b><span>()</span>
<br>
</p>
<div class='tags'>
<h3>See also:</h3>
<ul class='see'>
<li>
<a href='../class/Engine.html'>Engine</a>
</li>
</ul>
</div>
</div>
<div class='method_details'>
<p class='signature' id='getConnector-dynamic'>
@ -147,7 +189,11 @@
<b>getConnector</b><span>()</span>
<br>
</p>
<div class='docstring'>
<p>Get the initialized connector.</p>
</div>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='getHistoryBuffer-dynamic'>
@ -156,7 +202,30 @@
<b>getHistoryBuffer</b><span>()</span>
<br>
</p>
<div class='tags'>
<h3>See also:</h3>
<ul class='see'>
<li>
<a href='../class/HistoryBuffer.html'>HistoryBuffer</a>
</li>
</ul>
</div>
</div>
<div class='method_details'>
<p class='signature' id='setMutableDefault-dynamic'>
#
(void)
<b>setMutableDefault</b><span>(mutable)</span>
<br>
</p>
<div class='tags'>
<h3>See also:</h3>
<ul class='see'>
<li>
<a href='JsonType.setMutableDefault'>JsonType.setMutableDefault</a>
</li>
</ul>
</div>
</div>
<div class='method_details'>
<p class='signature' id='getUserId-dynamic'>
@ -165,21 +234,50 @@
<b>getUserId</b><span>()</span>
<br>
</p>
<div class='docstring'>
<p>Get the UserId from the HistoryBuffer object.
In most cases this will be the same as the user_id value with which
JsonYatta was initialized (Depending on the HistoryBuffer implementation).</p>
</div>
<div class='tags'>
</div>
</div>
<div class='method_details'>
<p class='signature' id='val-dynamic'>
#
(void)
<b>val</b><span>(name, content)</span>
<b>val</b><span>(name, content, mutable)</span>
<br>
</p>
<div class='tags'>
<h3>See also:</h3>
<ul class='see'>
<li>
<a href='JsonType.val'>JsonType.val</a>
</li>
</ul>
</div>
</div>
<div class='method_details'>
<p class='signature' id='value-dynamic'>
#
(void)
<b>value</b><span>()</span>
<br>
</p>
<div class='tags'>
<h3>See also:</h3>
<ul class='see'>
<li>
<a href='JsonType.value'>JsonType.value</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -110,7 +110,44 @@
<b>constructor</b><span>(uid, beginning, end, prev, next, origin)</span>
<br>
</p>
<div class='docstring'>
<p>A ListManager maintains a non-empty list that has a beginning and an end (both Delimiters!)</p>
</div>
<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'>beginning</span>
<span class='type'>
(
<tt><a href='../class/Delimiter.html'>Delimiter</a></tt>
)
</span>
&mdash;
<span class='desc'>Reference or Object. </span>
</li>
<li>
<span class='name'>end</span>
<span class='type'>
(
<tt><a href='../class/Delimiter.html'>Delimiter</a></tt>
)
</span>
&mdash;
<span class='desc'>Reference or Object. </span>
</li>
</ul>
</div>
</div>
</div>
<h2>Instance Method Details</h2>
@ -171,7 +208,7 @@ Doesn&#39;t return left-right delimiter.</p>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -68,7 +68,21 @@
<b>constructor</b><span>(uid)</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>
</ul>
</div>
</div>
</div>
<h2>Instance Method Details</h2>
@ -85,7 +99,7 @@
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -36,7 +36,7 @@
<h2>Overview</h2>
<div class='docstring'>
<p>A generic interface to operations.</p><p>An operation has the following methods:
toJson: encodes an operation (needed only if instance of this operation is sent).
_encode: encodes an operation (needed only if instance of this operation is sent).
execute: execute the effects of this operations. Good examples are Insert-type and AddName-type
val: in the case that the operation holds a value</p><p>Furthermore an encodable operation has a parser.</p>
</div>
@ -58,7 +58,7 @@ val: in the case that the operation holds a value</p><p>Furthermore an encodable
</a>
</span>
<span class='desc'>
Computes a unique identifier (uid).
Computes a unique identifier (uid) that identifies this operation.
</span>
</li>
<li>
@ -69,6 +69,7 @@ val: in the case that the operation holds a value</p><p>Furthermore an encodable
<b>execute</b><span>()</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
Notify the all the listeners.
</span>
@ -81,6 +82,7 @@ val: in the case that the operation holds a value</p><p>Furthermore an encodable
<b>saveOperation</b><span>(name, op_uid)</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
Operations may depend on other operations (linked lists, etc.).
</span>
@ -93,6 +95,7 @@ val: in the case that the operation holds a value</p><p>Furthermore an encodable
<b>validateSavedOperations</b><span>()</span>
</a>
</span>
<span class='note private title'>Private</span>
<span class='desc'>
After calling this function all not instantiated operations will be accessible.
</span>
@ -118,7 +121,7 @@ val: in the case that the operation holds a value</p><p>Furthermore an encodable
)
</span>
&mdash;
<span class='desc'>A unique identifier </span>
<span class='desc'>A unique identifier. If uid is undefined, a new uid will be created. </span>
</li>
</ul>
<h3>See also:</h3>
@ -140,7 +143,7 @@ val: in the case that the operation holds a value</p><p>Furthermore an encodable
<br>
</p>
<div class='docstring'>
<p>Computes a unique identifier (uid).</p>
<p>Computes a unique identifier (uid) that identifies this operation.</p>
</div>
<div class='tags'>
</div>
@ -150,6 +153,7 @@ val: in the case that the operation holds a value</p><p>Furthermore an encodable
#
(void)
<b>execute</b><span>()</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='docstring'>
@ -251,6 +255,7 @@ an easy way to refer to these operations via an uid or object reference.</p><p>F
#
(Boolean)
<b>validateSavedOperations</b><span>()</span>
<span class='note private'>Private</span>
<br>
</p>
<div class='docstring'>
@ -279,7 +284,7 @@ an easy way to refer to these operations via an uid or object reference.</p><p>F
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -78,10 +78,10 @@ Each Replaceable holds a value that is now replaceable.</p><p>The Word-type has
</li>
<li>
<span class='signature'>
<a href='#toJson-dynamic'>
<a href='#_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
</a>
</span>
<span class='desc'>
@ -110,7 +110,51 @@ Each Replaceable holds a value that is now replaceable.</p><p>The Word-type has
<b>constructor</b><span>(initial_content, uid, beginning, end, prev, next, origin)</span>
<br>
</p>
<div class='tags'>
<h3>Parameters:</h3>
<ul class='param'>
<li>
<span class='name'>initial_content</span>
<span class='type'>
(
<tt><a href='../class/Operation.html'>Operation</a></tt>
)
</span>
&mdash;
<span class='desc'>Initialize this with a Replaceable that holds the initial_content. </span>
</li>
<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'>beginning</span>
<span class='type'>
(
<tt><a href='../class/Delimiter.html'>Delimiter</a></tt>
)
</span>
&mdash;
<span class='desc'>Reference or Object. </span>
</li>
<li>
<span class='name'>end</span>
<span class='type'>
(
<tt><a href='../class/Delimiter.html'>Delimiter</a></tt>
)
</span>
&mdash;
<span class='desc'>Reference or Object. </span>
</li>
</ul>
</div>
</div>
</div>
<h2>Instance Method Details</h2>
@ -134,10 +178,10 @@ Each Replaceable holds a value that is now replaceable.</p><p>The Word-type has
</div>
<div class='method_details'>
<p class='signature' id='toJson-dynamic'>
<p class='signature' id='_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
<br>
</p>
@ -145,7 +189,7 @@ Each Replaceable holds a value that is now replaceable.</p><p>The Word-type has
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -88,10 +88,10 @@
</li>
<li>
<span class='signature'>
<a href='#toJson-dynamic'>
<a href='#_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
</a>
</span>
<span class='desc'>
@ -108,7 +108,41 @@
<b>constructor</b><span>(content, parent, uid, prev, next, origin)</span>
<br>
</p>
<div class='tags'>
<h3>Parameters:</h3>
<ul class='param'>
<li>
<span class='name'>content</span>
<span class='type'>
(
<tt><a href='../class/Operation.html'>Operation</a></tt>
)
</span>
&mdash;
<span class='desc'>The value that this Replaceable holds. </span>
</li>
<li>
<span class='name'>parent</span>
<span class='type'>
(
<tt><a href='../class/ReplaceManager.html'>ReplaceManager</a></tt>
)
</span>
&mdash;
<span class='desc'>Used to replace this Replaceable with another one. </span>
</li>
<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>
</ul>
</div>
</div>
</div>
<h2>Instance Method Details</h2>
@ -141,10 +175,10 @@
</div>
<div class='method_details'>
<p class='signature' id='toJson-dynamic'>
<p class='signature' id='_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
<br>
</p>
<div class='docstring'>
@ -157,7 +191,7 @@ This result can be send to other clients.</p>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -219,7 +219,7 @@
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -53,7 +53,7 @@
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -74,10 +74,10 @@
</li>
<li>
<span class='signature'>
<a href='#toJson-dynamic'>
<a href='#_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
</a>
</span>
<span class='desc'>
@ -94,7 +94,31 @@
<b>constructor</b><span>(content, uid, prev, next, origin)</span>
<br>
</p>
<div class='tags'>
<h3>Parameters:</h3>
<ul class='param'>
<li>
<span class='name'>content</span>
<span class='type'>
(
<tt>String</tt>
)
</span>
&mdash;
<span class='desc'>The content of this Insert-type Operation. Usually you restrict the length of content to size 1 </span>
</li>
<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>
</ul>
</div>
</div>
</div>
<h2>Instance Method Details</h2>
@ -133,10 +157,10 @@ in order to retrieve the content of the engine.</p>
</div>
</div>
<div class='method_details'>
<p class='signature' id='toJson-dynamic'>
<p class='signature' id='_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
<br>
</p>
<div class='docstring'>
@ -149,7 +173,7 @@ This result can be send to other clients.</p>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -239,7 +239,7 @@
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -110,10 +110,10 @@
</li>
<li>
<span class='signature'>
<a href='#toJson-dynamic'>
<a href='#_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
</a>
</span>
<span class='desc'>
@ -129,7 +129,29 @@
<b>constructor</b><span>(uid, initial_content, beginning, end, prev, next, 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'>initial_content</span>
<span class='type'>
(
<tt>String</tt>
)
</span>
</li>
</ul>
</div>
</div>
</div>
<h2>Instance Method Details</h2>
@ -208,10 +230,10 @@ to provide replace functionality.</p>
</div>
</div>
<div class='method_details'>
<p class='signature' id='toJson-dynamic'>
<p class='signature' id='_encode-dynamic'>
#
(void)
<b>toJson</b><span>()</span>
<b>_encode</b><span>()</span>
<br>
</p>
@ -219,7 +241,7 @@ to provide replace functionality.</p>
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -109,6 +109,18 @@
</small>
</li>
<li>
<a href='class/ImmutableObject.html' target='main'>
ImmutableObject
</a>
<small class='parent'>
<
Insert
</small>
<small class='namespace'>
</small>
</li>
<li>
<a href='class/Delimiter.html' target='main'>
Delimiter
@ -121,6 +133,14 @@
</small>
</li>
<li>
<a href='class/JsonWrapper.html' target='main'>
JsonWrapper
</a>
<small class='namespace'>
</small>
</li>
<li>
<a href='class/JsonType.html' target='main'>
JsonType

View File

@ -38,7 +38,7 @@
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -38,7 +38,7 @@
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -84,7 +84,7 @@
</div>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -39,7 +39,7 @@
</table>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -58,7 +58,7 @@
</dl>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -68,7 +68,7 @@
</dl>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -60,7 +60,7 @@
</dl>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -58,7 +58,7 @@
</dl>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -39,7 +39,7 @@
</table>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -39,7 +39,7 @@
</table>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -39,7 +39,7 @@
</table>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -39,7 +39,7 @@
</table>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

View File

@ -39,7 +39,7 @@
</table>
</div>
<div id='footer'>
August 03, 14 03:14:41 by
August 04, 14 23:05:04 by
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
Codo
</a>

File diff suppressed because one or more lines are too long

View File

@ -29,6 +29,86 @@
<input type='text'>
</div>
<ul>
<li>
<a href='class/Word.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(Word)
</small>
</li>
<li>
<a href='class/HistoryBuffer.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(HistoryBuffer)
</small>
</li>
<li>
<a href='class/Replaceable.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(Replaceable)
</small>
</li>
<li>
<a href='class/ReplaceManager.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(ReplaceManager)
</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>
</li>
<li>
<a href='class/Delete.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(Delete)
</small>
</li>
<li>
<a href='class/TextInsert.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(TextInsert)
</small>
</li>
<li>
<a href='class/Delimiter.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(Delimiter)
</small>
</li>
<li>
<a href='class/ImmutableObject.html#_encode-dynamic' target='main' title='_encode'>
#_encode
</a>
<small>
(ImmutableObject)
</small>
</li>
<li>
<a href='class/HistoryBuffer.html#addOperation-dynamic' target='main' title='addOperation'>
#addOperation
@ -62,83 +142,11 @@
</small>
</li>
<li>
<a href='class/Engine.html#cleanUp-dynamic' target='main' title='cleanUp'>
#cleanUp
</a>
<small>
(Engine)
</small>
</li>
<li>
<a href='class/IwcConnector.html#constructor-dynamic' target='main' title='constructor'>
<a href='class/JsonType.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(IwcConnector)
</small>
</li>
<li>
<a href='class/AddName.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(AddName)
</small>
</li>
<li>
<a href='class/Insert.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Insert)
</small>
</li>
<li>
<a href='class/Word.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Word)
</small>
</li>
<li>
<a href='class/Delete.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Delete)
</small>
</li>
<li>
<a href='class/Replaceable.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Replaceable)
</small>
</li>
<li>
<a href='class/MapManager.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(MapManager)
</small>
</li>
<li>
<a href='class/Operation.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Operation)
</small>
</li>
<li>
<a href='class/ListManager.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(ListManager)
(JsonType)
</small>
</li>
<li>
@ -150,27 +158,11 @@
</small>
</li>
<li>
<a href='class/HistoryBuffer.html#constructor-dynamic' target='main' title='constructor'>
<a href='class/Word.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(HistoryBuffer)
</small>
</li>
<li>
<a href='class/JsonType.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(JsonType)
</small>
</li>
<li>
<a href='class/ReplaceManager.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(ReplaceManager)
(Word)
</small>
</li>
<li>
@ -181,6 +173,22 @@
(TestConnector)
</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>
</li>
<li>
<a href='class/JsonYatta.html#constructor-dynamic' target='main' title='constructor'>
#constructor
@ -189,6 +197,70 @@
(JsonYatta)
</small>
</li>
<li>
<a href='class/ListManager.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(ListManager)
</small>
</li>
<li>
<a href='class/ImmutableObject.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(ImmutableObject)
</small>
</li>
<li>
<a href='class/HistoryBuffer.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(HistoryBuffer)
</small>
</li>
<li>
<a href='class/Insert.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Insert)
</small>
</li>
<li>
<a href='class/AddName.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(AddName)
</small>
</li>
<li>
<a href='class/Delete.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Delete)
</small>
</li>
<li>
<a href='class/IwcConnector.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(IwcConnector)
</small>
</li>
<li>
<a href='class/Operation.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Operation)
</small>
</li>
<li>
<a href='class/TextYatta.html#constructor-dynamic' target='main' title='constructor'>
#constructor
@ -198,11 +270,27 @@
</small>
</li>
<li>
<a href='class/TextInsert.html#constructor-dynamic' target='main' title='constructor'>
<a href='class/MapManager.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(TextInsert)
(MapManager)
</small>
</li>
<li>
<a href='class/Replaceable.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(Replaceable)
</small>
</li>
<li>
<a href='class/JsonWrapper.html#constructor-dynamic' target='main' title='constructor'>
#constructor
</a>
<small>
(JsonWrapper)
</small>
</li>
<li>
@ -229,14 +317,6 @@
(Word)
</small>
</li>
<li>
<a href='class/Operation.html#execute-dynamic' target='main' title='execute'>
#execute
</a>
<small>
(Operation)
</small>
</li>
<li>
<a href='class/Delimiter.html#execute-dynamic' target='main' title='execute'>
#execute
@ -245,6 +325,14 @@
(Delimiter)
</small>
</li>
<li>
<a href='class/Operation.html#execute-dynamic' target='main' title='execute'>
#execute
</a>
<small>
(Operation)
</small>
</li>
<li>
<a href='class/Insert.html#execute-dynamic' target='main' title='execute'>
#execute
@ -254,11 +342,11 @@
</small>
</li>
<li>
<a href='class/AddName.html#execute-dynamic' target='main' title='execute'>
<a href='class/Delete.html#execute-dynamic' target='main' title='execute'>
#execute
</a>
<small>
(AddName)
(Delete)
</small>
</li>
<li>
@ -270,11 +358,11 @@
</small>
</li>
<li>
<a href='class/Delete.html#execute-dynamic' target='main' title='execute'>
<a href='class/AddName.html#execute-dynamic' target='main' title='execute'>
#execute
</a>
<small>
(Delete)
(AddName)
</small>
</li>
<li>
@ -317,14 +405,6 @@
(JsonYatta)
</small>
</li>
<li>
<a href='class/Delimiter.html#getDistanceToOrigin-dynamic' target='main' title='getDistanceToOrigin'>
#getDistanceToOrigin
</a>
<small>
(Delimiter)
</small>
</li>
<li>
<a href='class/Insert.html#getDistanceToOrigin-dynamic' target='main' title='getDistanceToOrigin'>
#getDistanceToOrigin
@ -357,14 +437,6 @@
(ListManager)
</small>
</li>
<li>
<a href='class/TextYatta.html#getHistoryBuffer-dynamic' target='main' title='getHistoryBuffer'>
#getHistoryBuffer
</a>
<small>
(TextYatta)
</small>
</li>
<li>
<a href='class/JsonYatta.html#getHistoryBuffer-dynamic' target='main' title='getHistoryBuffer'>
#getHistoryBuffer
@ -373,6 +445,14 @@
(JsonYatta)
</small>
</li>
<li>
<a href='class/TextYatta.html#getHistoryBuffer-dynamic' target='main' title='getHistoryBuffer'>
#getHistoryBuffer
</a>
<small>
(TextYatta)
</small>
</li>
<li>
<a href='class/ListManager.html#getLastOperation-dynamic' target='main' title='getLastOperation'>
#getLastOperation
@ -429,14 +509,6 @@
(TestConnector)
</small>
</li>
<li>
<a href='class/IwcConnector.html#getRootElement-dynamic' target='main' title='getRootElement'>
#getRootElement
</a>
<small>
(IwcConnector)
</small>
</li>
<li>
<a href='class/JsonYatta.html#getRootElement-dynamic' target='main' title='getRootElement'>
#getRootElement
@ -446,11 +518,11 @@
</small>
</li>
<li>
<a href='class/TextYatta.html#getRootElement-dynamic' target='main' title='getRootElement'>
<a href='class/IwcConnector.html#getRootElement-dynamic' target='main' title='getRootElement'>
#getRootElement
</a>
<small>
(TextYatta)
(IwcConnector)
</small>
</li>
<li>
@ -461,6 +533,14 @@
(TestConnector)
</small>
</li>
<li>
<a href='class/TextYatta.html#getRootElement-dynamic' target='main' title='getRootElement'>
#getRootElement
</a>
<small>
(TextYatta)
</small>
</li>
<li>
<a href='class/Operation.html#getUid-dynamic' target='main' title='getUid'>
#getUid
@ -477,14 +557,6 @@
(JsonYatta)
</small>
</li>
<li>
<a href='class/HistoryBuffer.html#getUserId-dynamic' target='main' title='getUserId'>
#getUserId
</a>
<small>
(HistoryBuffer)
</small>
</li>
<li>
<a href='class/TextYatta.html#getUserId-dynamic' target='main' title='getUserId'>
#getUserId
@ -494,11 +566,11 @@
</small>
</li>
<li>
<a href='class/Word.html#insertText-dynamic' target='main' title='insertText'>
#insertText
<a href='class/HistoryBuffer.html#getUserId-dynamic' target='main' title='getUserId'>
#getUserId
</a>
<small>
(Word)
(HistoryBuffer)
</small>
</li>
<li>
@ -510,11 +582,11 @@
</small>
</li>
<li>
<a href='class/Delimiter.html#isDeleted-dynamic' target='main' title='isDeleted'>
#isDeleted
<a href='class/Word.html#insertText-dynamic' target='main' title='insertText'>
#insertText
</a>
<small>
(Delimiter)
(Word)
</small>
</li>
<li>
@ -565,14 +637,6 @@
(Replaceable)
</small>
</li>
<li>
<a href='class/Word.html#replaceText-dynamic' target='main' title='replaceText'>
#replaceText
</a>
<small>
(Word)
</small>
</li>
<li>
<a href='class/TextYatta.html#replaceText-dynamic' target='main' title='replaceText'>
#replaceText
@ -581,6 +645,14 @@
(TextYatta)
</small>
</li>
<li>
<a href='class/Word.html#replaceText-dynamic' target='main' title='replaceText'>
#replaceText
</a>
<small>
(Word)
</small>
</li>
<li>
<a href='class/Operation.html#saveOperation-dynamic' target='main' title='saveOperation'>
#saveOperation
@ -613,6 +685,22 @@
(IwcConnector)
</small>
</li>
<li>
<a href='class/JsonYatta.html#setMutableDefault-dynamic' target='main' title='setMutableDefault'>
#setMutableDefault
</a>
<small>
(JsonYatta)
</small>
</li>
<li>
<a href='class/JsonType.html#setMutableDefault-dynamic' target='main' title='setMutableDefault'>
#setMutableDefault
</a>
<small>
(JsonType)
</small>
</li>
<li>
<a href='class/Word.html#setReplaceManager-dynamic' target='main' title='setReplaceManager'>
#setReplaceManager
@ -621,14 +709,6 @@
(Word)
</small>
</li>
<li>
<a href='class/IwcConnector.html#sync-dynamic' target='main' title='sync'>
#sync
</a>
<small>
(IwcConnector)
</small>
</li>
<li>
<a href='class/TestConnector.html#sync-dynamic' target='main' title='sync'>
#sync
@ -637,6 +717,14 @@
(TestConnector)
</small>
</li>
<li>
<a href='class/IwcConnector.html#sync-dynamic' target='main' title='sync'>
#sync
</a>
<small>
(IwcConnector)
</small>
</li>
<li>
<a href='class/ListManager.html#toArray-dynamic' target='main' title='toArray'>
#toArray
@ -646,75 +734,11 @@
</small>
</li>
<li>
<a href='class/HistoryBuffer.html#toJson-dynamic' target='main' title='toJson'>
#toJson
<a href='class/Engine.html#tryUnprocessed-dynamic' target='main' title='tryUnprocessed'>
#tryUnprocessed
</a>
<small>
(HistoryBuffer)
</small>
</li>
<li>
<a href='class/Delete.html#toJson-dynamic' target='main' title='toJson'>
#toJson
</a>
<small>
(Delete)
</small>
</li>
<li>
<a href='class/JsonType.html#toJson-dynamic' target='main' title='toJson'>
#toJson
</a>
<small>
(JsonType)
</small>
</li>
<li>
<a href='class/ReplaceManager.html#toJson-dynamic' target='main' title='toJson'>
#toJson
</a>
<small>
(ReplaceManager)
</small>
</li>
<li>
<a href='class/Word.html#toJson-dynamic' target='main' title='toJson'>
#toJson
</a>
<small>
(Word)
</small>
</li>
<li>
<a href='class/TextInsert.html#toJson-dynamic' target='main' title='toJson'>
#toJson
</a>
<small>
(TextInsert)
</small>
</li>
<li>
<a href='class/AddName.html#toJson-dynamic' target='main' title='toJson'>
#toJson
</a>
<small>
(AddName)
</small>
</li>
<li>
<a href='class/Delimiter.html#toJson-dynamic' target='main' title='toJson'>
#toJson
</a>
<small>
(Delimiter)
</small>
</li>
<li>
<a href='class/Replaceable.html#toJson-dynamic' target='main' title='toJson'>
#toJson
</a>
<small>
(Replaceable)
(Engine)
</small>
</li>
<li>
@ -725,6 +749,14 @@
(Insert)
</small>
</li>
<li>
<a href='class/Replaceable.html#val-dynamic' target='main' title='val'>
#val
</a>
<small>
(Replaceable)
</small>
</li>
<li>
<a href='class/ReplaceManager.html#val-dynamic' target='main' title='val'>
#val
@ -741,14 +773,6 @@
(TextInsert)
</small>
</li>
<li>
<a href='class/Replaceable.html#val-dynamic' target='main' title='val'>
#val
</a>
<small>
(Replaceable)
</small>
</li>
<li>
<a href='class/JsonType.html#val-dynamic' target='main' title='val'>
#val
@ -758,11 +782,11 @@
</small>
</li>
<li>
<a href='class/TextYatta.html#val-dynamic' target='main' title='val'>
<a href='class/ImmutableObject.html#val-dynamic' target='main' title='val'>
#val
</a>
<small>
(TextYatta)
(ImmutableObject)
</small>
</li>
<li>
@ -774,11 +798,19 @@
</small>
</li>
<li>
<a href='class/Insert.html#val-dynamic' target='main' title='val'>
<a href='class/MapManager.html#val-dynamic' target='main' title='val'>
#val
</a>
<small>
(Insert)
(MapManager)
</small>
</li>
<li>
<a href='class/TextYatta.html#val-dynamic' target='main' title='val'>
#val
</a>
<small>
(TextYatta)
</small>
</li>
<li>
@ -789,14 +821,6 @@
(Word)
</small>
</li>
<li>
<a href='class/MapManager.html#val-dynamic' target='main' title='val'>
#val
</a>
<small>
(MapManager)
</small>
</li>
<li>
<a href='class/Operation.html#validateSavedOperations-dynamic' target='main' title='validateSavedOperations'>
#validateSavedOperations
@ -805,6 +829,14 @@
(Operation)
</small>
</li>
<li>
<a href='class/JsonYatta.html#value-dynamic' target='main' title='value'>
#value
</a>
<small>
(JsonYatta)
</small>
</li>
</ul>
</div>
</body>

16
examples/JsonIwc.lit.md Normal file
View File

@ -0,0 +1,16 @@
Here, I will give a short overview on how to use the IwcYatta Framework.
function init(){
window.createIwcConnector(function(Connector){
console.log("initializing..");
yatta = new window.JsonYatta(1, Connector);
var dui = yatta.getConnector().duiClient
dui.getAppState()
console.log("initialized!");
})
}
$(document).ready(init)

View File

@ -41,7 +41,7 @@ createIwcConnector = (callback)->
sendRootElement = ()=>
json = {
root_element : @yatta.getRootElement()
HB : @yatta.getHistoryBuffer().toJson()
HB : @yatta.getHistoryBuffer()._encode()
}
@sendIwcIntent "Yatta_push_root_element", json
@iwcHandler["Yatta_get_root_element"] = [sendRootElement]
@ -94,5 +94,5 @@ createIwcConnector = (callback)->
undefined
module.exports = createIwcConnector
window?.createIwcConnector = createIwcConnector
window?.createConnector = createIwcConnector

View File

@ -17,7 +17,7 @@ module.exports = (user_list)->
@applied_operations.push o
@execution_listener.push appliedOperationsListener
if not (user_list?.length is 0)
@engine.applyOps user_list[0].getHistoryBuffer().toJson()
@engine.applyOps user_list[0].getHistoryBuffer()._encode()
@unexecuted = {}

View File

@ -22,9 +22,17 @@ class Engine
for o in ops
if not o.execute()
@unprocessed_ops.push o
@cleanUp()
@tryUnprocessed()
cleanUp: ()->
applyOp: (op_json)->
# $parse_and_execute will return false if $o_json was parsed and executed, otherwise the parsed operadion
o = @parseOperation op_json
@HB.addOperation o
if not o.execute()
@unprocessed_ops.push o
@tryUnprocessed()
tryUnprocessed: ()->
while true
old_length = @unprocessed_ops.length
unprocessed = []
@ -35,15 +43,7 @@ class Engine
if @unprocessed_ops.length is old_length
break
applyOp: (op_json)->
# $parse_and_execute will return false if $o_json was parsed and executed, otherwise the parsed operadion
o = @parseOperation op_json
@HB.addOperation o
if not o.execute()
@unprocessed_ops.push o
@cleanUp()
module.exports = Engine

View File

@ -4,7 +4,11 @@ HistoryBuffer = require "../HistoryBuffer.coffee"
Engine = require "../Engine.coffee"
#
# Framework for arbitrary Json data-structures.
# Framework for Json data-structures.
# Known values that are supported:
# * String
# * Integer
# * Array
#
class JsonYatta
constructor: (user_id, Connector)->
@ -21,23 +25,55 @@ class JsonYatta
else
@root_element = @HB.getOperation(root_elem)
#
# @result JsonType
#
getRootElement: ()->
@root_element
#
# @see Engine
#
getEngine: ()->
@engine
#
# Get the initialized connector.
#
getConnector: ()->
@connector
#
# @see HistoryBuffer
#
getHistoryBuffer: ()->
@HB
#
# @see JsonType.setMutableDefault
#
setMutableDefault: (mutable)->
@root_element.setMutableDefault(mutable)
#
# Get the UserId from the HistoryBuffer object.
# In most cases this will be the same as the user_id value with which
# JsonYatta was initialized (Depending on the HistoryBuffer implementation).
#
getUserId: ()->
@HB.getUserId()
val: (name, content)->
@root_element.val(name, content)
#
# @see JsonType.val
#
val : (name, content, mutable)->
@root_element.val(name, content, mutable)
#
# @see JsonType.value
#
value : ()->
@root_element.value
window?.JsonYatta = JsonYatta
module.exports = JsonYatta

View File

@ -30,12 +30,12 @@ class HistoryBuffer
res[user] = ctn
res
toJson: ()->
_encode: ()->
json = []
for u_name,user of @buffer
for o_number,o of user
if not isNaN(parseInt(o_number))
json.push o.toJson()
json.push o._encode()
json
#

View File

@ -7,35 +7,44 @@ module.exports = (HB)->
# A generic interface to operations.
#
# An operation has the following methods:
# toJson: encodes an operation (needed only if instance of this operation is sent).
# _encode: encodes an operation (needed only if instance of this operation is sent).
# execute: execute the effects of this operations. Good examples are Insert-type and AddName-type
# val: in the case that the operation holds a value
#
# Furthermore an encodable operation has a parser.
#
class Operation
# @param {Object} uid A unique identifier
#
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
# @see HistoryBuffer.getNextOperationIdentifier
#
constructor: (uid)->
if not uid?
uid = HB.getNextOperationIdentifier()
{
'creator': @creator
'op_number' : @op_number
} = uid
# Computes a unique identifier (uid).
#
# Computes a unique identifier (uid) that identifies this operation.
#
getUid: ()->
{ 'creator': @creator, 'op_number': @op_number }
#
# @private
# Notify the all the listeners.
#
execute: ()->
@is_executed = true
for l in execution_listener
l @toJson()
l @_encode()
@
#
# @private
# Operations may depend on other operations (linked lists, etc.).
# The saveOperation and validateSavedOperations methods provide
# an easy way to refer to these operations via an uid or object reference.
@ -68,6 +77,7 @@ module.exports = (HB)->
@unchecked[name] = op
#
# @private
# After calling this function all not instantiated operations will be accessible.
# @see Operation.saveOperation
#
@ -94,15 +104,21 @@ module.exports = (HB)->
# A simple Delete-type operation that deletes an Insert-type operation.
#
class Delete extends Operation
#
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
# @param {Object} deletes UID or reference of the operation that this to be deleted.
#
constructor: (uid, deletes)->
@saveOperation 'deletes', deletes
super uid
#
# @private
# Convert all relevant information of this operation to the json-format.
# This result can be sent to other clients.
#
toJson: ()->
_encode: ()->
{
'type': "Delete"
'uid': @getUid()
@ -110,6 +126,7 @@ module.exports = (HB)->
}
#
# @private
# Apply the deletion.
#
execute: ()->
@ -142,8 +159,7 @@ module.exports = (HB)->
class Insert extends Operation
#
# @param {Object} creator A unique user identifier
# @param {Integer} op_number This Number was assigned via getNextOperationIdentifier().
# @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)
#
@ -158,6 +174,9 @@ module.exports = (HB)->
@saveOperation 'origin', prev_cl
super uid
#
# @private
#
applyDelete: (o)->
@deleted_by ?= []
@deleted_by.push o
@ -169,6 +188,7 @@ module.exports = (HB)->
@deleted_by?.length > 0
#
# @private
# The amount of positions that $this operation was moved to the right.
#
getDistanceToOrigin: ()->
@ -185,6 +205,7 @@ module.exports = (HB)->
d
#
# @private
# Update the short list
# TODO (Unused)
update_sl: ()->
@ -203,6 +224,7 @@ module.exports = (HB)->
#
# @private
# Include this operation in the associative lists.
#
execute: ()->
@ -263,8 +285,47 @@ module.exports = (HB)->
super # notify the execution_listeners
@
val: ()->
throw new Error "Implement this function!"
#
# Defines an object that is cannot be changed. You can use this to set an immutable string, or a number.
#
class ImmutableObject extends Insert
#
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
# @param {Object} content
#
constructor: (uid, @content="", prev, next, origin)->
super uid, prev, next, origin
#
# @return [String] The content of this operation.
#
val : ()->
@content
_encode: ()->
json = {
'type': "ImmutableObject"
'uid' : @getUid()
'content' : @content
}
if @prev_cl?
json['prev'] = @prev_cl.getUid()
if @next_cl?
json['next'] = @next_cl.getUid()
if @origin? and @origin isnt @prev_cl
json["origin"] = @origin.getUid()
json
parser['ImmutableObject'] = (json)->
{
'uid' : uid
'content' : content
'prev': prev
'next': next
'origin' : origin
} = json
new ImmutableObject uid, content, prev, next, origin
#
# A delimiter is placed at the end and at the beginning of the associative lists.
@ -273,21 +334,21 @@ module.exports = (HB)->
#
class Delimiter extends Insert
isDeleted: ()->
false
getDistanceToOrigin: ()->
0
#
# @private
#
execute: ()->
if @validateSavedOperations()
for l in execution_listener
l @toJson()
l @_encode()
@
else
false
toJson: ()->
#
# @private
#
_encode: ()->
{
'type' : "Delimiter"
'uid' : @getUid()
@ -310,6 +371,7 @@ module.exports = (HB)->
'Insert' : Insert
'Delimiter': Delimiter
'Operation': Operation
'ImmutableObject' : ImmutableObject
'parser' : parser
'execution_listener' : execution_listener
}

View File

@ -5,48 +5,179 @@ module.exports = (HB)->
types = text_types.types
parser = text_types.parser
createJsonWrapper = (_jsonType)->
#
# A JsonWrapper was intended to be a convenient wrapper for the JsonType.
# But it can make things more difficult than they are.
# @see JsonType
#
# @example create a JsonWrapper
# # You get a JsonWrapper from a JsonType by calling
# w = yatta.value
#
# It creates Javascripts -getter and -setter methods for each property that JsonType maintains.
# @see getter https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
#
# @example Getter Example
# # you can access the x property of yatta by calling
# w.x
# # instead of
# yatta.val('x')
#
# @note You can only overwrite existing values! Setting a new property won't have any effect!
#
# @example Setter Example
# # you can set an existing x property of yatta by calling
# w.x = "text"
# # instead of
# yatta.val('x', "text")
#
# In order to set a new property you have to overwrite an existing property.
# Therefore the JsonWrapper supports a special feature that should make things more convenient
# (we can argue about that, use the JsonType if you don't like it ;).
# If you overwrite an object property of the JsonWrapper with a new object, it will result in a merged version of the objects.
# Let w.p the property that is to be overwritten and o the new value. E.g. w.p = o
# * The result has all properties of o
# * The result has all properties of w.p if they don't occur under the same property-name in o.
#
# @example Conflict Example
# yatta.value = {a : "string"}
# w = yatta.value
# console.log(w) # {a : "string"}
# w.a = {a : {b : "string"}}
# console.log(w) # {a : {b : "String"}}
# w.a = {a : {c : 4}}
# console.log(w) # {a : {b : "String", c : 4}}
#
# @example Common Pitfalls
# w = yatta.value
# # Setting a new property
# w.newProperty = "Awesome"
# console.log(w.newProperty == "Awesome") # false, w.newProperty is undefined
# # overwrite the w object
# w = {newProperty : "Awesome"}
# console.log(w.newProperty == "Awesome") # true!, but ..
# console.log(yatta.value.newProperty == "Awesome") # false, you are only allowed to set properties!
# # The solution
# yatta.value = {newProperty : "Awesome"}
# console.log(w.newProperty == "Awesome") # true!
#
class JsonWrapper
constructor: (jsonType)->
for name, obj of jsonType.map
do (name, obj)->
Object.defineProperty JsonWrapper.prototype, name,
get : ->
x = obj.val()
if x instanceof JsonType
createJsonWrapper x
else if x instanceof types.ImmutableObject
x.val()
else
x
set : (o)->
if o.constructor is {}.constructor
overwrite = jsonType.val(name)
for o_name,o_obj of o
overwrite.val(o_name, o_obj, 'immutable')
else
jsonType.val(name, o, 'immutable')
enumerable: true
configurable: false
new JsonWrapper _jsonType
#
# Manages Object-like values.
#
class JsonType extends types.MapManager
constructor: (uid, initial_value)->
#
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
# @param {Object} initial_value Create this operation with an initial value.
# @param {String|Boolean} Whether the initial_value should be created as mutable. (Optional - see setMutableDefault)
#
constructor: (uid, initial_value, mutable)->
super uid
if initial_value?
if typeof initial_value isnt "object"
throw new Error "The initial value of JsonTypes must be of type Object! (current type: #{typeof initial_value})"
for name,o of initial_value
@val name, o
@val name, o, mutable
mutable_default:
true
setMutableDefault: (mutable)->
if mutable is true or mutable is 'mutable'
JsonType.prototype.mutable_default = true
else if mutable is false or mutable is 'immutable'
JsonType.prototype.mutable_default = false
else
throw new Error 'Set mutable either "mutable" or "immutable"!'
'OK'
#
# Get this as a Json object. Note that none of the values of the result is of type Operation.
# @overload val()
# @results [Json]
# Get this as a Json object.
# @return [Json]
#
# Get value of a property.
# @overload val(name)
# Get value of a property.
# @param {String} name Name of the object property.
# @results [JsonType|WordType]
# @return [JsonType|Word|String|Object] Depending on the value of the property. If mutable it will return a Operation-type object, if immutable it will return String/Object.
#
# Set a new property.
# @overload val(name, content)
# Set a new property.
# @param {String} name Name of the object property.
# @param {Object|String} content Content of the object property.
# @return [JsonType] This object. (supports chaining)
#
val: (name, content)->
if name? and content?
if typeof content is 'string'
word = HB.addOperation(new types.Word HB.getNextOperationIdentifier(), content).execute()
super name, word
else if typeof content is 'object'
json = HB.addOperation(JsonType HB.getNextOperationIdentifier(), content).execute()
super name, json
else
throw new Error "You must not set #{typeof content}-types in collaborative Json-objects!"
val: (name, content, mutable)->
if typeof name is 'object'
# Special case. First argument is an object. Then the second arg is mutable.
# Keep that in mind when reading the following..
for o_name,o of name
@val(o_name,o,content)
@
else if name? and content?
if mutable?
if mutable is true or mutable is 'mutable'
mutable = true
else
mutable = false
else
mutable = @mutable_default
if typeof content is 'function'
@ # Just do nothing
else if ((not mutable) or typeof content is 'number') and content.constructor isnt Object
obj = HB.addOperation(new types.ImmutableObject undefined, content).execute()
super name, obj
else
if typeof content is 'string'
word = HB.addOperation(new types.Word HB.getNextOperationIdentifier(), content).execute()
super name, word
else if content.constructor is Object
json = HB.addOperation(new JsonType HB.getNextOperationIdentifier(), content, mutable).execute()
super name, json
else
throw new Error "You must not set #{typeof content}-types in collaborative Json-objects!"
else
super name, content
toJson: ()->
Object.defineProperty JsonType.prototype, 'value',
get : -> createJsonWrapper @
set : (o)->
if o.constructor is {}.constructor
for o_name,o_obj of o
@val(o_name, o_obj, 'immutable')
else
throw new Error "You must only set Object values!"
#
# @private
#
_encode: ()->
{
'type' : "JsonType"
'uid' : @getUid()
@ -59,6 +190,8 @@ module.exports = (HB)->
new JsonType uid
types['JsonType'] = JsonType
text_types

View File

@ -9,6 +9,10 @@ module.exports = (HB)->
# Manages map like objects. E.g. Json-Type and XML attributes.
#
class MapManager extends types.Operation
#
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
#
constructor: (uid)->
@map = {}
super uid
@ -18,12 +22,20 @@ module.exports = (HB)->
if not @map[name]?
HB.addOperation(new AddName HB.getNextOperationIdentifier(), @, name).execute()
@map[name].replace content
@
else if name?
@map[name]?.val()
obj = @map[name]?.val()
if obj instanceof types.ImmutableObject
obj.val()
else
obj
else
result = {}
for name,o of @map
result[name] = o.val()
obj = o.val()
if obj instanceof types.ImmutableObject or obj instanceof MapManager
obj = obj.val()
result[name] = obj
result
#
@ -33,6 +45,12 @@ module.exports = (HB)->
# only one will AddName operation will be executed.
#
class AddName extends types.Operation
#
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
# @param {Object} map_manager Uid or reference to the MapManager.
# @param {String} name Name of the property that will be added.
#
constructor: (uid, map_manager, @name)->
@saveOperation 'map_manager', map_manager
super uid
@ -54,7 +72,7 @@ module.exports = (HB)->
@map_manager.map[@name] = HB.addOperation(new ReplaceManager undefined, uid_r, beg, end).execute()
super
toJson: ()->
_encode: ()->
{
'type' : "AddName"
'uid' : @getUid()
@ -74,6 +92,12 @@ module.exports = (HB)->
# Manages a list of Insert-type operations.
#
class ListManager extends types.Insert
#
# A ListManager maintains a non-empty list that has a beginning and an end (both Delimiters!)
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
# @param {Delimiter} beginning Reference or Object.
# @param {Delimiter} end Reference or Object.
constructor: (uid, beginning, end, prev, next, origin)->
if beginning? and end?
@saveOperation 'beginning', beginning
@ -129,6 +153,11 @@ module.exports = (HB)->
# @see Word
#
class ReplaceManager extends ListManager
#
# @param {Operation} initial_content Initialize this with a Replaceable that holds the initial_content.
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
# @param {Delimiter} beginning Reference or Object.
# @param {Delimiter} end Reference or Object.
constructor: (initial_content, uid, beginning, end, prev, next, origin)->
super uid, beginning, end, prev, next, origin
if initial_content?
@ -145,7 +174,7 @@ module.exports = (HB)->
throw new Error "dtrn"
o.val()
toJson: ()->
_encode: ()->
json =
{
'type': "ReplaceManager"
@ -178,6 +207,12 @@ module.exports = (HB)->
# @see ReplaceManager
#
class Replaceable extends types.Insert
#
# @param {Operation} content The value that this Replaceable holds.
# @param {ReplaceManager} parent Used to replace this Replaceable with another one.
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
#
constructor: (content, parent, uid, prev, next, origin)->
@saveOperation 'content', content
@saveOperation 'parent', parent
@ -203,7 +238,7 @@ module.exports = (HB)->
# Convert all relevant information of this operation to the json-format.
# This result can be send to other clients.
#
toJson: ()->
_encode: ()->
json =
{
'type': "Replaceable"

View File

@ -16,6 +16,10 @@ module.exports = (HB)->
# Extends the basic Insert type to an operation that holds a text value
#
class TextInsert extends types.Insert
#
# @param {String} content The content of this Insert-type Operation. Usually you restrict the length of content to size 1
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
#
constructor: (@content, uid, prev, next, origin)->
if not (prev? and next?)
throw new Error "You must define prev, and next for TextInsert-types!"
@ -44,7 +48,7 @@ module.exports = (HB)->
# Convert all relevant information of this operation to the json-format.
# This result can be send to other clients.
#
toJson: ()->
_encode: ()->
json =
{
'type': "TextInsert"
@ -71,6 +75,11 @@ module.exports = (HB)->
# Handles a Text-like data structures with support for insertText/deleteText at a word-position.
#
class Word extends types.ListManager
#
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
# @param {String} initial_content
#
constructor: (uid, initial_content, beginning, end, prev, next, origin)->
super uid, beginning, end, prev, next, origin
if initial_content?
@ -97,7 +106,7 @@ module.exports = (HB)->
if o instanceof types.Delimiter
throw new Error "You can't delete more than there is.."
o = o.next_cl
d.toJson()
d._encode()
#
# Replace the content of this word with another one. Concurrent replacements are not merged!
@ -133,7 +142,7 @@ module.exports = (HB)->
@saveOperation 'replace_manager', op
@validateSavedOperations
toJson: ()->
_encode: ()->
json = {
'type': "Word"
'uid' : @getUid()
@ -162,7 +171,6 @@ module.exports = (HB)->
types['TextInsert'] = TextInsert
types['TextDelete'] = TextDelete
types['Word'] = Word
structured_types

View File

@ -13,12 +13,13 @@ Connector_uninitialized = require "../lib/Connectors/TestConnector.coffee"
class Test
constructor: ()->
@number_of_test_cases_multiplier = 1
@repeat_this = 100 * @number_of_test_cases_multiplier
@repeat_this = 10 * @number_of_test_cases_multiplier
@doSomething_amount = 200 * @number_of_test_cases_multiplier
@number_of_engines = 12 + @number_of_test_cases_multiplier - 1
@time = 0
@ops = 0
@time_now = 0
@reinitialize()
@ -31,6 +32,10 @@ class Test
for i in [1...@number_of_engines]
@users.push(new Yatta i, @Connector)
getSomeUser: ()->
i = _.random 0, (@users.length-1)
@users[i]
getRandomText: ()->
chars = "abcdefghijklmnopqrstuvwxyz"
length = _.random 0, 10
@ -74,59 +79,98 @@ class Test
for user,user_number in @users
user.getConnector().flushAll()
compareAll: (test_number)->
@flushAll()
@time += (new Date()).getTime() - @time_now
number_of_created_operations = 0
for i in [0...(@users.length)]
number_of_created_operations += @users[i].getConnector().getOpsInExecutionOrder().length
@ops += number_of_created_operations*@users.length
ops_per_msek = Math.floor(@ops/@time)
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 users[0].val('name').val()
for i in [0...(@users.length-1)]
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)->
ops = @users[otnumber].getConnector().getOpsInExecutionOrder()
for s in ops
console.log JSON.stringify s
console.log ""
s = "ops = ["
for o,j in ops
if j isnt 0
s += ", "
s += "op#{j}"
s += "]"
console.log s
console.log "@users[@last_user].ot.applyOps ops"
console.log "expect(@users[@last_user].ot.val('name')).to.equal(\"#{users[otherotnumber].val('name')}\")"
ops
console.log ""
console.log "Found an OT Puzzle!"
console.log "OT states:"
for u,j in users
console.log "OT#{j}: "+u.val('name')
console.log "\nOT execution order (#{i},#{i+1}):"
printOpsInExecutionOrder i, i+1
console.log ""
ops = printOpsInExecutionOrder i+1, i
console.log ""
run: ()->
console.log ''
for times in [1..@repeat_this]
@reinitialize()
time_now = (new Date).getTime()
@time_now = (new Date).getTime()
for i in [1..@doSomething_amount]
@doSomething()
@flushAll()
@time += (new Date()).getTime() - time_now
number_of_created_operations = 0
for i in [0...(@users.length)]
number_of_created_operations += @users[i].getConnector().getOpsInExecutionOrder().length
@ops += number_of_created_operations*@users.length
ops_per_msek = Math.floor(@ops/@time)
console.log "#{times}/#{@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[0].val('name').val()
for i in [0...(@users.length-1)]
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)->
ops = @users[otnumber].getConnector().getOpsInExecutionOrder()
for s in ops
console.log JSON.stringify s
console.log ""
s = "ops = ["
for o,j in ops
if j isnt 0
s += ", "
s += "op#{j}"
s += "]"
console.log s
console.log "@users[@last_user].ot.applyOps ops"
console.log "expect(@users[@last_user].ot.val('name')).to.equal(\"#{users[otherotnumber].val('name')}\")"
ops
console.log ""
console.log "Found an OT Puzzle!"
console.log "OT states:"
for u,j in users
console.log "OT#{j}: "+u.val('name')
console.log "\nOT execution order (#{i},#{i+1}):"
printOpsInExecutionOrder i, i+1
console.log ""
ops = printOpsInExecutionOrder i+1, i
console.log ""
@compareAll(times)
@reinitialize()
describe "JsonYatta", ->
beforeEach (done)->
@yTest = new Test()
done()
it "has a JsonWrapper", ->
y = this.yTest.getSomeUser().root_element
y.val('x',"dtrn", 'immutable')
y.val('set',{x:"x"}, 'immutable')
w = y.value
w.x
w.set = {y:""}
w.x
w.set
w.set.x
expect(w.x).to.equal("dtrn")
expect(w.set.x).to.equal("x")
it "can handle creaton of complex json", ->
@yTest.getSomeUser().val('x', {'a':'b'})
@yTest.getSomeUser().val('a', {'a':{q:"dtrndtrtdrntdrnrtdnrtdnrtdnrtdnrdnrdt"}})
@yTest.getSomeUser().val('b', {'a':{}})
@yTest.getSomeUser().val('c', {'a':'b'})
@yTest.compareAll()
it "handles some immutable tests", ->
@yTest.getSomeUser().val('string', "text", "immutable")
@yTest.getSomeUser().val('number', 4, "immutable")
@yTest.getSomeUser().val('object', {q:"rr"}, "immutable")
@yTest.compareAll()
expect(@yTest.getSomeUser().val('string')).to.equal "text"
expect(@yTest.getSomeUser().val('number')).to.equal 4
expect(@yTest.getSomeUser().val('object').val('q')).to.equal "rr"
it "can handle many engines, many operations, concurrently (random)", ->
yTest = new Test()
yTest.run()
@yTest.run()