1 | public class IsFalse extends ProjectComponent implements Condition {↵ | | 1 | public class IsTrue extends ProjectComponent implements Condition {↵
|
2 | /**↵ | | 2 | /**↵
|
3 | * what we eval↵ | | 3 | * what we eval↵
|
4 | */↵ | | 4 | */↵
|
5 | private Boolean value = null;↵ | | 5 | private Boolean value = null;↵
|
|
6 | /**↵ | | 6 | /**↵
|
7 | * set the value to be tested; let ant eval it to true/false↵ | | 7 | * set the value to be tested; let ant eval it to true/false↵
|
8 | * @param value the value to test↵ | | 8 | * @param value the value to test↵
|
9 | */↵ | | 9 | */↵
|
10 | public void setValue(boolean value) {↵ | | 10 | public void setValue(boolean value) {↵
|
11 | this.value = value ? Boolean.TRUE : Boolean.FALSE;↵ | | 11 | this.value = value ? Boolean.TRUE : Boolean.FALSE;↵
|
12 | }↵ | | 12 | }↵
|
|
13 | /**↵ | | 13 | /**↵
|
14 | * @return the inverted value;↵ | | 14 | * @return the value↵
|
15 | * @throws BuildException if someone forgot to spec a value↵ | | 15 | * @throws BuildException if someone forgot to spec a value↵
|
16 | */↵ | | 16 | */↵
|
17 | public boolean eval() throws BuildException {↵ | | 17 | public boolean eval() throws BuildException {↵
|
18 | if (value == null) {↵ | | 18 | if (value == null) {↵
|
19 | throw new BuildException("Nothing to test for falsehood");↵ | | 19 | throw new BuildException("Nothing to test for truth");↵
|
20 | }↵ | | 20 | }↵
|
21 | return !value.booleanValue();↵ | | 21 | return value.booleanValue();↵
|
22 | | | 22 |
|