-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathNot.java
More file actions
43 lines (36 loc) · 968 Bytes
/
Copy pathNot.java
File metadata and controls
43 lines (36 loc) · 968 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
39
40
41
42
43
package jaskell.sql;
import jaskell.script.Directive;
import jaskell.script.Parameter;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class Not extends Predicate {
Optional<Directive> _predicate;
Not(Directive predicate){
_predicate = Optional.of(predicate);
}
Not(){
_predicate = Optional.empty();
}
@Override
public String script() {
if (_predicate.isPresent()){
return String.format("NOT(%s)", _predicate.get().script());
} else {
return "NOT ";
}
}
@Override
public List<Parameter<?>> parameters() {
if(_predicate.isPresent()){
return _predicate.get().parameters();
} else {
return new ArrayList<>();
}
}
public Exists exists(Directive directive) {
Exists re = new Exists(directive);
re._prefix = Optional.of(this);
return re;
}
}