Esempio n. 1
0
	this.listStore.forEach(function(list, id){
		var set = JSON.parse(id);
		// ideally there should be speed up ... but this is fine for now.


		var index = indexOf(self, props, list);

		if(canSet.has(set, props, self.algebra)) {

			// if it's not in the list, update the list with this and the lists data merged
			if(index === -1) {
				// get back the list items
				var items = self.serializeList(list);
				self.updatedList(list,  { data: setAdd(self, set,  items, props, self.algebra) }, set);
			} else {
				// if the index
			}

		}

	});
Esempio n. 2
0
	this.listStore.forEach(function(list, id){
		var items;
		var set = JSON.parse(id);
		// ideally there should be speed up ... but this is fine for now.


		var index = indexOf(self, props, list);

		if(canSet.has(set, props, self.algebra)) {

			// if it's not in the list, update the list with this and the lists data merged
			// in the future, this should update the position.
			items = self.serializeList(list);
			if(index === -1) {
				// get back the list items
				self.updatedList(list,  { data: setAdd(self, set,  items, props, self.algebra) }, set);
			} else {
				var sortedIndex = canSet.index(set, items, props, self.algebra);
				if(sortedIndex !== undefined && sortedIndex !== index) {
					var copy = items.slice(0);
					if(index < sortedIndex) {
						copy.splice(sortedIndex, 0, props);
						copy.splice(index,1);
					} else {
						copy.splice(index,1);
						copy.splice(sortedIndex, 0, props);
					}
					self.updatedList(list,  { data: copy }, set);
				}
			}

		}  else if(index !== -1){
			// otherwise remove it
			items = self.serializeList(list);
			items.splice(index,1);
			self.updatedList(list,  { data: items }, set);
		}

	});
Esempio n. 3
0
			this._eachSet(function(setDatum, setKey, getItems){
				// if props belongs
				var items = getItems();
				var index = indexOf(self, instance, items);

				if( canSet.subset(instance, setDatum.set, this.algebra) ) {

					// if it's not in, add it
					if(index === -1) {
						// how to insert things together?

						self.updateSet(setDatum, setAdd(self, setDatum.set,  getItems(), instance, self.algebra) );
					} else {
						// otherwise add it
						items.splice(index,1, instance);
						self.updateSet(setDatum, items);
					}

				} else if(index !== -1){
					// otherwise remove it
					items.splice(index,1);
					self.updateSet(setDatum, items);
				}
			});
Esempio n. 4
0
			this._eachSet(function(setDatum, setKey, getItems){
				if(canSet.has(setDatum.set, instance, this.algebra)) {
					self.updateSet(setDatum, setAdd(self, setDatum.set,  getItems(), instance, self.algebra), setDatum.set);
				}
			});