carto/lib/mess/tree/comparison.js
2011-01-21 16:17:52 -05:00

33 lines
630 B
JavaScript

(function(tree) {
tree.Comparison = function(str) {
this.value = str;
};
tree.Comparison.prototype = {
toCSS: function() {
return {
'<': '&lt;',
'>': '&gt;',
'=': '=',
'!=': '!=',
'<=': '&lt;=',
'>=': '&gt;='}[this.value];
},
negate: function() {
return new tree.Comparison({
'<': '>=',
'<=': '>',
'>': '<=',
'>=': '<',
'=': '!=',
'!=': '='
}[this.value]);
},
eval: function() {
return this;
}
};
})(require('mess/tree'));