carto/lib/mess/tree/comparison.js

33 lines
630 B
JavaScript
Raw Normal View History

(function(tree) {
2010-12-02 04:33:17 +08:00
tree.Comparison = function(str) {
2010-12-02 04:33:17 +08:00
this.value = str;
};
2011-01-21 01:28:59 +08:00
2010-12-02 04:33:17 +08:00
tree.Comparison.prototype = {
toCSS: function() {
2010-12-02 04:33:17 +08:00
return {
'<': '&lt;',
'>': '&gt;',
'=': '=',
2011-01-21 01:28:59 +08:00
'!=': '!=',
2011-01-20 07:01:30 +08:00
'<=': '&lt;=',
'>=': '&gt;='}[this.value];
2010-12-02 04:33:17 +08:00
},
2011-01-21 01:28:59 +08:00
negate: function() {
2011-01-22 05:17:52 +08:00
return new tree.Comparison({
2011-01-21 01:28:59 +08:00
'<': '>=',
'<=': '>',
'>': '<=',
'>=': '<',
'=': '!=',
'!=': '='
}[this.value]);
2011-01-21 01:28:59 +08:00
},
eval: function() {
2010-12-02 04:33:17 +08:00
return this;
}
};
2011-01-06 03:23:28 +08:00
})(require('mess/tree'));