source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/main/org/apache/tools/ant/types/selectors/NotSelector.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 1.7 KB
Line 
1/*
2 * Copyright 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 org.apache.tools.ant.types.selectors;
19
20
21/**
22 * This selector has one other selectors whose meaning it inverts. It
23 * actually relies on NoneSelector for its implementation of the
24 * isSelected() method, but it adds a check to ensure there is only one
25 * other selector contained within.
26 *
27 * @since 1.5
28 */
29public class NotSelector extends NoneSelector {
30
31 /**
32 * Default constructor.
33 */
34 public NotSelector() {
35 }
36
37 /**
38 * @return a string representation of the selector
39 */
40 public String toString() {
41 StringBuffer buf = new StringBuffer();
42 if (hasSelectors()) {
43 buf.append("{notselect: ");
44 buf.append(super.toString());
45 buf.append("}");
46 }
47 return buf.toString();
48 }
49
50 /**
51 * Makes sure that there is only one entry, sets an error message if
52 * not.
53 */
54 public void verifySettings() {
55 if (selectorCount() != 1) {
56 setError("One and only one selector is allowed within the "
57 + "<not> tag");
58 }
59 }
60
61}
62
Note: See TracBrowser for help on using the repository browser.