1 | /*
|
---|
2 | * Copyright 2001-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 |
|
---|
18 | package ise.antelope.tasks.condition;
|
---|
19 |
|
---|
20 | import java.util.Enumeration;
|
---|
21 | import org.apache.tools.ant.BuildException;
|
---|
22 | import org.apache.tools.ant.taskdefs.condition.Condition;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * <or> condition container, modified for Antelope.
|
---|
26 | *
|
---|
27 | * <p>Iterates over all conditions and returns true as soon as one
|
---|
28 | * evaluates to true.</p>
|
---|
29 | *
|
---|
30 | * @since Ant 1.4
|
---|
31 | * @version $Revision: 1.1 $
|
---|
32 | */
|
---|
33 | public class Or extends BooleanConditionBase implements Condition {
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * @return true if any of the contained conditions evaluate to true
|
---|
37 | * @exception BuildException if an error occurs
|
---|
38 | */
|
---|
39 | public boolean eval() throws BuildException {
|
---|
40 | Enumeration e = getConditions();
|
---|
41 | while (e.hasMoreElements()) {
|
---|
42 | Condition c = (Condition) e.nextElement();
|
---|
43 | if (c.eval()) {
|
---|
44 | return true;
|
---|
45 | }
|
---|
46 | }
|
---|
47 | return false;
|
---|
48 | }
|
---|
49 |
|
---|
50 | }
|
---|