Honestly, I've done something similar... However, my approach was to subtract the two numbers and if examine the 1st character to determine <, > or =... a "-" means less than, "0" means equal otherwise its greater than.

I couldn't find exactly what I wanted either...that's why I "rolled my own"



Hunter Peress wrote:
Im using ant-contrib to implement a greater-than (for ints only)
functionality.
Did I miss something in the documentation? Or is this the best approach (i
realize I could have written a custom ant task)

Did i reinvent some wheel in ant?

 <target name="t">
   <taskdef resource="net/sf/antcontrib/antlib.xml">
    <classpath>
      <pathelement location="ant-contrib-0.6.jar"/>
    </classpath>
  </taskdef>

   <macrodef name="greaterthan">
      <attribute name="resultprop" default="NOT SET"/>
      <attribute name="arg1" default="NOT SET"/>
      <attribute name="arg2" default="NOT SET"/>
      <sequential>
        <math result="gt_tmp" datatype="int">
          <op op="max" >
            <num value="@{arg1}"/>
            <num value="@{arg2}"/>
          </op>
        </math>
        <echo>${gt_tmp}</echo>
        <if>
          <equals arg1="@{arg1}" arg2="${gt_tmp}" />
          <then>
            <property name="@{resultprop}" value="1" />
          </then>
          <else>
            <property name="@{resultprop}" value="0" />
          </else>
        </if>
      </sequential>
   </macrodef>

   <greaterthan arg1="100" arg2="20" resultprop="well" />
   <echo>${well}</echo>
 </target>


--
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to