summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbodewig <[email protected]>2007-09-11 08:52:26 +0000
committerbodewig <[email protected]>2007-09-11 08:52:26 +0000
commita875b1160a9eea7b28eb61610a13674a8cf8fb3b (patch)
treeeda236b2d19f0c50544e7c8450205368be8a0a82
parent933512f12c9208d078782b74fc9fd53a1cccba66 (diff)
Don't derive from Ant conditions when we don't use the base class at all
git-svn-id: file:///home/sven/projects/JOGL/temp/ant-contrib/svn/ant-contrib-code/ant-contrib/trunk@144 32d7a393-a5a9-423c-abd3-5d954feb1f2f
-rw-r--r--src/main/java/net/sf/antcontrib/logic/condition/IsGreaterThan.java8
-rw-r--r--src/main/java/net/sf/antcontrib/logic/condition/IsLessThan.java8
-rw-r--r--src/main/java/net/sf/antcontrib/logic/condition/IsPropertyFalse.java14
-rw-r--r--src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java14
4 files changed, 22 insertions, 22 deletions
diff --git a/src/main/java/net/sf/antcontrib/logic/condition/IsGreaterThan.java b/src/main/java/net/sf/antcontrib/logic/condition/IsGreaterThan.java
index d360825..5ac3b11 100644
--- a/src/main/java/net/sf/antcontrib/logic/condition/IsGreaterThan.java
+++ b/src/main/java/net/sf/antcontrib/logic/condition/IsGreaterThan.java
@@ -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 @@ import org.apache.tools.ant.taskdefs.condition.Equals;
* @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;
diff --git a/src/main/java/net/sf/antcontrib/logic/condition/IsLessThan.java b/src/main/java/net/sf/antcontrib/logic/condition/IsLessThan.java
index 64c676c..4d6a936 100644
--- a/src/main/java/net/sf/antcontrib/logic/condition/IsLessThan.java
+++ b/src/main/java/net/sf/antcontrib/logic/condition/IsLessThan.java
@@ -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 @@ import org.apache.tools.ant.taskdefs.condition.Equals;
* @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;
diff --git a/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyFalse.java b/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyFalse.java
index 479f9fd..44fe51c 100644
--- a/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyFalse.java
+++ b/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyFalse.java
@@ -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 @@ public class IsPropertyFalse extends IsFalse {
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);
}
}
diff --git a/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java b/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java
index d1060ab..d31f2bc 100644
--- a/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java
+++ b/src/main/java/net/sf/antcontrib/logic/condition/IsPropertyTrue.java
@@ -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 @@ public class IsPropertyTrue extends IsTrue {
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 );
}
}