source: release-kits/wirk3/ant-scripts/tasks/antelope/src/ise/antelope/tasks/condition/Not.java@ 15023

Last change on this file since 15023 was 15023, checked in by oranfry, 16 years ago

did the bulk of the work on wirk3

File size: 1.6 KB
Line 
1/*
2 * Copyright 2001-2002,2004 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17
18package ise.antelope.tasks.condition;
19
20import org.apache.tools.ant.BuildException;
21import org.apache.tools.ant.taskdefs.condition.Condition;
22
23/**
24 * <not> condition, modified for Antelope.
25 *
26 * Evaluates to true if the single condition nested into it is false
27 * and vice versa.
28 *
29 * @since Ant 1.4
30 * @version $Revision: 1.1 $
31 */
32public class Not extends BooleanConditionBase implements Condition {
33
34 /**
35 * Evaluate condition
36 *
37 * @return true if the condition is true.
38 * @throws BuildException if the condition is not configured correctly.
39 */
40 public boolean eval() throws BuildException {
41 if (countConditions() > 1) {
42 throw new BuildException("You must not nest more than one "
43 + "condition into <not>");
44 }
45 if (countConditions() < 1) {
46 throw new BuildException("You must nest a condition into <not>");
47 }
48 return !((Condition) getConditions().nextElement()).eval();
49 }
50
51}
Note: See TracBrowser for help on using the repository browser.