| 3687 | } |
| 3688 | |
| 3689 | addable(filter) { |
| 3690 | var key = filter.key.toString(), |
| 3691 | value = filter.val.toString(); |
| 3692 | |
| 3693 | if (value.match(/^[0-9]+(\.[0-9]*)?_match/)) {value = parseFloat(value);} |
| 3694 | |
| 3695 | switch (filter.op) { |
| 3696 | case '=': |
| 3697 | // if there is already foo= and we're adding foo= |
| 3698 | if (this.filters[key + '='] !== undefined) { |
| 3699 | if (this.filters[key + '='].val.toString() != value) { |
| 3700 | return false; |
| 3701 | } else { |
| 3702 | return null; |
| 3703 | } |
| 3704 | } |
| 3705 | if (this.filters[key + '!=' + value] !== undefined) {return false;} |
| 3706 | if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;} |
| 3707 | if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;} |
| 3708 | if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;} |
| 3709 | if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;} |
| 3710 | return true; |
| 3711 | |
| 3712 | case '=~': |
| 3713 | return true; |
| 3714 | |
| 3715 | case '!=': |
| 3716 | if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val === value) ? false : null;} |
| 3717 | if (this.filters[key + '!=' + value] !== undefined) {return null;} |
| 3718 | if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;} |
| 3719 | if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;} |
| 3720 | if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;} |
| 3721 | if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;} |
| 3722 | return true; |
| 3723 | |
| 3724 | case '>': |
| 3725 | if (key + '=' in this.filters) { |
| 3726 | if (this.filters[key + '='].val <= value) { |
| 3727 | return false; |
| 3728 | } else { |
| 3729 | return null; |
| 3730 | } |
| 3731 | } |
| 3732 | if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;} |
| 3733 | if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return false;} |
| 3734 | if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;} |
| 3735 | if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;} |
| 3736 | return true; |
| 3737 | |
| 3738 | case '>=': |
| 3739 | if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val < value) ? false : null;} |
| 3740 | if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;} |
| 3741 | if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;} |
| 3742 | if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;} |
| 3743 | if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return null;} |
| 3744 | return true; |
| 3745 | |
| 3746 | case '<': |