Commit e41abff9 authored by Tristan Cavelier's avatar Tristan Cavelier

WIP: complexquery.js

parent 848a655e
// XXX // XXX
var ComplexQuery = newClass(Query, function () { var ComplexQuery = newClass(Query, function (spec) {
/**
* Logical operator to use to compare object values
*
* @property operator
* @type String
* @default "AND"
*/
this.operator = spec.operator || "AND";
this.query_list = todo;
/** /**
* Filter the item list only if all the sub queries match this item according * Filter the item list only if all the sub queries match this item according
* to the logical operator. * to the logical operator.
* See {{#crossLink "Query/exec:method"}}{{/crossLink}} * See {{#crossLink "Query/exec:method"}}{{/crossLink}}
*/ */
this.exec = function () { this.exec = function (item_list, option) {
todo todo
}; };
// XXX
this["AND"] = function (item, wildcard_character) {
var i;
for (i = 0; i < this.query_list.length; i += 1) {
if (!this.query_list[i].match(item, wildcard_character)) {
return false;
}
}
return true;
};
// XXX
this["OR"] = function (item, wildcard_character) {
var i;
for (i = 0; i < this.query_list.length; i += 1) {
if (this.query_list[i].match(item, wildcard_character)) {
return true;
}
}
return false;
};
// XXX
this["NOT"] = function (item, wildcard_character) {
return !this.query_list[0].match(item, wildcard_character);
};
}); });
todo
query_class_dict.complex = ComplexQuery; query_class_dict.complex = ComplexQuery;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment