Browse Source

* Better name for magic numbers: use 'prefix' instead of 'start'

* codestyle: getX() { return x; } ==> into multiple lines
* merge javadoc

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@579929 13f79535-47bb-0310-9956-ffa450edef68
master
Jan Materne 18 years ago
parent
commit
138108b44b
1 changed files with 31 additions and 18 deletions
  1. +31
    -18
      src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java

+ 31
- 18
src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java View File

@@ -145,9 +145,10 @@ import org.apache.tools.ant.util.ResourceUtils;
public class ModifiedSelector extends BaseExtendSelector public class ModifiedSelector extends BaseExtendSelector
implements BuildListener, ResourceSelector { implements BuildListener, ResourceSelector {


private static final String CACHE_START = "cache.";
private static final String ALGORITHM_START = "algorithm.";
private static final String COMPARATOR_START = "comparator.";
private static final String CACHE_PREFIX = "cache.";
private static final String ALGORITHM_PREFIX = "algorithm.";
private static final String COMPARATOR_PREFIX = "comparator.";



// ----- attributes ----- // ----- attributes -----


@@ -750,14 +751,14 @@ public class ModifiedSelector extends BaseExtendSelector
? true ? true
: false; : false;
setSeldirs(sdValue); setSeldirs(sdValue);
} else if (key.startsWith(CACHE_START)) {
String name = key.substring(CACHE_START.length());
} else if (key.startsWith(CACHE_PREFIX)) {
String name = key.substring(CACHE_PREFIX.length());
tryToSetAParameter(cache, name, value); tryToSetAParameter(cache, name, value);
} else if (key.startsWith(ALGORITHM_START)) {
String name = key.substring(ALGORITHM_START.length());
} else if (key.startsWith(ALGORITHM_PREFIX)) {
String name = key.substring(ALGORITHM_PREFIX.length());
tryToSetAParameter(algorithm, name, value); tryToSetAParameter(algorithm, name, value);
} else if (key.startsWith(COMPARATOR_START)) {
String name = key.substring(COMPARATOR_START.length());
} else if (key.startsWith(COMPARATOR_PREFIX)) {
String name = key.substring(COMPARATOR_PREFIX.length());
tryToSetAParameter(comparator, name, value); tryToSetAParameter(comparator, name, value);
} else { } else {
setError("Invalid parameter " + key); setError("Invalid parameter " + key);
@@ -884,7 +885,9 @@ public class ModifiedSelector extends BaseExtendSelector
* Get the cache type to use. * Get the cache type to use.
* @return the enumerated cache type * @return the enumerated cache type
*/ */
public Cache getCache() { return cache; }
public Cache getCache() {
return cache;
}


/** /**
* Set the cache type to use. * Set the cache type to use.
@@ -899,8 +902,10 @@ public class ModifiedSelector extends BaseExtendSelector
* The values are "propertyfile". * The values are "propertyfile".
*/ */
public static class CacheName extends EnumeratedAttribute { public static class CacheName extends EnumeratedAttribute {
/** @see EnumeratedAttribute#getValues() */
/** {@inheritDoc} */
/**
* {@inheritDoc}
* @see EnumeratedAttribute#getValues()
*/
public String[] getValues() { public String[] getValues() {
return new String[] {"propertyfile" }; return new String[] {"propertyfile" };
} }
@@ -910,7 +915,9 @@ public class ModifiedSelector extends BaseExtendSelector
* Get the algorithm type to use. * Get the algorithm type to use.
* @return the enumerated algorithm type * @return the enumerated algorithm type
*/ */
public Algorithm getAlgorithm() { return algorithm; }
public Algorithm getAlgorithm() {
return algorithm;
}


/** /**
* Set the algorithm type to use. * Set the algorithm type to use.
@@ -925,8 +932,10 @@ public class ModifiedSelector extends BaseExtendSelector
* The values are "hashValue", "digest" and "checksum". * The values are "hashValue", "digest" and "checksum".
*/ */
public static class AlgorithmName extends EnumeratedAttribute { public static class AlgorithmName extends EnumeratedAttribute {
/** @see EnumeratedAttribute#getValues() */
/** {@inheritDoc} */
/**
* {@inheritDoc}
* @see EnumeratedAttribute#getValues()
*/
public String[] getValues() { public String[] getValues() {
return new String[] {"hashvalue", "digest", "checksum" }; return new String[] {"hashvalue", "digest", "checksum" };
} }
@@ -936,7 +945,9 @@ public class ModifiedSelector extends BaseExtendSelector
* Get the comparator type to use. * Get the comparator type to use.
* @return the enumerated comparator type * @return the enumerated comparator type
*/ */
public Comparator getComparator() { return comparator; }
public Comparator getComparator() {
return comparator;
}


/** /**
* Set the comparator type to use. * Set the comparator type to use.
@@ -951,8 +962,10 @@ public class ModifiedSelector extends BaseExtendSelector
* The values are "equal" and "rule". * The values are "equal" and "rule".
*/ */
public static class ComparatorName extends EnumeratedAttribute { public static class ComparatorName extends EnumeratedAttribute {
/** @see EnumeratedAttribute#getValues() */
/** {@inheritDoc} */
/**
* {@inheritDoc}
* @see EnumeratedAttribute#getValues()
*/
public String[] getValues() { public String[] getValues() {
return new String[] {"equal", "rule" }; return new String[] {"equal", "rule" };
} }


Loading…
Cancel
Save