SF.net SVN: ant-contrib: [144] ant-contrib/trunk/src/main/java/net/sf/ antcontrib/logic/condition
[email protected] Tue, 11 Sep 2007 01:52:28 -0700
| Newsgroups | gmane.comp.java.ant-contrib.devel |
|---|---|
| Message-ID | <[email protected]> |
Revision: 144
http://ant-contrib.svn.sourceforge.net/ant-contrib/?rev=144&view=rev
Author: bodewig
Date: 2007-09-11 01:52:26 -0700 (Tue, 11 Sep 2007)
Log Message:
-----------
Don't derive from Ant conditions when we don't use the base class at all
Modified Paths:
--------------
ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsGreaterThan.java
ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsLessThan.java
ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyFalse.java
ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java
Modified: ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsGreaterThan.java
===================================================================
--- ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsGreaterThan.java 2007-08-28 04:52:05 UTC (rev 143)
+++ ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsGreaterThan.java 2007-09-11 08:52:26 UTC (rev 144)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ * Copyright (c) 2001-2004, 2007 Ant-Contrib project. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +16,10 @@
package net.sf.antcontrib.logic.condition;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.condition.Equals;
+import org.apache.tools.ant.taskdefs.condition.Condition;
/**
- * Extends Equals condition to test if the first argument is greater than the
+ * Condition to test if the first argument is greater than the
* second argument. Will deal with base 10 integer and decimal numbers, otherwise,
* treats arguments as Strings.
* <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
@@ -27,7 +27,7 @@
* @author Dale Anson, [email protected]
* @version $Revision: 1.4 $
*/
-public class IsGreaterThan extends Equals {
+public final class IsGreaterThan implements Condition {
private String arg1, arg2;
private boolean trim = false;
Modified: ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsLessThan.java
===================================================================
--- ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsLessThan.java 2007-08-28 04:52:05 UTC (rev 143)
+++ ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsLessThan.java 2007-09-11 08:52:26 UTC (rev 144)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ * Copyright (c) 2001-2004, 2007 Ant-Contrib project. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +16,10 @@
package net.sf.antcontrib.logic.condition;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.condition.Equals;
+import org.apache.tools.ant.taskdefs.condition.Condition;
/**
- * Extends Equals condition to test if the first argument is less than the
+ * Condition to test if the first argument is less than the
* second argument. Will deal with base 10 integer and decimal numbers, otherwise,
* treats arguments as Strings.
* <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
@@ -27,7 +27,7 @@
* @author Dale Anson, [email protected]
* @version $Revision: 1.4 $
*/
-public class IsLessThan extends Equals {
+public final class IsLessThan implements Condition {
private String arg1, arg2;
private boolean trim = false;
Modified: ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyFalse.java
===================================================================
--- ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyFalse.java 2007-08-28 04:52:05 UTC (rev 143)
+++ ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyFalse.java 2007-09-11 08:52:26 UTC (rev 144)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ * Copyright (c) 2001-2004, 2007 Ant-Contrib project. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,16 +16,18 @@
package net.sf.antcontrib.logic.condition;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.condition.IsFalse;
+import org.apache.tools.ant.ProjectComponent;
+import org.apache.tools.ant.taskdefs.condition.Condition;
/**
- * Extends IsFalse condition to check the value of a specified property.
+ * Checks the value of a specified property.
* <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
*
* @author Dale Anson, [email protected]
* @version $Revision: 1.3 $
*/
-public class IsPropertyFalse extends IsFalse {
+public final class IsPropertyFalse
+ extends ProjectComponent implements Condition {
private String name = null;
@@ -37,9 +39,7 @@
if (name == null)
throw new BuildException("Property name must be set.");
String value = getProject().getProperty(name);
- if (value == null)
- return true;
- return !getProject().toBoolean(value);
+ return value == null || !getProject().toBoolean(value);
}
}
Modified: ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java
===================================================================
--- ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java 2007-08-28 04:52:05 UTC (rev 143)
+++ ant-contrib/trunk/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java 2007-09-11 08:52:26 UTC (rev 144)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001-2004 Ant-Contrib project. All rights reserved.
+ * Copyright (c) 2001-2004, 2007 Ant-Contrib project. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,16 +16,18 @@
package net.sf.antcontrib.logic.condition;
import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.condition.IsTrue;
+import org.apache.tools.ant.ProjectComponent;
+import org.apache.tools.ant.taskdefs.condition.Condition;
/**
- * Extends IsTrue condition to check the value of a specified property.
+ * Checks the value of a specified property.
* <p>Developed for use with Antelope, migrated to ant-contrib Oct 2003.
*
* @author Dale Anson, [email protected]
* @version $Revision: 1.3 $
*/
-public class IsPropertyTrue extends IsTrue {
+public final class IsPropertyTrue
+ extends ProjectComponent implements Condition {
private String name = null;
@@ -37,9 +39,7 @@
if ( name == null )
throw new BuildException( "Property name must be set." );
String value = getProject().getProperty( name );
- if ( value == null )
- return false;
- return getProject().toBoolean( value );
+ return value != null && getProject().toBoolean( value );
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/