-
Notifications
You must be signed in to change notification settings - Fork 1
/
predicate.js
40 lines (34 loc) · 866 Bytes
/
predicate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//var operators = require('./predicate_operation').operators;
/**
{
left:this.toPredicateNode(),
operator:operator,
right:val
}
*/
function Predicate(obj){
this._string='';
this._left=obj.left?obj.left.toString() || '':undefined;
this._operator=obj.operator?obj.operator.toString() || '':undefined;
this._right=obj.right?obj.right.toString() || '':undefined;
this._string=this.toString();
}
Predicate.prototype.toString = function(){
var str='';
if(this._left){
str+= ' '+this._left.toString();
}
if(this._operator){
str+= ' '+this._operator.toString();
}
if(this._right){
str+= ' '+this._right.toString();
}
this._string=str;
return this._string;
}
Predicate.prototype.toPredicate = function (){
return this;
}
//Predicate.prototype.and = operators.and;
module.exports=Predicate;