Permalink
Browse files

Renamed Limit and Offset #n to #count on the client

  • Loading branch information...
1 parent 5abf607 commit 4c7c5e93c72c256d3d2642df20b43dd7c4b1e610 @nathansobo committed Jan 6, 2011
Showing with 26 additions and 26 deletions.
  1. +14 −14 lib/monarch/model/relations/limit.js
  2. +12 −12 lib/monarch/model/relations/offset.js
@@ -2,61 +2,61 @@
_.constructor("Monarch.Model.Relations.Limit", Monarch.Model.Relations.Relation, {
- initialize: function(operand, n) {
+ initialize: function(operand, count) {
this.operand = operand;
- this.n = n;
+ this.count = count;
this.sortSpecifications = operand.sortSpecifications;
this.initializeEventsSystem();
},
wireRepresentation: function() {
return {
type: "limit",
- count: this.n,
+ count: this.count,
operand: this.operand.wireRepresentation()
};
},
tuples: function() {
if (this.storedTuples) return this.storedTuples.values();
- return this.operand.tuples().slice(0, this.n);
+ return this.operand.tuples().slice(0, this.count);
},
isEqual: function(other) {
if (!other || other.constructor !== this.constructor) return false;
- return other.n === this.n && this.operand.isEqual(other.operand);
+ return other.count === this.count && this.operand.isEqual(other.operand);
},
onOperandInsert: function(tuple, index, newKey, oldKey) {
- if (index < this.n) {
- var formerLastTuple = this.at(this.n - 1);
+ if (index < this.count) {
+ var formerLastTuple = this.at(this.count - 1);
if (formerLastTuple) this.tupleRemovedRemotely(formerLastTuple);
this.tupleInsertedRemotely(tuple, newKey, oldKey);
}
},
onOperandUpdate: function(tuple, changeset, newIndex, oldIndex, newKey, oldKey) {
- if (oldIndex < this.n) {
- if (newIndex >= this.n) {
+ if (oldIndex < this.count) {
+ if (newIndex >= this.count) {
this.tupleRemovedRemotely(tuple, newKey, oldKey);
- var newLastTuple = this.operand.at(this.n - 1);
+ var newLastTuple = this.operand.at(this.count - 1);
if (newLastTuple) this.tupleInsertedRemotely(newLastTuple);
} else {
this.tupleUpdatedRemotely(tuple, changeset, newKey, oldKey);
}
} else {
- if (newIndex < this.n) {
- this.tupleRemovedRemotely(this.at(this.n - 1));
+ if (newIndex < this.count) {
+ this.tupleRemovedRemotely(this.at(this.count - 1));
this.tupleInsertedRemotely(tuple, newKey, oldKey);
} else {
}
}
},
onOperandRemove: function(tuple, index, newKey, oldKey) {
- if (index < this.n) {
+ if (index < this.count) {
this.tupleRemovedRemotely(tuple, newKey, oldKey);
- var newLastTuple = this.operand.at(this.n - 1);
+ var newLastTuple = this.operand.at(this.count - 1);
if (newLastTuple) this.tupleInsertedRemotely(newLastTuple);
}
}
@@ -1,60 +1,60 @@
(function(Monarch) {
_.constructor("Monarch.Model.Relations.Offset", Monarch.Model.Relations.Relation, {
- initialize: function(operand, n) {
+ initialize: function(operand, count) {
this.operand = operand;
- this.n = n;
+ this.count = count;
this.sortSpecifications = operand.sortSpecifications;
this.initializeEventsSystem();
},
tuples: function() {
if (this.storedTuples) return this.storedTuples.values();
- return this.operand.tuples().slice(this.n);
+ return this.operand.tuples().slice(this.count);
},
wireRepresentation: function() {
return {
type: "offset",
operand: this.operand.wireRepresentation(),
- count: this.n
+ count: this.count
};
},
isEqual: function(other) {
if (!other || other.constructor !== this.constructor) return false;
- return other.n === this.n && this.operand.isEqual(other.operand);
+ return other.count === this.count && this.operand.isEqual(other.operand);
},
// private
onOperandInsert: function(tuple, index, newKey, oldKey) {
- if (index < this.n) {
- var nthTuple = this.operand.at(this.n);
+ if (index < this.count) {
+ var nthTuple = this.operand.at(this.count);
if (nthTuple) this.tupleInsertedRemotely(nthTuple);
} else {
this.tupleInsertedRemotely(tuple, newKey, oldKey);
}
},
onOperandUpdate: function(tuple, changeset, newIndex, oldIndex, newKey, oldKey) {
- if (oldIndex < this.n) {
- if (newIndex >= this.n) {
+ if (oldIndex < this.count) {
+ if (newIndex >= this.count) {
this.tupleRemovedRemotely(this.at(0));
this.tupleInsertedRemotely(tuple, newKey, oldKey);
}
} else {
- if (newIndex < this.n) {
+ if (newIndex < this.count) {
this.tupleRemovedRemotely(tuple, newKey, oldKey);
- this.tupleInsertedRemotely(this.operand.at(this.n));
+ this.tupleInsertedRemotely(this.operand.at(this.count));
} else {
this.tupleUpdatedRemotely(tuple, changeset, newKey, oldKey)
}
}
},
onOperandRemove: function(tuple, index, newKey, oldKey) {
- if (index < this.n) {
+ if (index < this.count) {
var formerNthTuple = this.at(0);
if (formerNthTuple) this.tupleRemovedRemotely(formerNthTuple);
} else {

0 comments on commit 4c7c5e9

Please sign in to comment.