-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSortCondition.js
More file actions
38 lines (31 loc) · 922 Bytes
/
SortCondition.js
File metadata and controls
38 lines (31 loc) · 922 Bytes
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
var Class = require('../ext/Class');
var SortCondition = Class.create({
classLabel: 'jassa.sparql.SortCondition',
initialize: function(expr, direction) {
this.expr = expr;
this.direction = direction;
},
getExpr: function() {
return this.expr;
},
getDirection: function() {
return this.direction;
},
toString: function() {
var result;
if(this.direction === 'asc') {
result = 'Asc(' + this.expr + ')';
} else if(this.direction === 'desc') {
result = 'Desc(' + this.expr + ')';
} else {
result = '' + this.expr;
}
return result;
},
copySubstitute: function(fnNodeMap) {
var exprCopy = this.expr.copySubstitute(fnNodeMap);
var result = new SortCondition(exprCopy, this.direction);
return result;
},
});
module.exports = SortCondition;