devided ops/types
This commit is contained in:
parent
1aacc0e967
commit
792440a71d
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2,11 +2,11 @@ var __slice = [].slice,
|
|||||||
__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; },
|
__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; },
|
||||||
__hasProp = {}.hasOwnProperty;
|
__hasProp = {}.hasOwnProperty;
|
||||||
|
|
||||||
module.exports = function(HB) {
|
module.exports = function() {
|
||||||
var execution_listener, types;
|
var execution_listener, ops;
|
||||||
types = {};
|
ops = {};
|
||||||
execution_listener = [];
|
execution_listener = [];
|
||||||
types.Operation = (function() {
|
ops.Operation = (function() {
|
||||||
function Operation(uid) {
|
function Operation(uid) {
|
||||||
this.is_deleted = false;
|
this.is_deleted = false;
|
||||||
this.garbage_collected = false;
|
this.garbage_collected = false;
|
||||||
@ -37,7 +37,7 @@ module.exports = function(HB) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Operation.prototype["delete"] = function() {
|
Operation.prototype["delete"] = function() {
|
||||||
(new types.Delete(void 0, this)).execute();
|
(new ops.Delete(void 0, this)).execute();
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -69,13 +69,13 @@ module.exports = function(HB) {
|
|||||||
this.is_deleted = true;
|
this.is_deleted = true;
|
||||||
if (garbagecollect) {
|
if (garbagecollect) {
|
||||||
this.garbage_collected = true;
|
this.garbage_collected = true;
|
||||||
return HB.addToGarbageCollector(this);
|
return this.HB.addToGarbageCollector(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Operation.prototype.cleanup = function() {
|
Operation.prototype.cleanup = function() {
|
||||||
HB.removeOperation(this);
|
this.HB.removeOperation(this);
|
||||||
return this.deleteAllObservers();
|
return this.deleteAllObservers();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -117,10 +117,10 @@ module.exports = function(HB) {
|
|||||||
var l, _i, _len;
|
var l, _i, _len;
|
||||||
this.is_executed = true;
|
this.is_executed = true;
|
||||||
if (this.uid == null) {
|
if (this.uid == null) {
|
||||||
this.uid = HB.getNextOperationIdentifier();
|
this.uid = this.HB.getNextOperationIdentifier();
|
||||||
}
|
}
|
||||||
if (this.uid.noOperation == null) {
|
if (this.uid.noOperation == null) {
|
||||||
HB.addOperation(this);
|
this.HB.addOperation(this);
|
||||||
for (_i = 0, _len = execution_listener.length; _i < _len; _i++) {
|
for (_i = 0, _len = execution_listener.length; _i < _len; _i++) {
|
||||||
l = execution_listener[_i];
|
l = execution_listener[_i];
|
||||||
l(this._encode());
|
l(this._encode());
|
||||||
@ -149,7 +149,7 @@ module.exports = function(HB) {
|
|||||||
_ref = this.unchecked;
|
_ref = this.unchecked;
|
||||||
for (name in _ref) {
|
for (name in _ref) {
|
||||||
op_uid = _ref[name];
|
op_uid = _ref[name];
|
||||||
op = HB.getOperation(op_uid);
|
op = this.HB.getOperation(op_uid);
|
||||||
if (op) {
|
if (op) {
|
||||||
this[name] = op;
|
this[name] = op;
|
||||||
} else {
|
} else {
|
||||||
@ -167,7 +167,7 @@ module.exports = function(HB) {
|
|||||||
return Operation;
|
return Operation;
|
||||||
|
|
||||||
})();
|
})();
|
||||||
types.Delete = (function(_super) {
|
ops.Delete = (function(_super) {
|
||||||
__extends(Delete, _super);
|
__extends(Delete, _super);
|
||||||
|
|
||||||
function Delete(uid, deletes) {
|
function Delete(uid, deletes) {
|
||||||
@ -200,13 +200,13 @@ module.exports = function(HB) {
|
|||||||
|
|
||||||
return Delete;
|
return Delete;
|
||||||
|
|
||||||
})(types.Operation);
|
})(ops.Operation);
|
||||||
types.Delete.parse = function(o) {
|
ops.Delete.parse = function(o) {
|
||||||
var deletes_uid, uid;
|
var deletes_uid, uid;
|
||||||
uid = o['uid'], deletes_uid = o['deletes'];
|
uid = o['uid'], deletes_uid = o['deletes'];
|
||||||
return new this(uid, deletes_uid);
|
return new this(uid, deletes_uid);
|
||||||
};
|
};
|
||||||
types.Insert = (function(_super) {
|
ops.Insert = (function(_super) {
|
||||||
__extends(Insert, _super);
|
__extends(Insert, _super);
|
||||||
|
|
||||||
function Insert(content, uid, prev_cl, next_cl, origin, parent) {
|
function Insert(content, uid, prev_cl, next_cl, origin, parent) {
|
||||||
@ -257,7 +257,7 @@ module.exports = function(HB) {
|
|||||||
if ((_ref = this.prev_cl) != null ? _ref.isDeleted() : void 0) {
|
if ((_ref = this.prev_cl) != null ? _ref.isDeleted() : void 0) {
|
||||||
this.prev_cl.applyDelete();
|
this.prev_cl.applyDelete();
|
||||||
}
|
}
|
||||||
if (this.content instanceof types.Operation) {
|
if (this.content instanceof ops.Operation) {
|
||||||
this.content.applyDelete();
|
this.content.applyDelete();
|
||||||
}
|
}
|
||||||
return delete this.content;
|
return delete this.content;
|
||||||
@ -303,7 +303,7 @@ module.exports = function(HB) {
|
|||||||
if (!this.validateSavedOperations()) {
|
if (!this.validateSavedOperations()) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (this.content instanceof types.Operation) {
|
if (this.content instanceof ops.Operation) {
|
||||||
this.content.insert_parent = this;
|
this.content.insert_parent = this;
|
||||||
}
|
}
|
||||||
if (this.parent != null) {
|
if (this.parent != null) {
|
||||||
@ -389,7 +389,7 @@ module.exports = function(HB) {
|
|||||||
position = 0;
|
position = 0;
|
||||||
prev = this.prev_cl;
|
prev = this.prev_cl;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (prev instanceof types.Delimiter) {
|
if (prev instanceof ops.Delimiter) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!prev.isDeleted()) {
|
if (!prev.isDeleted()) {
|
||||||
@ -424,8 +424,8 @@ module.exports = function(HB) {
|
|||||||
|
|
||||||
return Insert;
|
return Insert;
|
||||||
|
|
||||||
})(types.Operation);
|
})(ops.Operation);
|
||||||
types.Insert.parse = function(json) {
|
ops.Insert.parse = function(json) {
|
||||||
var content, next, origin, parent, prev, uid;
|
var content, next, origin, parent, prev, uid;
|
||||||
content = json['content'], uid = json['uid'], prev = json['prev'], next = json['next'], origin = json['origin'], parent = json['parent'];
|
content = json['content'], uid = json['uid'], prev = json['prev'], next = json['next'], origin = json['origin'], parent = json['parent'];
|
||||||
if (typeof content === "string") {
|
if (typeof content === "string") {
|
||||||
@ -433,7 +433,7 @@ module.exports = function(HB) {
|
|||||||
}
|
}
|
||||||
return new this(content, uid, prev, next, origin, parent);
|
return new this(content, uid, prev, next, origin, parent);
|
||||||
};
|
};
|
||||||
types.ImmutableObject = (function(_super) {
|
ops.ImmutableObject = (function(_super) {
|
||||||
__extends(ImmutableObject, _super);
|
__extends(ImmutableObject, _super);
|
||||||
|
|
||||||
function ImmutableObject(uid, _at_content) {
|
function ImmutableObject(uid, _at_content) {
|
||||||
@ -459,13 +459,13 @@ module.exports = function(HB) {
|
|||||||
|
|
||||||
return ImmutableObject;
|
return ImmutableObject;
|
||||||
|
|
||||||
})(types.Operation);
|
})(ops.Operation);
|
||||||
types.ImmutableObject.parse = function(json) {
|
ops.ImmutableObject.parse = function(json) {
|
||||||
var content, uid;
|
var content, uid;
|
||||||
uid = json['uid'], content = json['content'];
|
uid = json['uid'], content = json['content'];
|
||||||
return new this(uid, content);
|
return new this(uid, content);
|
||||||
};
|
};
|
||||||
types.Delimiter = (function(_super) {
|
ops.Delimiter = (function(_super) {
|
||||||
__extends(Delimiter, _super);
|
__extends(Delimiter, _super);
|
||||||
|
|
||||||
function Delimiter(prev_cl, next_cl, origin) {
|
function Delimiter(prev_cl, next_cl, origin) {
|
||||||
@ -529,14 +529,14 @@ module.exports = function(HB) {
|
|||||||
|
|
||||||
return Delimiter;
|
return Delimiter;
|
||||||
|
|
||||||
})(types.Operation);
|
})(ops.Operation);
|
||||||
types.Delimiter.parse = function(json) {
|
ops.Delimiter.parse = function(json) {
|
||||||
var next, prev, uid;
|
var next, prev, uid;
|
||||||
uid = json['uid'], prev = json['prev'], next = json['next'];
|
uid = json['uid'], prev = json['prev'], next = json['next'];
|
||||||
return new this(uid, prev, next);
|
return new this(uid, prev, next);
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
'types': types,
|
'operations': ops,
|
||||||
'execution_listener': execution_listener
|
'execution_listener': execution_listener
|
||||||
};
|
};
|
||||||
};
|
};
|
@ -1,14 +1,14 @@
|
|||||||
var text_types_uninitialized,
|
var text_ops_uninitialized,
|
||||||
__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; },
|
__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; },
|
||||||
__hasProp = {}.hasOwnProperty;
|
__hasProp = {}.hasOwnProperty;
|
||||||
|
|
||||||
text_types_uninitialized = require("./TextTypes");
|
text_ops_uninitialized = require("./Text");
|
||||||
|
|
||||||
module.exports = function(HB) {
|
module.exports = function() {
|
||||||
var text_types, types;
|
var ops, text_ops;
|
||||||
text_types = text_types_uninitialized(HB);
|
text_ops = text_ops_uninitialized();
|
||||||
types = text_types.types;
|
ops = text_ops.operations;
|
||||||
types.Object = (function(_super) {
|
ops.Object = (function(_super) {
|
||||||
__extends(Object, _super);
|
__extends(Object, _super);
|
||||||
|
|
||||||
function Object() {
|
function Object() {
|
||||||
@ -35,11 +35,11 @@ module.exports = function(HB) {
|
|||||||
json = {};
|
json = {};
|
||||||
for (name in val) {
|
for (name in val) {
|
||||||
o = val[name];
|
o = val[name];
|
||||||
if (o instanceof types.Object) {
|
if (o instanceof ops.Object) {
|
||||||
json[name] = o.toJson(transform_to_value);
|
json[name] = o.toJson(transform_to_value);
|
||||||
} else if (o instanceof types.ListManager) {
|
} else if (o instanceof ops.ListManager) {
|
||||||
json[name] = o.toJson(transform_to_value);
|
json[name] = o.toJson(transform_to_value);
|
||||||
} else if (transform_to_value && o instanceof types.Operation) {
|
} else if (transform_to_value && o instanceof ops.Operation) {
|
||||||
json[name] = o.val();
|
json[name] = o.val();
|
||||||
} else {
|
} else {
|
||||||
json[name] = o;
|
json[name] = o;
|
||||||
@ -66,7 +66,7 @@ module.exports = function(HB) {
|
|||||||
_results = [];
|
_results = [];
|
||||||
for (_i = 0, _len = events.length; _i < _len; _i++) {
|
for (_i = 0, _len = events.length; _i < _len; _i++) {
|
||||||
event = events[_i];
|
event = events[_i];
|
||||||
if (event.created_ !== HB.getUserId()) {
|
if (event.created_ !== this.HB.getUserId()) {
|
||||||
notifier = Object.getNotifier(that.bound_json);
|
notifier = Object.getNotifier(that.bound_json);
|
||||||
oldVal = that.bound_json[event.name];
|
oldVal = that.bound_json[event.name];
|
||||||
if (oldVal != null) {
|
if (oldVal != null) {
|
||||||
@ -107,7 +107,7 @@ module.exports = function(HB) {
|
|||||||
var args, i, o, type, _i, _ref;
|
var args, i, o, type, _i, _ref;
|
||||||
if ((name != null) && arguments.length > 1) {
|
if ((name != null) && arguments.length > 1) {
|
||||||
if ((content != null) && (content.constructor != null)) {
|
if ((content != null) && (content.constructor != null)) {
|
||||||
type = types[content.constructor.name];
|
type = ops[content.constructor.name];
|
||||||
if ((type != null) && (type.create != null)) {
|
if ((type != null) && (type.create != null)) {
|
||||||
args = [];
|
args = [];
|
||||||
for (i = _i = 1, _ref = arguments.length; 1 <= _ref ? _i < _ref : _i > _ref; i = 1 <= _ref ? ++_i : --_i) {
|
for (i = _i = 1, _ref = arguments.length; 1 <= _ref ? _i < _ref : _i > _ref; i = 1 <= _ref ? ++_i : --_i) {
|
||||||
@ -135,24 +135,24 @@ module.exports = function(HB) {
|
|||||||
|
|
||||||
return Object;
|
return Object;
|
||||||
|
|
||||||
})(types.MapManager);
|
})(ops.MapManager);
|
||||||
types.Object.parse = function(json) {
|
ops.Object.parse = function(json) {
|
||||||
var uid;
|
var uid;
|
||||||
uid = json['uid'];
|
uid = json['uid'];
|
||||||
return new this(uid);
|
return new this(uid);
|
||||||
};
|
};
|
||||||
types.Object.create = function(content, mutable) {
|
ops.Object.create = function(content, mutable) {
|
||||||
var json, n, o;
|
var json, n, o;
|
||||||
json = new types.Object().execute();
|
json = new ops.Object().execute();
|
||||||
for (n in content) {
|
for (n in content) {
|
||||||
o = content[n];
|
o = content[n];
|
||||||
json.val(n, o, mutable);
|
json.val(n, o, mutable);
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
};
|
};
|
||||||
types.Number = {};
|
ops.Number = {};
|
||||||
types.Number.create = function(content) {
|
ops.Number.create = function(content) {
|
||||||
return content;
|
return content;
|
||||||
};
|
};
|
||||||
return text_types;
|
return text_ops;
|
||||||
};
|
};
|
@ -1,14 +1,14 @@
|
|||||||
var basic_types_uninitialized,
|
var basic_ops_uninitialized,
|
||||||
__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; },
|
__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; },
|
||||||
__hasProp = {}.hasOwnProperty;
|
__hasProp = {}.hasOwnProperty;
|
||||||
|
|
||||||
basic_types_uninitialized = require("./BasicTypes");
|
basic_ops_uninitialized = require("./Basic");
|
||||||
|
|
||||||
module.exports = function(HB) {
|
module.exports = function() {
|
||||||
var basic_types, types;
|
var basic_ops, ops;
|
||||||
basic_types = basic_types_uninitialized(HB);
|
basic_ops = basic_ops_uninitialized();
|
||||||
types = basic_types.types;
|
ops = basic_ops.operations;
|
||||||
types.MapManager = (function(_super) {
|
ops.MapManager = (function(_super) {
|
||||||
__extends(MapManager, _super);
|
__extends(MapManager, _super);
|
||||||
|
|
||||||
function MapManager(uid) {
|
function MapManager(uid) {
|
||||||
@ -77,7 +77,7 @@ module.exports = function(HB) {
|
|||||||
sub: property_name,
|
sub: property_name,
|
||||||
alt: this
|
alt: this
|
||||||
};
|
};
|
||||||
rm = new types.ReplaceManager(event_properties, event_this, rm_uid);
|
rm = new ops.ReplaceManager(event_properties, event_this, rm_uid);
|
||||||
this.map[property_name] = rm;
|
this.map[property_name] = rm;
|
||||||
rm.setParent(this, property_name);
|
rm.setParent(this, property_name);
|
||||||
rm.execute();
|
rm.execute();
|
||||||
@ -87,13 +87,13 @@ module.exports = function(HB) {
|
|||||||
|
|
||||||
return MapManager;
|
return MapManager;
|
||||||
|
|
||||||
})(types.Operation);
|
})(ops.Operation);
|
||||||
types.ListManager = (function(_super) {
|
ops.ListManager = (function(_super) {
|
||||||
__extends(ListManager, _super);
|
__extends(ListManager, _super);
|
||||||
|
|
||||||
function ListManager(uid) {
|
function ListManager(uid) {
|
||||||
this.beginning = new types.Delimiter(void 0, void 0);
|
this.beginning = new ops.Delimiter(void 0, void 0);
|
||||||
this.end = new types.Delimiter(this.beginning, void 0);
|
this.end = new ops.Delimiter(this.beginning, void 0);
|
||||||
this.beginning.next_cl = this.end;
|
this.beginning.next_cl = this.end;
|
||||||
this.beginning.execute();
|
this.beginning.execute();
|
||||||
this.end.execute();
|
this.end.execute();
|
||||||
@ -125,11 +125,11 @@ module.exports = function(HB) {
|
|||||||
_results = [];
|
_results = [];
|
||||||
for (o = _i = 0, _len = val.length; _i < _len; o = ++_i) {
|
for (o = _i = 0, _len = val.length; _i < _len; o = ++_i) {
|
||||||
i = val[o];
|
i = val[o];
|
||||||
if (o instanceof types.Object) {
|
if (o instanceof ops.Object) {
|
||||||
_results.push(o.toJson(transform_to_value));
|
_results.push(o.toJson(transform_to_value));
|
||||||
} else if (o instanceof types.ListManager) {
|
} else if (o instanceof ops.ListManager) {
|
||||||
_results.push(o.toJson(transform_to_value));
|
_results.push(o.toJson(transform_to_value));
|
||||||
} else if (transform_to_value && o instanceof types.Operation) {
|
} else if (transform_to_value && o instanceof ops.Operation) {
|
||||||
_results.push(o.val());
|
_results.push(o.val());
|
||||||
} else {
|
} else {
|
||||||
_results.push(o);
|
_results.push(o);
|
||||||
@ -198,7 +198,7 @@ module.exports = function(HB) {
|
|||||||
var o;
|
var o;
|
||||||
if (pos != null) {
|
if (pos != null) {
|
||||||
o = this.getOperationByPosition(pos + 1);
|
o = this.getOperationByPosition(pos + 1);
|
||||||
if (!(o instanceof types.Delimiter)) {
|
if (!(o instanceof ops.Delimiter)) {
|
||||||
return o.val();
|
return o.val();
|
||||||
} else {
|
} else {
|
||||||
throw new Error("this position does not exist");
|
throw new Error("this position does not exist");
|
||||||
@ -212,7 +212,7 @@ module.exports = function(HB) {
|
|||||||
var o;
|
var o;
|
||||||
o = this.beginning;
|
o = this.beginning;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (o instanceof types.Delimiter && (o.prev_cl != null)) {
|
if (o instanceof ops.Delimiter && (o.prev_cl != null)) {
|
||||||
o = o.prev_cl;
|
o = o.prev_cl;
|
||||||
while (o.isDeleted() && (o.prev_cl != null)) {
|
while (o.isDeleted() && (o.prev_cl != null)) {
|
||||||
o = o.prev_cl;
|
o = o.prev_cl;
|
||||||
@ -239,7 +239,7 @@ module.exports = function(HB) {
|
|||||||
createContent = function(content, options) {
|
createContent = function(content, options) {
|
||||||
var type;
|
var type;
|
||||||
if ((content != null) && (content.constructor != null)) {
|
if ((content != null) && (content.constructor != null)) {
|
||||||
type = types[content.constructor.name];
|
type = ops[content.constructor.name];
|
||||||
if ((type != null) && (type.create != null)) {
|
if ((type != null) && (type.create != null)) {
|
||||||
return type.create(content, options);
|
return type.create(content, options);
|
||||||
} else {
|
} else {
|
||||||
@ -254,12 +254,12 @@ module.exports = function(HB) {
|
|||||||
right = right.next_cl;
|
right = right.next_cl;
|
||||||
}
|
}
|
||||||
left = right.prev_cl;
|
left = right.prev_cl;
|
||||||
if (content instanceof types.Operation) {
|
if (content instanceof ops.Operation) {
|
||||||
(new types.Insert(content, void 0, left, right)).execute();
|
(new ops.Insert(content, void 0, left, right)).execute();
|
||||||
} else {
|
} else {
|
||||||
for (_i = 0, _len = content.length; _i < _len; _i++) {
|
for (_i = 0, _len = content.length; _i < _len; _i++) {
|
||||||
c = content[_i];
|
c = content[_i];
|
||||||
tmp = (new types.Insert(createContent(c, options), void 0, left, right)).execute();
|
tmp = (new ops.Insert(createContent(c, options), void 0, left, right)).execute();
|
||||||
left = tmp;
|
left = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -277,12 +277,12 @@ module.exports = function(HB) {
|
|||||||
o = this.getOperationByPosition(position + 1);
|
o = this.getOperationByPosition(position + 1);
|
||||||
delete_ops = [];
|
delete_ops = [];
|
||||||
for (i = _i = 0; 0 <= length ? _i < length : _i > length; i = 0 <= length ? ++_i : --_i) {
|
for (i = _i = 0; 0 <= length ? _i < length : _i > length; i = 0 <= length ? ++_i : --_i) {
|
||||||
if (o instanceof types.Delimiter) {
|
if (o instanceof ops.Delimiter) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
d = (new types.Delete(void 0, o)).execute();
|
d = (new ops.Delete(void 0, o)).execute();
|
||||||
o = o.next_cl;
|
o = o.next_cl;
|
||||||
while ((!(o instanceof types.Delimiter)) && o.isDeleted()) {
|
while ((!(o instanceof ops.Delimiter)) && o.isDeleted()) {
|
||||||
o = o.next_cl;
|
o = o.next_cl;
|
||||||
}
|
}
|
||||||
delete_ops.push(d._encode());
|
delete_ops.push(d._encode());
|
||||||
@ -301,17 +301,17 @@ module.exports = function(HB) {
|
|||||||
|
|
||||||
return ListManager;
|
return ListManager;
|
||||||
|
|
||||||
})(types.Operation);
|
})(ops.Operation);
|
||||||
types.ListManager.parse = function(json) {
|
ops.ListManager.parse = function(json) {
|
||||||
var uid;
|
var uid;
|
||||||
uid = json['uid'];
|
uid = json['uid'];
|
||||||
return new this(uid);
|
return new this(uid);
|
||||||
};
|
};
|
||||||
types.Array = function() {};
|
ops.Array = function() {};
|
||||||
types.Array.create = function(content, mutable) {
|
ops.Array.create = function(content, mutable) {
|
||||||
var ith, list;
|
var ith, list;
|
||||||
if (mutable === "mutable") {
|
if (mutable === "mutable") {
|
||||||
list = new types.ListManager().execute();
|
list = new ops.ListManager().execute();
|
||||||
ith = list.getOperationByPosition(0);
|
ith = list.getOperationByPosition(0);
|
||||||
list.insertAfter(ith, content);
|
list.insertAfter(ith, content);
|
||||||
return list;
|
return list;
|
||||||
@ -321,7 +321,7 @@ module.exports = function(HB) {
|
|||||||
throw new Error("Specify either \"mutable\" or \"immutable\"!!");
|
throw new Error("Specify either \"mutable\" or \"immutable\"!!");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
types.ReplaceManager = (function(_super) {
|
ops.ReplaceManager = (function(_super) {
|
||||||
__extends(ReplaceManager, _super);
|
__extends(ReplaceManager, _super);
|
||||||
|
|
||||||
function ReplaceManager(_at_event_properties, _at_event_this, uid, beginning, end) {
|
function ReplaceManager(_at_event_properties, _at_event_this, uid, beginning, end) {
|
||||||
@ -368,7 +368,7 @@ module.exports = function(HB) {
|
|||||||
ReplaceManager.prototype.replace = function(content, replaceable_uid) {
|
ReplaceManager.prototype.replace = function(content, replaceable_uid) {
|
||||||
var o, relp;
|
var o, relp;
|
||||||
o = this.getLastOperation();
|
o = this.getLastOperation();
|
||||||
relp = (new types.Replaceable(content, this, replaceable_uid, o, o.next_cl)).execute();
|
relp = (new ops.Replaceable(content, this, replaceable_uid, o, o.next_cl)).execute();
|
||||||
return void 0;
|
return void 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -377,7 +377,7 @@ module.exports = function(HB) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ReplaceManager.prototype.deleteContent = function() {
|
ReplaceManager.prototype.deleteContent = function() {
|
||||||
(new types.Delete(void 0, this.getLastOperation().uid)).execute();
|
(new ops.Delete(void 0, this.getLastOperation().uid)).execute();
|
||||||
return void 0;
|
return void 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -400,8 +400,8 @@ module.exports = function(HB) {
|
|||||||
|
|
||||||
return ReplaceManager;
|
return ReplaceManager;
|
||||||
|
|
||||||
})(types.ListManager);
|
})(ops.ListManager);
|
||||||
types.Replaceable = (function(_super) {
|
ops.Replaceable = (function(_super) {
|
||||||
__extends(Replaceable, _super);
|
__extends(Replaceable, _super);
|
||||||
|
|
||||||
function Replaceable(content, parent, uid, prev, next, origin, is_deleted) {
|
function Replaceable(content, parent, uid, prev, next, origin, is_deleted) {
|
||||||
@ -494,7 +494,7 @@ module.exports = function(HB) {
|
|||||||
} else if (this.origin !== this.prev_cl) {
|
} else if (this.origin !== this.prev_cl) {
|
||||||
json.origin = this.origin.getUid();
|
json.origin = this.origin.getUid();
|
||||||
}
|
}
|
||||||
if (this.content instanceof types.Operation) {
|
if (this.content instanceof ops.Operation) {
|
||||||
json['content'] = this.content.getUid();
|
json['content'] = this.content.getUid();
|
||||||
} else {
|
} else {
|
||||||
if ((this.content != null) && (this.content.creator != null)) {
|
if ((this.content != null) && (this.content.creator != null)) {
|
||||||
@ -507,11 +507,11 @@ module.exports = function(HB) {
|
|||||||
|
|
||||||
return Replaceable;
|
return Replaceable;
|
||||||
|
|
||||||
})(types.Insert);
|
})(ops.Insert);
|
||||||
types.Replaceable.parse = function(json) {
|
ops.Replaceable.parse = function(json) {
|
||||||
var content, is_deleted, next, origin, parent, prev, uid;
|
var content, is_deleted, next, origin, parent, prev, uid;
|
||||||
content = json['content'], parent = json['parent'], uid = json['uid'], prev = json['prev'], next = json['next'], origin = json['origin'], is_deleted = json['is_deleted'];
|
content = json['content'], parent = json['parent'], uid = json['uid'], prev = json['prev'], next = json['next'], origin = json['origin'], is_deleted = json['is_deleted'];
|
||||||
return new this(content, parent, uid, prev, next, origin, is_deleted);
|
return new this(content, parent, uid, prev, next, origin, is_deleted);
|
||||||
};
|
};
|
||||||
return basic_types;
|
return basic_ops;
|
||||||
};
|
};
|
@ -1,15 +1,14 @@
|
|||||||
var structured_types_uninitialized,
|
var structured_ops_uninitialized,
|
||||||
__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; },
|
__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; },
|
||||||
__hasProp = {}.hasOwnProperty;
|
__hasProp = {}.hasOwnProperty;
|
||||||
|
|
||||||
structured_types_uninitialized = require("./StructuredTypes");
|
structured_ops_uninitialized = require("./Structured");
|
||||||
|
|
||||||
module.exports = function(HB) {
|
module.exports = function() {
|
||||||
var parser, structured_types, types;
|
var ops, structured_ops;
|
||||||
structured_types = structured_types_uninitialized(HB);
|
structured_ops = structured_ops_uninitialized();
|
||||||
types = structured_types.types;
|
ops = structured_ops.operations;
|
||||||
parser = structured_types.parser;
|
ops.String = (function(_super) {
|
||||||
types.String = (function(_super) {
|
|
||||||
__extends(String, _super);
|
__extends(String, _super);
|
||||||
|
|
||||||
function String(uid) {
|
function String(uid) {
|
||||||
@ -300,16 +299,16 @@ module.exports = function(HB) {
|
|||||||
|
|
||||||
return String;
|
return String;
|
||||||
|
|
||||||
})(types.ListManager);
|
})(ops.ListManager);
|
||||||
types.String.parse = function(json) {
|
ops.String.parse = function(json) {
|
||||||
var uid;
|
var uid;
|
||||||
uid = json['uid'];
|
uid = json['uid'];
|
||||||
return new this(uid);
|
return new this(uid);
|
||||||
};
|
};
|
||||||
types.String.create = function(content, mutable) {
|
ops.String.create = function(content, mutable) {
|
||||||
var word;
|
var word;
|
||||||
if (mutable === "mutable") {
|
if (mutable === "mutable") {
|
||||||
word = new types.String().execute();
|
word = new ops.String().execute();
|
||||||
word.insert(0, content);
|
word.insert(0, content);
|
||||||
return word;
|
return word;
|
||||||
} else if ((mutable == null) || (mutable === "immutable")) {
|
} else if ((mutable == null) || (mutable === "immutable")) {
|
||||||
@ -318,5 +317,5 @@ module.exports = function(HB) {
|
|||||||
throw new Error("Specify either \"mutable\" or \"immutable\"!!");
|
throw new Error("Specify either \"mutable\" or \"immutable\"!!");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return structured_types;
|
return structured_ops;
|
||||||
};
|
};
|
@ -1,8 +1,6 @@
|
|||||||
var Engine, HistoryBuffer, adaptConnector, createY, json_types_uninitialized,
|
var Engine, HistoryBuffer, adaptConnector, createY, json_ops_uninitialized;
|
||||||
__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; },
|
|
||||||
__hasProp = {}.hasOwnProperty;
|
|
||||||
|
|
||||||
json_types_uninitialized = require("./Types/JsonTypes");
|
json_ops_uninitialized = require("./Operations/Json");
|
||||||
|
|
||||||
HistoryBuffer = require("./HistoryBuffer");
|
HistoryBuffer = require("./HistoryBuffer");
|
||||||
|
|
||||||
@ -11,7 +9,7 @@ Engine = require("./Engine");
|
|||||||
adaptConnector = require("./ConnectorAdapter");
|
adaptConnector = require("./ConnectorAdapter");
|
||||||
|
|
||||||
createY = function(connector) {
|
createY = function(connector) {
|
||||||
var HB, Y, type_manager, types, user_id;
|
var HB, engine, ops, ops_manager, user_id;
|
||||||
user_id = null;
|
user_id = null;
|
||||||
if (connector.user_id != null) {
|
if (connector.user_id != null) {
|
||||||
user_id = connector.user_id;
|
user_id = connector.user_id;
|
||||||
@ -23,28 +21,16 @@ createY = function(connector) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
HB = new HistoryBuffer(user_id);
|
HB = new HistoryBuffer(user_id);
|
||||||
type_manager = json_types_uninitialized(HB);
|
ops_manager = json_ops_uninitialized(HB, this.constructor);
|
||||||
types = type_manager.types;
|
ops = ops_manager.operations;
|
||||||
Y = (function(_super) {
|
engine = new Engine(HB, ops);
|
||||||
__extends(Y, _super);
|
adaptConnector(connector, engine, HB, ops_manager.execution_listener);
|
||||||
|
ops.Operation.prototype.HB = HB;
|
||||||
function Y() {
|
ops.Operation.prototype.operations = ops;
|
||||||
this.connector = connector;
|
ops.Operation.prototype.engine = engine;
|
||||||
this.HB = HB;
|
ops.Operation.prototype.connector = connector;
|
||||||
this.types = types;
|
ops.Operation.prototype.custom_ops = this.constructor;
|
||||||
this.engine = new Engine(this.HB, type_manager.types);
|
return new ops.Object(HB.getReservedUniqueIdentifier()).execute();
|
||||||
adaptConnector(this.connector, this.engine, this.HB, type_manager.execution_listener);
|
|
||||||
Y.__super__.constructor.apply(this, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
Y.prototype.getConnector = function() {
|
|
||||||
return this.connector;
|
|
||||||
};
|
|
||||||
|
|
||||||
return Y;
|
|
||||||
|
|
||||||
})(types.Object);
|
|
||||||
return new Y(HB.getReservedUniqueIdentifier()).execute();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = createY;
|
module.exports = createY;
|
||||||
|
29204
build/test/Json_test.js
29204
build/test/Json_test.js
File diff suppressed because one or more lines are too long
29203
build/test/Text_test.js
29203
build/test/Text_test.js
File diff suppressed because one or more lines are too long
@ -1,13 +1,13 @@
|
|||||||
module.exports = (HB)->
|
module.exports = ()->
|
||||||
# @see Engine.parse
|
# @see Engine.parse
|
||||||
types = {}
|
ops = {}
|
||||||
execution_listener = []
|
execution_listener = []
|
||||||
|
|
||||||
#
|
#
|
||||||
# @private
|
# @private
|
||||||
# @abstract
|
# @abstract
|
||||||
# @nodoc
|
# @nodoc
|
||||||
# A generic interface to operations.
|
# A generic interface to ops.
|
||||||
#
|
#
|
||||||
# An operation has the following methods:
|
# An operation has the following methods:
|
||||||
# * _encode: 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).
|
||||||
@ -16,7 +16,7 @@ module.exports = (HB)->
|
|||||||
#
|
#
|
||||||
# Furthermore an encodable operation has a parser. We extend the parser object in order to parse encoded operations.
|
# Furthermore an encodable operation has a parser. We extend the parser object in order to parse encoded operations.
|
||||||
#
|
#
|
||||||
class types.Operation
|
class ops.Operation
|
||||||
|
|
||||||
#
|
#
|
||||||
# @param {Object} uid A unique identifier.
|
# @param {Object} uid A unique identifier.
|
||||||
@ -60,7 +60,7 @@ module.exports = (HB)->
|
|||||||
@event_listeners = []
|
@event_listeners = []
|
||||||
|
|
||||||
delete: ()->
|
delete: ()->
|
||||||
(new types.Delete undefined, @).execute()
|
(new ops.Delete undefined, @).execute()
|
||||||
null
|
null
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -86,11 +86,11 @@ module.exports = (HB)->
|
|||||||
@is_deleted = true
|
@is_deleted = true
|
||||||
if garbagecollect
|
if garbagecollect
|
||||||
@garbage_collected = true
|
@garbage_collected = true
|
||||||
HB.addToGarbageCollector @
|
@HB.addToGarbageCollector @
|
||||||
|
|
||||||
cleanup: ()->
|
cleanup: ()->
|
||||||
#console.log "cleanup: #{@type}"
|
#console.log "cleanup: #{@type}"
|
||||||
HB.removeOperation @
|
@HB.removeOperation @
|
||||||
@deleteAllObservers()
|
@deleteAllObservers()
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -136,9 +136,9 @@ module.exports = (HB)->
|
|||||||
# When this operation was created without a uid, then set it here.
|
# When this operation was created without a uid, then set it here.
|
||||||
# There is only one other place, where this can be done - before an Insertion
|
# There is only one other place, where this can be done - before an Insertion
|
||||||
# is executed (because we need the creator_id)
|
# is executed (because we need the creator_id)
|
||||||
@uid = HB.getNextOperationIdentifier()
|
@uid = @HB.getNextOperationIdentifier()
|
||||||
if not @uid.noOperation?
|
if not @uid.noOperation?
|
||||||
HB.addOperation @
|
@HB.addOperation @
|
||||||
for l in execution_listener
|
for l in execution_listener
|
||||||
l @_encode()
|
l @_encode()
|
||||||
@
|
@
|
||||||
@ -190,7 +190,7 @@ module.exports = (HB)->
|
|||||||
uninstantiated = {}
|
uninstantiated = {}
|
||||||
success = @
|
success = @
|
||||||
for name, op_uid of @unchecked
|
for name, op_uid of @unchecked
|
||||||
op = HB.getOperation op_uid
|
op = @HB.getOperation op_uid
|
||||||
if op
|
if op
|
||||||
@[name] = op
|
@[name] = op
|
||||||
else
|
else
|
||||||
@ -205,7 +205,7 @@ module.exports = (HB)->
|
|||||||
# @nodoc
|
# @nodoc
|
||||||
# A simple Delete-type operation that deletes an operation.
|
# A simple Delete-type operation that deletes an operation.
|
||||||
#
|
#
|
||||||
class types.Delete extends types.Operation
|
class ops.Delete extends ops.Operation
|
||||||
|
|
||||||
#
|
#
|
||||||
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
||||||
@ -245,7 +245,7 @@ module.exports = (HB)->
|
|||||||
#
|
#
|
||||||
# Define how to parse Delete operations.
|
# Define how to parse Delete operations.
|
||||||
#
|
#
|
||||||
types.Delete.parse = (o)->
|
ops.Delete.parse = (o)->
|
||||||
{
|
{
|
||||||
'uid' : uid
|
'uid' : uid
|
||||||
'deletes': deletes_uid
|
'deletes': deletes_uid
|
||||||
@ -262,7 +262,7 @@ module.exports = (HB)->
|
|||||||
# - The short-list (abbrev. sl) maintains only the operations that are not deleted
|
# - The short-list (abbrev. sl) maintains only the operations that are not deleted
|
||||||
# - The complete-list (abbrev. cl) maintains all operations
|
# - The complete-list (abbrev. cl) maintains all operations
|
||||||
#
|
#
|
||||||
class types.Insert extends types.Operation
|
class ops.Insert extends ops.Operation
|
||||||
|
|
||||||
#
|
#
|
||||||
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
||||||
@ -314,7 +314,7 @@ module.exports = (HB)->
|
|||||||
@prev_cl.applyDelete()
|
@prev_cl.applyDelete()
|
||||||
|
|
||||||
# delete content
|
# delete content
|
||||||
if @content instanceof types.Operation
|
if @content instanceof ops.Operation
|
||||||
@content.applyDelete()
|
@content.applyDelete()
|
||||||
delete @content
|
delete @content
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ module.exports = (HB)->
|
|||||||
if not @validateSavedOperations()
|
if not @validateSavedOperations()
|
||||||
return false
|
return false
|
||||||
else
|
else
|
||||||
if @content instanceof types.Operation
|
if @content instanceof ops.Operation
|
||||||
@content.insert_parent = @ # TODO: this is probably not necessary and only nice for debugging
|
@content.insert_parent = @ # TODO: this is probably not necessary and only nice for debugging
|
||||||
if @parent?
|
if @parent?
|
||||||
if not @prev_cl?
|
if not @prev_cl?
|
||||||
@ -450,7 +450,7 @@ module.exports = (HB)->
|
|||||||
position = 0
|
position = 0
|
||||||
prev = @prev_cl
|
prev = @prev_cl
|
||||||
while true
|
while true
|
||||||
if prev instanceof types.Delimiter
|
if prev instanceof ops.Delimiter
|
||||||
break
|
break
|
||||||
if not prev.isDeleted()
|
if not prev.isDeleted()
|
||||||
position++
|
position++
|
||||||
@ -482,7 +482,7 @@ module.exports = (HB)->
|
|||||||
json['content'] = JSON.stringify @content
|
json['content'] = JSON.stringify @content
|
||||||
json
|
json
|
||||||
|
|
||||||
types.Insert.parse = (json)->
|
ops.Insert.parse = (json)->
|
||||||
{
|
{
|
||||||
'content' : content
|
'content' : content
|
||||||
'uid' : uid
|
'uid' : uid
|
||||||
@ -501,7 +501,7 @@ module.exports = (HB)->
|
|||||||
# @nodoc
|
# @nodoc
|
||||||
# Defines an object that is cannot be changed. You can use this to set an immutable string, or a number.
|
# Defines an object that is cannot be changed. You can use this to set an immutable string, or a number.
|
||||||
#
|
#
|
||||||
class types.ImmutableObject extends types.Operation
|
class ops.ImmutableObject extends ops.Operation
|
||||||
|
|
||||||
#
|
#
|
||||||
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
||||||
@ -529,7 +529,7 @@ module.exports = (HB)->
|
|||||||
}
|
}
|
||||||
json
|
json
|
||||||
|
|
||||||
types.ImmutableObject.parse = (json)->
|
ops.ImmutableObject.parse = (json)->
|
||||||
{
|
{
|
||||||
'uid' : uid
|
'uid' : uid
|
||||||
'content' : content
|
'content' : content
|
||||||
@ -542,7 +542,7 @@ module.exports = (HB)->
|
|||||||
# This is necessary in order to have a beginning and an end even if the content
|
# This is necessary in order to have a beginning and an end even if the content
|
||||||
# of the Engine is empty.
|
# of the Engine is empty.
|
||||||
#
|
#
|
||||||
class types.Delimiter extends types.Operation
|
class ops.Delimiter extends ops.Operation
|
||||||
#
|
#
|
||||||
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
# @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} prev_cl The predecessor of this operation in the complete-list (cl)
|
||||||
@ -601,7 +601,7 @@ module.exports = (HB)->
|
|||||||
'next' : @next_cl?.getUid()
|
'next' : @next_cl?.getUid()
|
||||||
}
|
}
|
||||||
|
|
||||||
types.Delimiter.parse = (json)->
|
ops.Delimiter.parse = (json)->
|
||||||
{
|
{
|
||||||
'uid' : uid
|
'uid' : uid
|
||||||
'prev' : prev
|
'prev' : prev
|
||||||
@ -611,7 +611,7 @@ module.exports = (HB)->
|
|||||||
|
|
||||||
# This is what this module exports after initializing it with the HistoryBuffer
|
# This is what this module exports after initializing it with the HistoryBuffer
|
||||||
{
|
{
|
||||||
'types' : types
|
'operations' : ops
|
||||||
'execution_listener' : execution_listener
|
'execution_listener' : execution_listener
|
||||||
}
|
}
|
||||||
|
|
@ -1,13 +1,13 @@
|
|||||||
text_types_uninitialized = require "./TextTypes"
|
text_ops_uninitialized = require "./Text"
|
||||||
|
|
||||||
module.exports = (HB)->
|
module.exports = ()->
|
||||||
text_types = text_types_uninitialized HB
|
text_ops = text_ops_uninitialized()
|
||||||
types = text_types.types
|
ops = text_ops.operations
|
||||||
|
|
||||||
#
|
#
|
||||||
# Manages Object-like values.
|
# Manages Object-like values.
|
||||||
#
|
#
|
||||||
class types.Object extends types.MapManager
|
class ops.Object extends ops.MapManager
|
||||||
|
|
||||||
#
|
#
|
||||||
# Identifies this class.
|
# Identifies this class.
|
||||||
@ -40,11 +40,11 @@ module.exports = (HB)->
|
|||||||
val = @val()
|
val = @val()
|
||||||
json = {}
|
json = {}
|
||||||
for name, o of val
|
for name, o of val
|
||||||
if o instanceof types.Object
|
if o instanceof ops.Object
|
||||||
json[name] = o.toJson(transform_to_value)
|
json[name] = o.toJson(transform_to_value)
|
||||||
else if o instanceof types.ListManager
|
else if o instanceof ops.ListManager
|
||||||
json[name] = o.toJson(transform_to_value)
|
json[name] = o.toJson(transform_to_value)
|
||||||
else if transform_to_value and o instanceof types.Operation
|
else if transform_to_value and o instanceof ops.Operation
|
||||||
json[name] = o.val()
|
json[name] = o.val()
|
||||||
else
|
else
|
||||||
json[name] = o
|
json[name] = o
|
||||||
@ -58,7 +58,7 @@ module.exports = (HB)->
|
|||||||
that.val(event.name, event.object[event.name])
|
that.val(event.name, event.object[event.name])
|
||||||
@observe (events)->
|
@observe (events)->
|
||||||
for event in events
|
for event in events
|
||||||
if event.created_ isnt HB.getUserId()
|
if event.created_ isnt @HB.getUserId()
|
||||||
notifier = Object.getNotifier(that.bound_json)
|
notifier = Object.getNotifier(that.bound_json)
|
||||||
oldVal = that.bound_json[event.name]
|
oldVal = that.bound_json[event.name]
|
||||||
if oldVal?
|
if oldVal?
|
||||||
@ -102,7 +102,7 @@ module.exports = (HB)->
|
|||||||
val: (name, content)->
|
val: (name, content)->
|
||||||
if name? and arguments.length > 1
|
if name? and arguments.length > 1
|
||||||
if content? and content.constructor?
|
if content? and content.constructor?
|
||||||
type = types[content.constructor.name]
|
type = ops[content.constructor.name]
|
||||||
if type? and type.create?
|
if type? and type.create?
|
||||||
args = []
|
args = []
|
||||||
for i in [1...arguments.length]
|
for i in [1...arguments.length]
|
||||||
@ -125,23 +125,23 @@ module.exports = (HB)->
|
|||||||
'uid' : @getUid()
|
'uid' : @getUid()
|
||||||
}
|
}
|
||||||
|
|
||||||
types.Object.parse = (json)->
|
ops.Object.parse = (json)->
|
||||||
{
|
{
|
||||||
'uid' : uid
|
'uid' : uid
|
||||||
} = json
|
} = json
|
||||||
new this(uid)
|
new this(uid)
|
||||||
|
|
||||||
types.Object.create = (content, mutable)->
|
ops.Object.create = (content, mutable)->
|
||||||
json = new types.Object().execute()
|
json = new ops.Object().execute()
|
||||||
for n,o of content
|
for n,o of content
|
||||||
json.val n, o, mutable
|
json.val n, o, mutable
|
||||||
json
|
json
|
||||||
|
|
||||||
|
|
||||||
types.Number = {}
|
ops.Number = {}
|
||||||
types.Number.create = (content)->
|
ops.Number.create = (content)->
|
||||||
content
|
content
|
||||||
|
|
||||||
text_types
|
text_ops
|
||||||
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
|||||||
basic_types_uninitialized = require "./BasicTypes"
|
basic_ops_uninitialized = require "./Basic"
|
||||||
|
|
||||||
module.exports = (HB)->
|
module.exports = ()->
|
||||||
basic_types = basic_types_uninitialized HB
|
basic_ops = basic_ops_uninitialized()
|
||||||
types = basic_types.types
|
ops = basic_ops.operations
|
||||||
|
|
||||||
#
|
#
|
||||||
# @nodoc
|
# @nodoc
|
||||||
# Manages map like objects. E.g. Json-Type and XML attributes.
|
# Manages map like objects. E.g. Json-Type and XML attributes.
|
||||||
#
|
#
|
||||||
class types.MapManager extends types.Operation
|
class ops.MapManager extends ops.Operation
|
||||||
|
|
||||||
#
|
#
|
||||||
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
||||||
@ -28,7 +28,7 @@ module.exports = (HB)->
|
|||||||
super()
|
super()
|
||||||
|
|
||||||
#
|
#
|
||||||
# @see JsonTypes.val
|
# @see JsonOperations.val
|
||||||
#
|
#
|
||||||
val: (name, content)->
|
val: (name, content)->
|
||||||
if arguments.length > 1
|
if arguments.length > 1
|
||||||
@ -60,7 +60,7 @@ module.exports = (HB)->
|
|||||||
noOperation: true
|
noOperation: true
|
||||||
sub: property_name
|
sub: property_name
|
||||||
alt: @
|
alt: @
|
||||||
rm = new types.ReplaceManager event_properties, event_this, rm_uid # this operation shall not be saved in the HB
|
rm = new ops.ReplaceManager event_properties, event_this, rm_uid # this operation shall not be saved in the HB
|
||||||
@map[property_name] = rm
|
@map[property_name] = rm
|
||||||
rm.setParent @, property_name
|
rm.setParent @, property_name
|
||||||
rm.execute()
|
rm.execute()
|
||||||
@ -70,7 +70,7 @@ module.exports = (HB)->
|
|||||||
# @nodoc
|
# @nodoc
|
||||||
# Manages a list of Insert-type operations.
|
# Manages a list of Insert-type operations.
|
||||||
#
|
#
|
||||||
class types.ListManager extends types.Operation
|
class ops.ListManager extends ops.Operation
|
||||||
|
|
||||||
#
|
#
|
||||||
# A ListManager maintains a non-empty list that has a beginning and an end (both Delimiters!)
|
# A ListManager maintains a non-empty list that has a beginning and an end (both Delimiters!)
|
||||||
@ -78,8 +78,8 @@ module.exports = (HB)->
|
|||||||
# @param {Delimiter} beginning Reference or Object.
|
# @param {Delimiter} beginning Reference or Object.
|
||||||
# @param {Delimiter} end Reference or Object.
|
# @param {Delimiter} end Reference or Object.
|
||||||
constructor: (uid)->
|
constructor: (uid)->
|
||||||
@beginning = new types.Delimiter undefined, undefined
|
@beginning = new ops.Delimiter undefined, undefined
|
||||||
@end = new types.Delimiter @beginning, undefined
|
@end = new ops.Delimiter @beginning, undefined
|
||||||
@beginning.next_cl = @end
|
@beginning.next_cl = @end
|
||||||
@beginning.execute()
|
@beginning.execute()
|
||||||
@end.execute()
|
@end.execute()
|
||||||
@ -100,11 +100,11 @@ module.exports = (HB)->
|
|||||||
toJson: (transform_to_value = false)->
|
toJson: (transform_to_value = false)->
|
||||||
val = @val()
|
val = @val()
|
||||||
for i, o in val
|
for i, o in val
|
||||||
if o instanceof types.Object
|
if o instanceof ops.Object
|
||||||
o.toJson(transform_to_value)
|
o.toJson(transform_to_value)
|
||||||
else if o instanceof types.ListManager
|
else if o instanceof ops.ListManager
|
||||||
o.toJson(transform_to_value)
|
o.toJson(transform_to_value)
|
||||||
else if transform_to_value and o instanceof types.Operation
|
else if transform_to_value and o instanceof ops.Operation
|
||||||
o.val()
|
o.val()
|
||||||
else
|
else
|
||||||
o
|
o
|
||||||
@ -160,7 +160,7 @@ module.exports = (HB)->
|
|||||||
val: (pos)->
|
val: (pos)->
|
||||||
if pos?
|
if pos?
|
||||||
o = @getOperationByPosition(pos+1)
|
o = @getOperationByPosition(pos+1)
|
||||||
if not (o instanceof types.Delimiter)
|
if not (o instanceof ops.Delimiter)
|
||||||
o.val()
|
o.val()
|
||||||
else
|
else
|
||||||
throw new Error "this position does not exist"
|
throw new Error "this position does not exist"
|
||||||
@ -177,7 +177,7 @@ module.exports = (HB)->
|
|||||||
o = @beginning
|
o = @beginning
|
||||||
while true
|
while true
|
||||||
# find the i-th op
|
# find the i-th op
|
||||||
if o instanceof types.Delimiter and o.prev_cl?
|
if o instanceof ops.Delimiter and o.prev_cl?
|
||||||
# the user or you gave a position parameter that is to big
|
# the user or you gave a position parameter that is to big
|
||||||
# for the current array. Therefore we reach a Delimiter.
|
# for the current array. Therefore we reach a Delimiter.
|
||||||
# Then, we'll just return the last character.
|
# Then, we'll just return the last character.
|
||||||
@ -199,7 +199,7 @@ module.exports = (HB)->
|
|||||||
insertAfter: (left, content, options)->
|
insertAfter: (left, content, options)->
|
||||||
createContent = (content, options)->
|
createContent = (content, options)->
|
||||||
if content? and content.constructor?
|
if content? and content.constructor?
|
||||||
type = types[content.constructor.name]
|
type = ops[content.constructor.name]
|
||||||
if type? and type.create?
|
if type? and type.create?
|
||||||
type.create content, options
|
type.create content, options
|
||||||
else
|
else
|
||||||
@ -212,11 +212,11 @@ module.exports = (HB)->
|
|||||||
right = right.next_cl # find the first character to the right, that is not deleted. In the case that position is 0, its the Delimiter.
|
right = right.next_cl # find the first character to the right, that is not deleted. In the case that position is 0, its the Delimiter.
|
||||||
left = right.prev_cl
|
left = right.prev_cl
|
||||||
|
|
||||||
if content instanceof types.Operation
|
if content instanceof ops.Operation
|
||||||
(new types.Insert content, undefined, left, right).execute()
|
(new ops.Insert content, undefined, left, right).execute()
|
||||||
else
|
else
|
||||||
for c in content
|
for c in content
|
||||||
tmp = (new types.Insert createContent(c, options), undefined, left, right).execute()
|
tmp = (new ops.Insert createContent(c, options), undefined, left, right).execute()
|
||||||
left = tmp
|
left = tmp
|
||||||
@
|
@
|
||||||
|
|
||||||
@ -241,11 +241,11 @@ module.exports = (HB)->
|
|||||||
|
|
||||||
delete_ops = []
|
delete_ops = []
|
||||||
for i in [0...length]
|
for i in [0...length]
|
||||||
if o instanceof types.Delimiter
|
if o instanceof ops.Delimiter
|
||||||
break
|
break
|
||||||
d = (new types.Delete undefined, o).execute()
|
d = (new ops.Delete undefined, o).execute()
|
||||||
o = o.next_cl
|
o = o.next_cl
|
||||||
while (not (o instanceof types.Delimiter)) and o.isDeleted()
|
while (not (o instanceof ops.Delimiter)) and o.isDeleted()
|
||||||
o = o.next_cl
|
o = o.next_cl
|
||||||
delete_ops.push d._encode()
|
delete_ops.push d._encode()
|
||||||
@
|
@
|
||||||
@ -261,16 +261,16 @@ module.exports = (HB)->
|
|||||||
}
|
}
|
||||||
json
|
json
|
||||||
|
|
||||||
types.ListManager.parse = (json)->
|
ops.ListManager.parse = (json)->
|
||||||
{
|
{
|
||||||
'uid' : uid
|
'uid' : uid
|
||||||
} = json
|
} = json
|
||||||
new this(uid)
|
new this(uid)
|
||||||
|
|
||||||
types.Array = ()->
|
ops.Array = ()->
|
||||||
types.Array.create = (content, mutable)->
|
ops.Array.create = (content, mutable)->
|
||||||
if (mutable is "mutable")
|
if (mutable is "mutable")
|
||||||
list = new types.ListManager().execute()
|
list = new ops.ListManager().execute()
|
||||||
ith = list.getOperationByPosition 0
|
ith = list.getOperationByPosition 0
|
||||||
list.insertAfter ith, content
|
list.insertAfter ith, content
|
||||||
list
|
list
|
||||||
@ -288,7 +288,7 @@ module.exports = (HB)->
|
|||||||
# The TextType-type has implemented support for replace
|
# The TextType-type has implemented support for replace
|
||||||
# @see TextType
|
# @see TextType
|
||||||
#
|
#
|
||||||
class types.ReplaceManager extends types.ListManager
|
class ops.ReplaceManager extends ops.ListManager
|
||||||
#
|
#
|
||||||
# @param {Object} event_properties Decorates the event that is thrown by the RM
|
# @param {Object} event_properties Decorates the event that is thrown by the RM
|
||||||
# @param {Object} event_this The object on which the event shall be executed
|
# @param {Object} event_this The object on which the event shall be executed
|
||||||
@ -336,7 +336,7 @@ module.exports = (HB)->
|
|||||||
#
|
#
|
||||||
replace: (content, replaceable_uid)->
|
replace: (content, replaceable_uid)->
|
||||||
o = @getLastOperation()
|
o = @getLastOperation()
|
||||||
relp = (new types.Replaceable content, @, replaceable_uid, o, o.next_cl).execute()
|
relp = (new ops.Replaceable content, @, replaceable_uid, o, o.next_cl).execute()
|
||||||
# TODO: delete repl (for debugging)
|
# TODO: delete repl (for debugging)
|
||||||
undefined
|
undefined
|
||||||
|
|
||||||
@ -344,7 +344,7 @@ module.exports = (HB)->
|
|||||||
@getLastOperation().isDeleted()
|
@getLastOperation().isDeleted()
|
||||||
|
|
||||||
deleteContent: ()->
|
deleteContent: ()->
|
||||||
(new types.Delete undefined, @getLastOperation().uid).execute()
|
(new ops.Delete undefined, @getLastOperation().uid).execute()
|
||||||
undefined
|
undefined
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -353,7 +353,7 @@ module.exports = (HB)->
|
|||||||
#
|
#
|
||||||
val: ()->
|
val: ()->
|
||||||
o = @getLastOperation()
|
o = @getLastOperation()
|
||||||
#if o instanceof types.Delimiter
|
#if o instanceof ops.Delimiter
|
||||||
# throw new Error "Replace Manager doesn't contain anything."
|
# throw new Error "Replace Manager doesn't contain anything."
|
||||||
o.val?() # ? - for the case that (currently) the RM does not contain anything (then o is a Delimiter)
|
o.val?() # ? - for the case that (currently) the RM does not contain anything (then o is a Delimiter)
|
||||||
|
|
||||||
@ -375,7 +375,7 @@ module.exports = (HB)->
|
|||||||
# The ReplaceManager manages Replaceables.
|
# The ReplaceManager manages Replaceables.
|
||||||
# @see ReplaceManager
|
# @see ReplaceManager
|
||||||
#
|
#
|
||||||
class types.Replaceable extends types.Insert
|
class ops.Replaceable extends ops.Insert
|
||||||
|
|
||||||
#
|
#
|
||||||
# @param {Operation} content The value that this Replaceable holds.
|
# @param {Operation} content The value that this Replaceable holds.
|
||||||
@ -411,7 +411,7 @@ module.exports = (HB)->
|
|||||||
#
|
#
|
||||||
# This is called, when the Insert-type was successfully executed.
|
# This is called, when the Insert-type was successfully executed.
|
||||||
# TODO: consider doing this in a more consistent manner. This could also be
|
# TODO: consider doing this in a more consistent manner. This could also be
|
||||||
# done with execute. But currently, there are no specital Insert-types for ListManager.
|
# done with execute. But currently, there are no specital Insert-ops for ListManager.
|
||||||
#
|
#
|
||||||
callOperationSpecificInsertEvents: ()->
|
callOperationSpecificInsertEvents: ()->
|
||||||
if @next_cl.type is "Delimiter" and @prev_cl.type isnt "Delimiter"
|
if @next_cl.type is "Delimiter" and @prev_cl.type isnt "Delimiter"
|
||||||
@ -461,7 +461,7 @@ module.exports = (HB)->
|
|||||||
else if @origin isnt @prev_cl
|
else if @origin isnt @prev_cl
|
||||||
json.origin = @origin.getUid()
|
json.origin = @origin.getUid()
|
||||||
|
|
||||||
if @content instanceof types.Operation
|
if @content instanceof ops.Operation
|
||||||
json['content'] = @content.getUid()
|
json['content'] = @content.getUid()
|
||||||
else
|
else
|
||||||
# This could be a security concern.
|
# This could be a security concern.
|
||||||
@ -471,7 +471,7 @@ module.exports = (HB)->
|
|||||||
json['content'] = @content
|
json['content'] = @content
|
||||||
json
|
json
|
||||||
|
|
||||||
types.Replaceable.parse = (json)->
|
ops.Replaceable.parse = (json)->
|
||||||
{
|
{
|
||||||
'content' : content
|
'content' : content
|
||||||
'parent' : parent
|
'parent' : parent
|
||||||
@ -484,7 +484,7 @@ module.exports = (HB)->
|
|||||||
new this(content, parent, uid, prev, next, origin, is_deleted)
|
new this(content, parent, uid, prev, next, origin, is_deleted)
|
||||||
|
|
||||||
|
|
||||||
basic_types
|
basic_ops
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
|||||||
structured_types_uninitialized = require "./StructuredTypes"
|
structured_ops_uninitialized = require "./Structured"
|
||||||
|
|
||||||
module.exports = (HB)->
|
module.exports = ()->
|
||||||
structured_types = structured_types_uninitialized HB
|
structured_ops = structured_ops_uninitialized()
|
||||||
types = structured_types.types
|
ops = structured_ops.operations
|
||||||
parser = structured_types.parser
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Handles a String-like data structures with support for insert/delete at a word-position.
|
# Handles a String-like data structures with support for insert/delete at a word-position.
|
||||||
# @note Currently, only Text is supported!
|
# @note Currently, only Text is supported!
|
||||||
#
|
#
|
||||||
class types.String extends types.ListManager
|
class ops.String extends ops.ListManager
|
||||||
|
|
||||||
#
|
#
|
||||||
# @private
|
# @private
|
||||||
@ -287,15 +286,15 @@ module.exports = (HB)->
|
|||||||
}
|
}
|
||||||
json
|
json
|
||||||
|
|
||||||
types.String.parse = (json)->
|
ops.String.parse = (json)->
|
||||||
{
|
{
|
||||||
'uid' : uid
|
'uid' : uid
|
||||||
} = json
|
} = json
|
||||||
new this(uid)
|
new this(uid)
|
||||||
|
|
||||||
types.String.create = (content, mutable)->
|
ops.String.create = (content, mutable)->
|
||||||
if (mutable is "mutable")
|
if (mutable is "mutable")
|
||||||
word = new types.String().execute()
|
word = new ops.String().execute()
|
||||||
word.insert 0, content
|
word.insert 0, content
|
||||||
word
|
word
|
||||||
else if (not mutable?) or (mutable is "immutable")
|
else if (not mutable?) or (mutable is "immutable")
|
||||||
@ -304,6 +303,6 @@ module.exports = (HB)->
|
|||||||
throw new Error "Specify either \"mutable\" or \"immutable\"!!"
|
throw new Error "Specify either \"mutable\" or \"immutable\"!!"
|
||||||
|
|
||||||
|
|
||||||
structured_types
|
structured_ops
|
||||||
|
|
||||||
|
|
38
lib/y.coffee
38
lib/y.coffee
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
json_types_uninitialized = require "./Types/JsonTypes"
|
json_ops_uninitialized = require "./Operations/Json"
|
||||||
|
|
||||||
HistoryBuffer = require "./HistoryBuffer"
|
HistoryBuffer = require "./HistoryBuffer"
|
||||||
Engine = require "./Engine"
|
Engine = require "./Engine"
|
||||||
adaptConnector = require "./ConnectorAdapter"
|
adaptConnector = require "./ConnectorAdapter"
|
||||||
@ -14,34 +15,19 @@ createY = (connector)->
|
|||||||
user_id = id
|
user_id = id
|
||||||
HB.resetUserId id
|
HB.resetUserId id
|
||||||
HB = new HistoryBuffer user_id
|
HB = new HistoryBuffer user_id
|
||||||
type_manager = json_types_uninitialized HB
|
ops_manager = json_ops_uninitialized HB, this.constructor
|
||||||
types = type_manager.types
|
ops = ops_manager.operations
|
||||||
|
|
||||||
#
|
engine = new Engine HB, ops
|
||||||
# Framework for Json data-structures.
|
adaptConnector connector, engine, HB, ops_manager.execution_listener
|
||||||
# Known values that are supported:
|
|
||||||
# * String
|
|
||||||
# * Integer
|
|
||||||
# * Array
|
|
||||||
#
|
|
||||||
class Y extends types.Object
|
|
||||||
|
|
||||||
#
|
ops.Operation.prototype.HB = HB
|
||||||
# @param {String} user_id Unique id of the peer.
|
ops.Operation.prototype.operations = ops
|
||||||
# @param {Connector} Connector the connector class.
|
ops.Operation.prototype.engine = engine
|
||||||
#
|
ops.Operation.prototype.connector = connector
|
||||||
constructor: ()->
|
ops.Operation.prototype.custom_ops = this.constructor
|
||||||
@connector = connector
|
|
||||||
@HB = HB
|
|
||||||
@types = types
|
|
||||||
@engine = new Engine @HB, type_manager.types
|
|
||||||
adaptConnector @connector, @engine, @HB, type_manager.execution_listener
|
|
||||||
super
|
|
||||||
|
|
||||||
getConnector: ()->
|
return new ops.Object(HB.getReservedUniqueIdentifier()).execute()
|
||||||
@connector
|
|
||||||
|
|
||||||
return new Y(HB.getReservedUniqueIdentifier()).execute()
|
|
||||||
|
|
||||||
module.exports = createY
|
module.exports = createY
|
||||||
if window? and not window.Y?
|
if window? and not window.Y?
|
||||||
|
@ -48,7 +48,7 @@ class JsonTest extends Test
|
|||||||
@users[user_num].toJson(true)
|
@users[user_num].toJson(true)
|
||||||
|
|
||||||
getGeneratingFunctions: (user_num)->
|
getGeneratingFunctions: (user_num)->
|
||||||
types = @users[user_num].types
|
types = @users[user_num].operations
|
||||||
super(user_num).concat [
|
super(user_num).concat [
|
||||||
f : (y)=> # SET PROPERTY
|
f : (y)=> # SET PROPERTY
|
||||||
l = y.val().length
|
l = y.val().length
|
||||||
|
@ -28,7 +28,7 @@ module.exports = class Test
|
|||||||
for i in [0...@number_of_engines]
|
for i in [0...@number_of_engines]
|
||||||
u = @makeNewUser (i+@name_suffix)
|
u = @makeNewUser (i+@name_suffix)
|
||||||
for user in @users
|
for user in @users
|
||||||
u.getConnector().join(user.getConnector()) # TODO: change the test-connector to make this more convenient
|
u.connector.join(user.connector) # TODO: change the test-connector to make this more convenient
|
||||||
@users.push u
|
@users.push u
|
||||||
@initUsers?(@users[0])
|
@initUsers?(@users[0])
|
||||||
@flushAll()
|
@flushAll()
|
||||||
@ -69,7 +69,7 @@ module.exports = class Test
|
|||||||
@getRandomText [1,2,'x','y'], 1 # only 4 keys
|
@getRandomText [1,2,'x','y'], 1 # only 4 keys
|
||||||
|
|
||||||
getGeneratingFunctions: (user_num)=>
|
getGeneratingFunctions: (user_num)=>
|
||||||
types = @users[user_num].types
|
types = @users[user_num].operations
|
||||||
[
|
[
|
||||||
f : (y)=> # INSERT TEXT
|
f : (y)=> # INSERT TEXT
|
||||||
y
|
y
|
||||||
@ -106,7 +106,7 @@ module.exports = class Test
|
|||||||
|
|
||||||
applyRandomOp: (user_num)=>
|
applyRandomOp: (user_num)=>
|
||||||
user = @users[user_num]
|
user = @users[user_num]
|
||||||
user.getConnector().flushOneRandom()
|
user.connector.flushOneRandom()
|
||||||
|
|
||||||
doSomething: ()->
|
doSomething: ()->
|
||||||
user_num = _.random (@number_of_engines-1)
|
user_num = _.random (@number_of_engines-1)
|
||||||
@ -119,10 +119,10 @@ module.exports = class Test
|
|||||||
final = false
|
final = false
|
||||||
if @users.length <= 1 or not final
|
if @users.length <= 1 or not final
|
||||||
for user,user_number in @users
|
for user,user_number in @users
|
||||||
user.getConnector().flushAll()
|
user.connector.flushAll()
|
||||||
else
|
else
|
||||||
for user,user_number in @users[1..]
|
for user,user_number in @users[1..]
|
||||||
user.getConnector().flushAll()
|
user.connector.flushAll()
|
||||||
ops = @users[1].getHistoryBuffer()._encode @users[0].HB.getOperationCounter()
|
ops = @users[1].getHistoryBuffer()._encode @users[0].HB.getOperationCounter()
|
||||||
@users[0].engine.applyOpsCheckDouble ops
|
@users[0].engine.applyOpsCheckDouble ops
|
||||||
|
|
||||||
@ -135,7 +135,7 @@ module.exports = class Test
|
|||||||
|
|
||||||
number_of_created_operations = 0
|
number_of_created_operations = 0
|
||||||
for i in [0...(@users.length)]
|
for i in [0...(@users.length)]
|
||||||
number_of_created_operations += @users[i].getConnector().getOpsInExecutionOrder().length
|
number_of_created_operations += @users[i].connector.getOpsInExecutionOrder().length
|
||||||
@ops += number_of_created_operations*@users.length
|
@ops += number_of_created_operations*@users.length
|
||||||
|
|
||||||
ops_per_msek = Math.floor(@ops/@time)
|
ops_per_msek = Math.floor(@ops/@time)
|
||||||
@ -146,7 +146,7 @@ module.exports = class Test
|
|||||||
if @debug
|
if @debug
|
||||||
if not _.isEqual @getContent(i), @getContent(i+1)
|
if not _.isEqual @getContent(i), @getContent(i+1)
|
||||||
printOpsInExecutionOrder = (otnumber, otherotnumber)=>
|
printOpsInExecutionOrder = (otnumber, otherotnumber)=>
|
||||||
ops = _.filter @users[otnumber].getConnector().getOpsInExecutionOrder(), (o)->
|
ops = _.filter @users[otnumber].connector.getOpsInExecutionOrder(), (o)->
|
||||||
typeof o.uid.op_name isnt 'string' and o.uid.creator isnt '_'
|
typeof o.uid.op_name isnt 'string' and o.uid.creator isnt '_'
|
||||||
for s,j in ops
|
for s,j in ops
|
||||||
console.log "op#{j} = " + (JSON.stringify s)
|
console.log "op#{j} = " + (JSON.stringify s)
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user