1 | <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>More Conditions</title><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="Antelope Users Guide"><link rel="up" href="bk03ch05.html" title="Chapter 5. If Task"><link rel="prev" href="bk03ch05.html" title="Chapter 5. If Task"><link rel="next" href="bk03ch06.html" title="Chapter 6. SwitchTask"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">More Conditions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="bk03ch05.html">Prev</a> </td><th width="60%" align="center">Chapter 5. If Task</th><td width="20%" align="right"> <a accesskey="n" href="bk03ch06.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="conditionals"></a>More Conditions</h2></div></div></div><p>
|
---|
2 | These conditions are suitable for use in the <bool> element. Unfortunately, they cannot be used in the <condition> task, although all conditions for the <condition> task can be used with the bool and the bool can be used anywhere that <condition> can be used.
|
---|
3 | </p><h3><a name="id2519728"></a>IfPropertyTrue</h3><p>
|
---|
4 | Given a property name, tests whether the value for that property equals "true" (or "yes" or "on").
|
---|
5 | </p><p>
|
---|
6 | </p><div class="table"><a name="id2519740"></a><p class="title"><b>Table 5.2. IfPropertyTrue Attributes</b></p><table summary="IfPropertyTrue Attributes" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>property</td><td>The name of a property to test the value of.</td><td>Yes</td></tr></tbody></table></div><p>
|
---|
7 | </p><p>
|
---|
8 | </p><pre class="programlisting">
|
---|
9 |
|
---|
10 | <ispropertytrue property="myprop"/>
|
---|
11 | <ispropertytrue property="${someprop}"/>
|
---|
12 |
|
---|
13 | </pre><p>
|
---|
14 | </p><h3><a name="id2519801"></a>IfPropertyFalse</h3><p>
|
---|
15 | Given a property name, tests whether the value for that property equals "false" (or "no" or "off").
|
---|
16 | </p><p>
|
---|
17 | </p><div class="table"><a name="id2519813"></a><p class="title"><b>Table 5.3. IfPropertyFalse Attributes</b></p><table summary="IfPropertyFalse Attributes" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>property</td><td>The name of a property to test the value of.</td><td>Yes</td></tr></tbody></table></div><p>
|
---|
18 | </p><p>
|
---|
19 | </p><pre class="programlisting">
|
---|
20 |
|
---|
21 | <ispropertyfalse property="myprop"/>
|
---|
22 | <ispropertyfalse property="${someprop}"/>
|
---|
23 |
|
---|
24 | </pre><p>
|
---|
25 | </p><h3><a name="id2519875"></a>StartsWith</h3><p>
|
---|
26 | Given a property name, tests whether the value for that property starts with a specified string.
|
---|
27 | </p><p>
|
---|
28 | </p><div class="table"><a name="id2519887"></a><p class="title"><b>Table 5.4. StartsWith Attributes</b></p><table summary="StartsWith Attributes" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>The string to test.</td><td>Yes</td></tr><tr><td>with</td><td>Check if 'string' starts with this value.</td><td>Yes</td></tr></tbody></table></div><p>
|
---|
29 | </p><p>
|
---|
30 | </p><pre class="programlisting">
|
---|
31 |
|
---|
32 | <startswith string="abcdefg" with="abc"/>
|
---|
33 | <startswith string="${myprop}" with="foo"/>
|
---|
34 |
|
---|
35 | </pre><p>
|
---|
36 | </p><h3><a name="id2519962"></a>EndsWith</h3><p>
|
---|
37 | Given a property name, tests whether the value for that ends with with a specified string.
|
---|
38 | </p><p>
|
---|
39 | </p><div class="table"><a name="id2519974"></a><p class="title"><b>Table 5.5. EndsWith Attributes</b></p><table summary="EndsWith Attributes" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>string</td><td>The string to test.</td><td>Yes</td></tr><tr><td>with</td><td>Check if 'string' ends with this value.</td><td>Yes</td></tr></tbody></table></div><p>
|
---|
40 | </p><p>
|
---|
41 | </p><pre class="programlisting">
|
---|
42 |
|
---|
43 | <endswith string="abcdefg" with="efg"/>
|
---|
44 | <endswith string="${myprop}" with="bar"/>
|
---|
45 |
|
---|
46 | </pre><p>
|
---|
47 | </p><h3><a name="id2520049"></a>IsGreaterThan</h3><p>
|
---|
48 | Tests whether the first argument is greater than the second argument. Will
|
---|
49 | automatically treat the arguments as numbers if both arguments consists of only the characters 0 through 9 and optionally a decimal point. Otherwise, a String
|
---|
50 | comparison is used.
|
---|
51 | </p><p>
|
---|
52 | </p><div class="table"><a name="id2520064"></a><p class="title"><b>Table 5.6. IsGreaterThan Attributes</b></p><table summary="IsGreaterThan Attributes" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>arg1</td><td>The first argument.</td><td>Yes</td></tr><tr><td>arg2</td><td>The second argument.</td><td>Yes</td></tr></tbody></table></div><p>
|
---|
53 | </p><p>
|
---|
54 | </p><pre class="programlisting">
|
---|
55 |
|
---|
56 | <!-- evaluates to true -->
|
---|
57 | <isgreaterthan arg1="6.02" arg2="4"/>
|
---|
58 |
|
---|
59 | <!-- evaluates to false -->
|
---|
60 | <isgreaterthan arg1="bar" arg2="foo"/>
|
---|
61 |
|
---|
62 | </pre><p>
|
---|
63 | </p><h3><a name="id2520135"></a>IsLessThan</h3><p>
|
---|
64 | Tests whether the first argument is less than the second argument. Will
|
---|
65 | automatically treat the arguments as numbers if both arguments consists of only the characters 0 through 9 and optionally a decimal point. Otherwise, a String
|
---|
66 | comparison is used.
|
---|
67 | </p><p>
|
---|
68 | </p><div class="table"><a name="id2520155"></a><p class="title"><b>Table 5.7. IsLessThan Attributes</b></p><table summary="IsLessThan Attributes" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>arg1</td><td>The first argument.</td><td>Yes</td></tr><tr><td>arg2</td><td>The second argument.</td><td>Yes</td></tr></tbody></table></div><p>
|
---|
69 | </p><p>
|
---|
70 | </p><pre class="programlisting">
|
---|
71 |
|
---|
72 | <!-- evaluates to false -->
|
---|
73 | <islessthan arg1="6.02" arg2="4"/>
|
---|
74 |
|
---|
75 | <!-- evaluates to true -->
|
---|
76 | <islessthan arg1="bar" arg2="foo"/>
|
---|
77 |
|
---|
78 | </pre><p>
|
---|
79 | </p><h3><a name="id2520226"></a>DateBefore, TimeBefore </h3><p>
|
---|
80 | Tests whether the first date/time is before the second date/time.
|
---|
81 | </p><p>
|
---|
82 | </p><div class="table"><a name="id2520243"></a><p class="title"><b>Table 5.8. DateBefore, TimeBefore</b></p><table summary="DateBefore, TimeBefore" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>datetime1</td><td>The first date/time.</td><td>Yes</td></tr><tr><td>datetime2</td><td>The second date/time.</td><td>Yes</td></tr><tr><td>format</td><td>The format of the date/time stamps.</td><td>Yes</td></tr><tr><td>lenient</td><td>Whether the datetime parser should use lenient parsing, defaults to true.</td><td>No</td></tr></tbody></table></div><p>
|
---|
83 | </p><p>
|
---|
84 | </p><pre class="programlisting">
|
---|
85 |
|
---|
86 | <target name="test1">
|
---|
87 | <a:assert>
|
---|
88 | <bool>
|
---|
89 | <not>
|
---|
90 | <datebefore datetime1="2005-09-09 14:58:36" datetime2="2005-07-11 14:58:36" format="yyyy-MM-dd HH:mm:ss"/>
|
---|
91 | </not>
|
---|
92 | </bool>
|
---|
93 | </a:assert>
|
---|
94 | </target>
|
---|
95 |
|
---|
96 | <target name="test2">
|
---|
97 | <a:assert>
|
---|
98 | <bool>
|
---|
99 | <not>
|
---|
100 | <timebefore datetime1="22:58:36" datetime2="10:58:36" format="HH:mm:ss"/>
|
---|
101 | </not>
|
---|
102 | </bool>
|
---|
103 | </a:assert>
|
---|
104 | </target>
|
---|
105 |
|
---|
106 | <target name="test3">
|
---|
107 | <a:assert>
|
---|
108 | <bool>
|
---|
109 | <timebefore datetime1="2005" datetime2="2030" format="yyyy"/>
|
---|
110 | </bool>
|
---|
111 | </a:assert>
|
---|
112 | </target>
|
---|
113 |
|
---|
114 | <target name="test4">
|
---|
115 | <a:assert>
|
---|
116 | <bool>
|
---|
117 | <timebefore datetime1="01:00:00" datetime2="03:00:00" format="hh:mm:ss"/>
|
---|
118 | </bool>
|
---|
119 | </a:assert>
|
---|
120 | </target>
|
---|
121 |
|
---|
122 | </pre><p>
|
---|
123 | </p><h3><a name="id2520343"></a>DateDifference, TimeDifference </h3><p>
|
---|
124 | Tests that the difference between two dates or times is a certain value.
|
---|
125 | </p><p>
|
---|
126 | </p><div class="table"><a name="id2520355"></a><p class="title"><b>Table 5.9. DateDifference, TimeDifference</b></p><table summary="DateDifference, TimeDifference" border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Attribute</th><th>Description</th><th>Required</th></tr></thead><tbody><tr><td>datetime1</td><td>The first date/time.</td><td>Yes</td></tr><tr><td>datetime2</td><td>The second date/time.</td><td>Yes</td></tr><tr><td>format</td><td>The format of the date/time stamps.</td><td>Yes</td></tr><tr><td>lenient</td><td>Whether the datetime parser should use lenient parsing, defaults to true.</td><td>No</td></tr><tr><td>value</td><td>The expected difference between the 2 datetimes.</td><td>No, default is 0</td></tr><tr><td>unit</td><td>Sets the unit for the difference between the 2 datetimes. For example,
|
---|
127 | if value is 12 and unit is "hours", then this
|
---|
128 | condition checks that the difference between the 2 datetimes is 12 hours.
|
---|
129 | Valid values are "millisecond", "second", "minute", "hour", "day", "week", "month", "year".</td><td>Yes</td></tr></tbody></table></div><p>
|
---|
130 | </p><p>
|
---|
131 | </p><pre class="programlisting">
|
---|
132 |
|
---|
133 | <target name="test1">
|
---|
134 | <a:assert message="Difference between dates is not 60 days.">
|
---|
135 | <bool>
|
---|
136 | <datedifference datetime1="2005-09-09 14:58:36" datetime2="2005-07-11 14:58:36" format="yyyy-MM-dd HH:mm:ss" value="60" unit="day"/>
|
---|
137 | </bool>
|
---|
138 | </a:assert>
|
---|
139 | </target>
|
---|
140 |
|
---|
141 | <target name="test2">
|
---|
142 | <a:assert message="Difference between hours is not 12.">
|
---|
143 | <bool>
|
---|
144 | <timedifference datetime1="22:58:36" datetime2="10:58:36" format="HH:mm:ss" value="12" unit="hour"/>
|
---|
145 | </bool>
|
---|
146 | </a:assert>
|
---|
147 | </target>
|
---|
148 |
|
---|
149 | <target name="test3">
|
---|
150 | <a:assert message="Difference between years is not 25.">
|
---|
151 | <bool>
|
---|
152 | <timedifference datetime1="2005" datetime2="2030" format="yyyy" value="25" unit="year"/>
|
---|
153 | </bool>
|
---|
154 | </a:assert>
|
---|
155 | </target>
|
---|
156 |
|
---|
157 | <target name="test4">
|
---|
158 | <a:assert message="Difference between minutes is not 120.">
|
---|
159 | <bool>
|
---|
160 | <timedifference datetime1="01:00:00" datetime2="03:00:00" format="hh:mm:ss" value="120" unit="minute"/>
|
---|
161 | </bool>
|
---|
162 | </a:assert>
|
---|
163 | </target>
|
---|
164 |
|
---|
165 | <target name="test5">
|
---|
166 | <a:assert message="Difference between seconds is not 7200.">
|
---|
167 | <bool>
|
---|
168 | <timedifference datetime1="01:00:00" datetime2="03:00:00" format="hh:mm:ss" value="7200" unit="second"/>
|
---|
169 | </bool>
|
---|
170 | </a:assert>
|
---|
171 | </target>
|
---|
172 |
|
---|
173 | </pre><p>
|
---|
174 | </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="bk03ch05.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="bk03ch05.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="bk03ch06.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 5. If Task </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 6. SwitchTask</td></tr></table></div></body></html>
|
---|