-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
77 lines (63 loc) · 1.28 KB
/
index.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function Identity() {
}
// null return value means "infinite"
Identity.prototype.queryXXX = function(f,m) {
return null;
};
Identity.prototype.queryXXO = function(f,m) {
return null;
};
Identity.prototype.queryXPX = function(f,m) {
if(f[1]==="equals" || f[1]==="not equals" ) {
return null;
} else {
return [];
}
};
Identity.prototype.queryXPO = function(f,m) {
if(f[1]==="equals") {
return [[f[2], "equals", f[2], true]];
} else if(f[1]==="not equals") {
return null;
} else {
return [];
}
};
Identity.prototype.querySXX = function(f,m) {
return null;
};
Identity.prototype.querySXO = function(f,m) {
if(f[0]===f[2]){
return [[f[0],"equals",f[2]]];
}
else {
return [[f[0],"not equals",f[2]]];
}
};
Identity.prototype.querySPX = function(f,m) {
if(f[1]==="equals") {
return [[f[0], "equals", f[0], true]];
} if(f[1]==="not equals") {
return null;
} else {
return [];
}
};
Identity.prototype.querySPO = function(f,m) {
if(f[1]==="equals") {
if(f[0]===f[2]){
return [[f[0],f[1],f[2]]];
} else {
return [];
}
} else if(f[1]==="not equals") {
if(f[0]!==f[2]){
return [[f[0],f[1],f[2]]];
} else {
return [];
}
} else {
return [];
}
};
module.exports = Identity;