KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > idaremedia > antx > go > IffValue


1 /**
2  * $Id: IffValue.java 180 2007-03-15 12:56:38Z ssmc $
3  * Copyright 2004-2005 iDare Media, Inc. All rights reserved.
4  *
5  * Originally written by iDare Media, Inc. for release into the public domain. This
6  * library, source form and binary form, is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License as published by the
8  * Free Software Foundation; either version 2.1 of the License, or (at your option) any
9  * later version.<p>
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU LGPL (GNU Lesser General Public License) for more details.<p>
14  *
15  * You should have received a copy of the GNU Lesser General Public License along with this
16  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite
17  * 330, Boston, MA 02111-1307 USA. The LGPL can be found online at
18  * http://www.fsf.org/copyleft/lesser.html<p>
19  *
20  * This product has been influenced by several projects within the open-source community.
21  * The JWare developers wish to acknowledge the open-source community's support. For more
22  * information regarding the open-source products used within JWare, please visit the
23  * JWare website.
24  *----------------------------------------------------------------------------------------*
25  * WEBSITE- http://www.jware.info EMAIL- inquiries@jware.info
26  *----------------------------------------------------------------------------------------*
27  **/

28
29 package com.idaremedia.antx.go;
30
31 import org.apache.tools.ant.Project;
32
33 import com.idaremedia.antx.helpers.Tk;
34
35 /**
36  * Implementation of the general <em>true</em> and <em>false</em> test for all
37  * conditional components. These tests should be set with the <em>resolved</em>
38  * value strings.
39  *
40  * @since JWare/AntX 0.5
41  * @author ssmc, &copy;2004-2005 <a HREF="http://www.jware.info">iDare&nbsp;Media,&nbsp;Inc.</a>
42  * @version 0.5
43  * @.safety multiple
44  * @.group impl,helper
45  * @see Go
46  * @see Iff
47  * @see Unless
48  **/

49
50 public final class IffValue
51 {
52     /**
53      * Execute test for a simple "if-value-true" conditional parameter.
54      * Null property names are not allowed.
55      * @since JWare/AntX 0.5
56      * @author ssmc, &copy;2004 <a HREF="http://www.jware.info">iDare&nbsp;Media,&nbsp;Inc.</a>
57      * @version 0.5
58      * @.safety single
59      * @.group impl,helper
60      **/

61     public static final class IsTrue extends Go.TestSkeleton {
62         public IsTrue() {
63         }
64         public IsTrue(String JavaDoc string) {
65             super(string);
66         }
67         public boolean pass(Project P) {
68             verifyInited();
69             String JavaDoc test = Tk.resolveString(P,getParameter());
70             return Tk.string2PosBool(test)==Boolean.TRUE;
71         }
72         public String JavaDoc getParameterName() {
73             return "ifValueTrue";
74         }
75     }
76
77
78     /**
79      * Execute test for a simple "if-value-false" conditional
80      * parameter. Null property names are not allowed.
81      * @since JWare/AntX 0.5
82      * @author ssmc, &copy;2004 <a HREF="http://www.jware.info">iDare&nbsp;Media,&nbsp;Inc.</a>
83      * @version 0.5
84      * @.safety single
85      * @.group impl,helper
86      **/

87     public static final class IsNotTrue extends Go.TestSkeleton {
88         public IsNotTrue() {
89         }
90         public IsNotTrue(String JavaDoc list) {
91             super(list);
92         }
93         public boolean pass(Project P) {
94             verifyInited();
95             String JavaDoc test = Tk.resolveString(P,getParameter());
96             return Tk.string2NegBool(test)==Boolean.FALSE;
97         }
98         public String JavaDoc getParameterName() {
99             return "ifValueFalse";
100         }
101     }
102
103
104     /** Don't allow **/
105     private IffValue()
106     {
107     }
108 }
109
110 /* end-of-IffValue.java */
111
Popular Tags