diff --git a/src/java/org/apache/commons/lang/ArrayUtils.java b/src/java/org/apache/commons/lang/ArrayUtils.java index 85bceed56..c3c04846a 100644 --- a/src/java/org/apache/commons/lang/ArrayUtils.java +++ b/src/java/org/apache/commons/lang/ArrayUtils.java @@ -70,47 +70,85 @@ * @author Nikolay Metchev * @author Matthew Hawthorne * @since 2.0 - * @version $Id: ArrayUtils.java,v 1.17 2003/07/12 10:09:40 scolebourne Exp $ + * @version $Id: ArrayUtils.java,v 1.18 2003/07/14 22:25:02 bayard Exp $ */ public class ArrayUtils { - /** An empty immutable object array */ + /** + * An empty immutable Object array. + */ public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - /** An empty immutable class array */ + /** + * An empty immutable Class array. + */ public static final Class[] EMPTY_CLASS_ARRAY = new Class[0]; - /** An empty immutable string array */ + /** + * An empty immutable String array. + */ public static final String[] EMPTY_STRING_ARRAY = new String[0]; - /** An empty immutable long array */ + /** + * An empty immutable long array. + */ public static final long[] EMPTY_LONG_ARRAY = new long[0]; - /** An empty immutable Long array */ + /** + * An empty immutable Long array. + */ public static final Long[] EMPTY_LONG_OBJECT_ARRAY = new Long[0]; - /** An empty immutable int array */ + /** + * An empty immutable int array. + */ public static final int[] EMPTY_INT_ARRAY = new int[0]; - /** An empty immutable Integer array */ + /** + * An empty immutable Integer array. + */ public static final Integer[] EMPTY_INTEGER_OBJECT_ARRAY = new Integer[0]; - /** An empty immutable short array */ + /** + * An empty immutable short array. + */ public static final short[] EMPTY_SHORT_ARRAY = new short[0]; - /** An empty immutable Short array */ + /** + * An empty immutable Short array. + */ public static final Short[] EMPTY_SHORT_OBJECT_ARRAY = new Short[0]; - /** An empty immutable byte array */ + /** + * An empty immutable byte array. + */ public static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; - /** An empty immutable Byte array */ + /** + * An empty immutable Byte array. + */ public static final Byte[] EMPTY_BYTE_OBJECT_ARRAY = new Byte[0]; - /** An empty immutable double array */ + /** + * An empty immutable double array. + */ public static final double[] EMPTY_DOUBLE_ARRAY = new double[0]; - /** An empty immutable Double array */ + /** + * An empty immutable Double array. + */ public static final Double[] EMPTY_DOUBLE_OBJECT_ARRAY = new Double[0]; - /** An empty immutable float array */ + /** + * An empty immutable float array. + */ public static final float[] EMPTY_FLOAT_ARRAY = new float[0]; - /** An empty immutable Float array */ + /** + * An empty immutable Float array. + */ public static final Float[] EMPTY_FLOAT_OBJECT_ARRAY = new Float[0]; - /** An empty immutable boolean array */ + /** + * An empty immutable boolean array. + */ public static final boolean[] EMPTY_BOOLEAN_ARRAY = new boolean[0]; - /** An empty immutable Boolean array */ + /** + * An empty immutable Boolean array. + */ public static final Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY = new Boolean[0]; - /** An empty immutable char array */ + /** + * An empty immutable char array. + */ public static final char[] EMPTY_CHAR_ARRAY = new char[0]; - /** An empty immutable Character array */ + /** + * An empty immutable Character array. + */ public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY = new Character[0]; /** @@ -131,7 +169,7 @@ public ArrayUtils() { *

Multi-dimensional arrays are handled correctly, including * multi-dimensional primitive arrays.

* - *

The format is that of Java source code, for example {a,b}.

+ *

The format is that of Java source code, for example {a,b}.

* * @param array the array to get a toString for, may be null * @return a String representation of the array, '{}' if null passed in @@ -146,7 +184,7 @@ public static String toString(final Object array) { *

Multi-dimensional arrays are handled correctly, including * multi-dimensional primitive arrays.

* - *

The format is that of Java source code, for example {a,b}.

+ *

The format is that of Java source code, for example {a,b}.

* * @param array the array to get a toString for, may be null * @param stringIfNull the String to return if the array is null @@ -801,7 +839,7 @@ public static void reverse(final boolean[] array) { * * @param array the array to search through for the object, may be null * @param objectToFind the object to find, may be null - * @return the index of the object within the array, or -1 if not found + * @return the index of the object within the array, or -1 if not found */ public static int indexOf(final Object[] array, final Object objectToFind) { return indexOf(array, objectToFind, 0); @@ -813,13 +851,13 @@ public static int indexOf(final Object[] array, final Object objectToFind) { *

This method returns -1 if null array input.

* *

A negative startIndex is treated as zero. A startIndex larger than the array - * length will return -1.

+ * length will return -1.

* * @param array the array to search through for the object, may be null * @param objectToFind the object to find, may be null * @param startIndex the index to start searching at * @return the index of the object within the array starting at the - * given index, or -1 if not found + * given index, or -1 if not found */ public static int indexOf(final Object[] array, final Object objectToFind, int startIndex) { if (array == null) { @@ -851,7 +889,7 @@ public static int indexOf(final Object[] array, final Object objectToFind, int s * * @param array the array to travers backwords looking for the object, may be null * @param objectToFind the object to find, may be null - * @return the last index of the object to find, or -1 if not found + * @return the last index of the object to find, or -1 if not found */ public static int lastIndexOf(final Object[] array, final Object objectToFind) { return lastIndexOf(array, objectToFind, Integer.MAX_VALUE); @@ -862,14 +900,14 @@ public static int lastIndexOf(final Object[] array, final Object objectToFind) { * *

This method returns -1 if null array input.

* - *

A negative startIndex will return -1. A startIndex larger than the array - * length will search from the end of the array.

+ *

A negative startIndex will return -1. A startIndex larger than + * the array length will search from the end of the array.

* * @param array the array to traverse for looking for the object, may be null * @param objectToFind the object to find, may be null * @param startIndex the start index to travers backwards from * @return the last index of the object within the array starting at the given index, - * or -1 if not found + * or -1 if not found */ public static int lastIndexOf(final Object[] array, final Object objectToFind, int startIndex) { if (array == null) { @@ -1644,7 +1682,7 @@ public static boolean[] toPrimitive(final Boolean[] array) { } /** - *

Converts an array of object Booleans to primitives handling null.

+ *

Converts an array of object Booleans to primitives handling null.

* *

This method returns null if null array input.

* @@ -1712,7 +1750,7 @@ public static byte[] toPrimitive(final Byte[] array) { } /** - *

Converts an array of object Bytes to primitives handling null.

+ *

Converts an array of object Bytes to primitives handling null.

* *

This method returns null if null array input.

* @@ -1780,7 +1818,7 @@ public static short[] toPrimitive(final Short[] array) { } /** - *

Converts an array of object Short to primitives handling null.

+ *

Converts an array of object Short to primitives handling null.

* *

This method returns null if null array input.

* @@ -1848,7 +1886,7 @@ public static int[] toPrimitive(final Integer[] array) { } /** - *

Converts an array of object Integer to primitives handling null.

+ *

Converts an array of object Integer to primitives handling null.

* *

This method returns null if null array input.

* @@ -1916,7 +1954,7 @@ public static long[] toPrimitive(final Long[] array) { } /** - *

Converts an array of object Long to primitives handling null.

+ *

Converts an array of object Long to primitives handling null.

* *

This method returns null if null array input.

* @@ -1984,7 +2022,7 @@ public static float[] toPrimitive(final Float[] array) { } /** - *

Converts an array of object Floats to primitives handling null.

+ *

Converts an array of object Floats to primitives handling null.

* *

This method returns null if null array input.

* @@ -2052,7 +2090,7 @@ public static double[] toPrimitive(final Double[] array) { } /** - *

Converts an array of object Doubles to primitives handling null.

+ *

Converts an array of object Doubles to primitives handling null.

* *

This method returns null if null array input.

* diff --git a/src/java/org/apache/commons/lang/BooleanUtils.java b/src/java/org/apache/commons/lang/BooleanUtils.java index 9b1d24c90..ed732fbed 100644 --- a/src/java/org/apache/commons/lang/BooleanUtils.java +++ b/src/java/org/apache/commons/lang/BooleanUtils.java @@ -62,7 +62,7 @@ * @author Stephen Colebourne * @author Matthew Hawthorne * @since 2.0 - * @version $Id: BooleanUtils.java,v 1.6 2003/06/28 18:16:03 scolebourne Exp $ + * @version $Id: BooleanUtils.java,v 1.7 2003/07/14 22:25:02 bayard Exp $ */ public class BooleanUtils { @@ -108,10 +108,11 @@ public static Boolean toBooleanObject(boolean bool) { } /** - *

Converts a Boolean to a boolean handling null by returning false.

+ *

Converts a Boolean to a boolean handling null + * by returning false.

* * @param bool the boolean to convert - * @return true or false + * @return true or false */ public static boolean toBoolean(Boolean bool) { if (bool == null) { @@ -121,11 +122,11 @@ public static boolean toBoolean(Boolean bool) { } /** - *

Converts a Boolean to a boolean handling null.

+ *

Converts a Boolean to a boolean handling null.

* * @param bool the boolean to convert - * @param valueIfNull the boolean value to return if null - * @return true or false + * @param valueIfNull the boolean value to return if null + * @return true or false */ public static boolean toBooleanDefaultIfNull(Boolean bool, boolean valueIfNull) { if (bool == null) { @@ -137,32 +138,38 @@ public static boolean toBooleanDefaultIfNull(Boolean bool, boolean valueIfNull) // Integer to Boolean methods //-------------------------------------------------------------------------- /** - *

Convert an int to a boolean using the convention that zero is false.

+ *

Convert an int to a boolean using the convention that zero + * is false.

* * @param value the int to convert - * @return true if non-zero, false if zero + * @return true if non-zero, false + * if zero */ public static boolean toBoolean(int value) { return (value == 0 ? false : true); } /** - *

Convert an int to a Boolean using the convention that zero is false.

+ *

Convert an int to a Boolean using the convention that zero + * is false.

* * @param value the int to convert - * @return Boolean.TRUE if non-zero, Boolean.FALSE if zero, null if null + * @return Boolean.TRUE if non-zero, Boolean.FALSE if zero, + * null if null */ public static Boolean toBooleanObject(int value) { return (value == 0 ? Boolean.FALSE : Boolean.TRUE); } /** - *

Convert an Integer to a Boolean using the convention that zero is false.

+ *

Convert an Integer to a Boolean using the convention that zero + * is false.

* - *

null will be converted to null.

+ *

null will be converted to null.

* * @param value the Integer to convert - * @return Boolean.TRUE if non-zero, Boolean.FALSE if zero, null if null + * @return Boolean.TRUE if non-zero, Boolean.FALSE if zero, + * null if null */ public static Boolean toBooleanObject(Integer value) { if (value == null) { @@ -175,9 +182,9 @@ public static Boolean toBooleanObject(Integer value) { *

Convert an int to a boolean specifying the conversion values.

* * @param value the Integer to convert - * @param trueValue the value to match for true - * @param falseValue the value to match for false - * @return true or false + * @param trueValue the value to match for true + * @param falseValue the value to match for false + * @return true or false * @throws IllegalArgumentException if no match */ public static boolean toBoolean(int value, int trueValue, int falseValue) { @@ -194,9 +201,11 @@ public static boolean toBoolean(int value, int trueValue, int falseValue) { *

Convert an Integer to a boolean specifying the conversion values.

* * @param value the Integer to convert - * @param trueValue the value to match for true, may be null - * @param falseValue the value to match for false, may be null - * @return true or false + * @param trueValue the value to match for true, + * may be null + * @param falseValue the value to match for false, + * may be null + * @return true or false * @throws IllegalArgumentException if no match */ public static boolean toBoolean(Integer value, Integer trueValue, Integer falseValue) { @@ -219,10 +228,10 @@ public static boolean toBoolean(Integer value, Integer trueValue, Integer falseV *

Convert an int to a Boolean specifying the conversion values.

* * @param value the Integer to convert - * @param trueValue the value to match for true - * @param falseValue the value to match for false - * @param nullValue the value to to match for null - * @return Boolean.TRUE, Boolean.FALSE, or null + * @param trueValue the value to match for true + * @param falseValue the value to match for false + * @param nullValue the value to to match for null + * @return Boolean.TRUE, Boolean.FALSE, or null * @throws IllegalArgumentException if no match */ public static Boolean toBooleanObject(int value, int trueValue, int falseValue, int nullValue) { @@ -241,10 +250,13 @@ public static Boolean toBooleanObject(int value, int trueValue, int falseValue, *

Convert an Integer to a Boolean specifying the conversion values.

* * @param value the Integer to convert - * @param trueValue the value to match for true, may be null - * @param falseValue the value to match for false, may be null - * @param nullValue the value to to match for null, may be null - * @return Boolean.TRUE, Boolean.FALSE, or null + * @param trueValue the value to match for true, + * may be null + * @param falseValue the value to match for false, + * may be null + * @param nullValue the value to to match for null, + * may be null + * @return Boolean.TRUE, Boolean.FALSE, or null * @throws IllegalArgumentException if no match */ public static Boolean toBooleanObject(Integer value, Integer trueValue, Integer falseValue, Integer nullValue) { @@ -270,32 +282,35 @@ public static Boolean toBooleanObject(Integer value, Integer trueValue, Integer // Boolean to Integer methods //-------------------------------------------------------------------------- /** - *

Convert a boolean to an int using the convention that zero is false.

+ *

Convert a boolean to an int using the convention that + * zero is false.

* * @param bool the boolean to convert - * @return one if true, zero if false + * @return one if true, zero if false */ public static int toInteger(boolean bool) { return (bool ? 1 : 0); } /** - *

Convert a boolean to an Integer using the convention that zero is false.

+ *

Convert a boolean to an Integer using the convention that + * zero is false.

* * @param bool the boolean to convert - * @return one if true, zero if false + * @return one if true, zero if false */ public static Integer toIntegerObject(boolean bool) { return (bool ? NumberUtils.INTEGER_ONE : NumberUtils.INTEGER_ZERO); } /** - *

Convert a Boolean to a Integer using the convention that zero is false.

+ *

Convert a Boolean to a Integer using the convention that + * zero is false.

* - *

null will be converted to null.

+ *

null will be converted to null.

* * @param bool the Boolean to convert - * @return one if Boolean.TRUE, zero if Boolean.FALSE, null if null + * @return one if Boolean.TRUE, zero if Boolean.FALSE, null if null */ public static Integer toIntegerObject(Boolean bool) { if (bool == null) { @@ -308,8 +323,8 @@ public static Integer toIntegerObject(Boolean bool) { *

Convert a boolean to an int specifying the conversion values.

* * @param bool the to convert - * @param trueValue the value to return if true - * @param falseValue the value to return if false + * @param trueValue the value to return if true + * @param falseValue the value to return if false * @return the appropriate value */ public static int toInteger(boolean bool, int trueValue, int falseValue) { @@ -320,9 +335,9 @@ public static int toInteger(boolean bool, int trueValue, int falseValue) { *

Convert a Boolean to an int specifying the conversion values.

* * @param bool the Boolean to convert - * @param trueValue the value to return if true - * @param falseValue the value to return if false - * @param nullValue the value to return if null + * @param trueValue the value to return if true + * @param falseValue the value to return if false + * @param nullValue the value to return if null * @return the appropriate value */ public static int toInteger(Boolean bool, int trueValue, int falseValue, int nullValue) { @@ -336,8 +351,10 @@ public static int toInteger(Boolean bool, int trueValue, int falseValue, int nul *

Convert a boolean to an Integer specifying the conversion values.

* * @param bool the to convert - * @param trueValue the value to return if true, may be null - * @param falseValue the value to return if false, may be null + * @param trueValue the value to return if true, + * may be null + * @param falseValue the value to return if false, + * may be null * @return the appropriate value */ public static Integer toIntegerObject(boolean bool, Integer trueValue, Integer falseValue) { @@ -348,9 +365,12 @@ public static Integer toIntegerObject(boolean bool, Integer trueValue, Integer f *

Convert a Boolean to an Integer specifying the conversion values.

* * @param bool the Boolean to convert - * @param trueValue the value to return if true, may be null - * @param falseValue the value to return if false, may be null - * @param nullValue the value to return if null, may be null + * @param trueValue the value to return if true, + * may be null + * @param falseValue the value to return if false, + * may be null + * @param nullValue the value to return if null, + * may be null * @return the appropriate value */ public static Integer toIntegerObject(Boolean bool, Integer trueValue, Integer falseValue, Integer nullValue) { @@ -365,12 +385,15 @@ public static Integer toIntegerObject(Boolean bool, Integer trueValue, Integer f /** *

Converts a String to a Boolean.

* - *

'true', 'on' or 'yes' (case insensitive) will return true. - * 'false', 'off' or 'no' (case insensitive) will return false. - * Otherwise, null is returned.

+ *

'true', 'on' or 'yes' + * (case insensitive) will return true. + * 'false', 'off' or 'no' + * (case insensitive) will return false. + * Otherwise, null is returned.

* * @param str the String to check - * @return the Boolean value of the string, null if no match or null input + * @return the Boolean value of the string, null + * if no match or null input */ public static Boolean toBooleanObject(String str) { if ("true".equalsIgnoreCase(str)) { @@ -394,10 +417,14 @@ public static Boolean toBooleanObject(String str) { *

Converts a String to a Boolean throwing an exception if no match.

* * @param str the String to check - * @param trueString the String to match for true (case sensitive), may be null - * @param falseString the String to match for false (case sensitive), may be null - * @param nullString the String to match for null (case sensitive), may be null - * @return the Boolean value of the string, null if no match or null input + * @param trueString the String to match for true + * (case sensitive), may be null + * @param falseString the String to match for false + * (case sensitive), may be null + * @param nullString the String to match for null + * (case sensitive), may be null + * @return the Boolean value of the string, null + * if no match or null input */ public static Boolean toBooleanObject(String str, String trueString, String falseString, String nullString) { if (str == null) { @@ -424,11 +451,12 @@ public static Boolean toBooleanObject(String str, String trueString, String fals /** *

Converts a String to a boolean.

* - *

'true', 'on' or 'yes' (case insensitive) will return true. - * Otherwise, false is returned.

+ *

'true', 'on' or 'yes' + * (case insensitive) will return true. Otherwise, + * false is returned.

* * @param str the String to check - * @return the boolean value of the string, false if no match + * @return the boolean value of the string, false if no match */ public static boolean toBoolean(String str) { if ("true".equalsIgnoreCase(str)) { @@ -448,8 +476,10 @@ public static boolean toBoolean(String str) { *

null is returned if there is no match.

* * @param str the String to check - * @param trueString the String to match for true (case sensitive), may be null - * @param falseString the String to match for false (case sensitive), may be null + * @param trueString the String to match for true + * (case sensitive), may be null + * @param falseString the String to match for false + * (case sensitive), may be null * @return the boolean value of the string * @throws IllegalArgumentException if the String doesn't match */ @@ -472,30 +502,36 @@ public static boolean toBoolean(String str, String trueString, String falseStrin // Boolean to String methods //-------------------------------------------------------------------------- /** - *

Converts a Boolean to a String returning 'true', 'false', or null.

+ *

Converts a Boolean to a String returning 'true', + * 'false', or null.

* * @param bool the Boolean to check - * @return 'true', 'false', or null + * @return 'true', 'false', + * or null */ public static String toStringTrueFalse(Boolean bool) { return toString(bool, "true", "false", null); } /** - *

Converts a Boolean to a String returning 'on', 'off', or null.

+ *

Converts a Boolean to a String returning 'on', + * 'off', or null.

* * @param bool the Boolean to check - * @return 'on', 'off', or null + * @return 'on', 'off', + * or null */ public static String toStringOnOff(Boolean bool) { return toString(bool, "on", "off", null); } /** - *

Converts a Boolean to a String returning 'yes', 'no', or null.

+ *

Converts a Boolean to a String returning 'yes', + * 'no', or null.

* * @param bool the Boolean to check - * @return 'yes', 'no', or null + * @return 'yes', 'no', + * or null */ public static String toStringYesNo(Boolean bool) { return toString(bool, "yes", "no", null); @@ -505,9 +541,12 @@ public static String toStringYesNo(Boolean bool) { *

Converts a Boolean to a String returning one of the input Strings.

* * @param bool the Boolean to check - * @param trueString the String to return if true, may be null - * @param falseString the String to return if false, may be null - * @param nullString the String to return if null, may be null + * @param trueString the String to return if true, + * may be null + * @param falseString the String to return if false, + * may be null + * @param nullString the String to return if null, + * may be null * @return one of the three input Strings */ public static String toString(Boolean bool, String trueString, String falseString, String nullString) { @@ -520,30 +559,36 @@ public static String toString(Boolean bool, String trueString, String falseStrin // boolean to String methods //-------------------------------------------------------------------------- /** - *

Converts a boolean to a String returning 'true' or 'false'.

+ *

Converts a boolean to a String returning 'true' + * or 'false'.

* * @param bool the Boolean to check - * @return 'true', 'false', or null + * @return 'true', 'false', + * or null */ public static String toStringTrueFalse(boolean bool) { return toString(bool, "true", "false"); } /** - *

Converts a boolean to a String returning 'on' or 'off'.

+ *

Converts a boolean to a String returning 'on' + * or 'off'.

* * @param bool the Boolean to check - * @return 'on', 'off', or null + * @return 'on', 'off', + * or null */ public static String toStringOnOff(boolean bool) { return toString(bool, "on", "off"); } /** - *

Converts a boolean to a String returning 'yes' or 'no'.

+ *

Converts a boolean to a String returning 'yes' + * or 'no'.

* * @param bool the Boolean to check - * @return 'yes', 'no', or null + * @return 'yes', 'no', + * or null */ public static String toStringYesNo(boolean bool) { return toString(bool, "yes", "no"); @@ -553,8 +598,10 @@ public static String toStringYesNo(boolean bool) { *

Converts a boolean to a String returning one of the input Strings.

* * @param bool the Boolean to check - * @param trueString the String to return if true, may be null - * @param falseString the String to return if false, may be null + * @param trueString the String to return if true, + * may be null + * @param falseString the String to return if false, + * may be null * @return one of the two input Strings */ public static String toString(boolean bool, String trueString, String falseString) { @@ -564,7 +611,7 @@ public static String toString(boolean bool, String trueString, String falseStrin // xor methods // -------------------------------------------------------------------------- /** - * Performs an xor on a set of booleans. + *

Performs an xor on a set of booleans.

* * @param array an array of booleans * @return true if the xor is successful. @@ -598,7 +645,7 @@ public static boolean xor(boolean[] array) { } /** - * Performs an xor on an array of Booleans. + *

Performs an xor on an array of Booleans.

* * @param array an array of Booleans * @return true if the xor is successful. diff --git a/src/java/org/apache/commons/lang/CharRange.java b/src/java/org/apache/commons/lang/CharRange.java index 6f9355ed9..fcc5fe1dd 100644 --- a/src/java/org/apache/commons/lang/CharRange.java +++ b/src/java/org/apache/commons/lang/CharRange.java @@ -62,12 +62,12 @@ * @author Henri Yandell * @author Stephen Colebourne * @since 1.0 - * @version $Id: CharRange.java,v 1.5 2003/03/23 17:59:09 scolebourne Exp $ + * @version $Id: CharRange.java,v 1.6 2003/07/14 22:25:02 bayard Exp $ */ class CharRange { /** - * Used internally to represent null in a char. + *

Used internally to represent null in a char.

*/ private static char UNSET; diff --git a/src/java/org/apache/commons/lang/CharSetUtils.java b/src/java/org/apache/commons/lang/CharSetUtils.java index d937c16d6..fb8bdf044 100644 --- a/src/java/org/apache/commons/lang/CharSetUtils.java +++ b/src/java/org/apache/commons/lang/CharSetUtils.java @@ -59,7 +59,7 @@ * @author Henri Yandell * @author Stephen Colebourne * @since 1.0 - * @version $Id: CharSetUtils.java,v 1.11 2003/04/09 00:07:50 ggregory Exp $ + * @version $Id: CharSetUtils.java,v 1.12 2003/07/14 22:25:02 bayard Exp $ */ public class CharSetUtils { @@ -78,10 +78,10 @@ public CharSetUtils() { * set logic to be performed.

*

The syntax is:

*
    - *
  • "aeio" which implies 'a','e',.. - *
  • "^e" implies not e. However it only negates, it's not - * a set in itself due to the size of that set in unicode. - *
  • "ej-m" implies e,j->m. e,j,k,l,m. + *
  • "aeio" which implies 'a','e',..
  • + *
  • "^e" implies not e. However it only negates, it's not + * a set in itself due to the size of that set in unicode.
  • + *
  • "ej-m" implies e,j->m. e,j,k,l,m.
  • *
* * @param set @@ -98,7 +98,7 @@ public static CharSet evaluateSet(String[] set) { * *

An example is:

*
    - *
  • squeeze("hello", "el") => "helo" + *
  • squeeze("hello", "el") => "helo"
  • *
* @see #evaluateSet(java.lang.String[]) for set-syntax. * @@ -117,7 +117,7 @@ public static String squeeze(String str, String set) { * *

An example is:

*
    - *
  • squeeze("hello", {"el"}) => "helo" + *
  • squeeze("hello", {"el"}) => "helo"
  • *
* @see #evaluateSet(java.lang.String[]) for set-syntax. * @@ -152,7 +152,7 @@ public static String squeeze(String str, String[] set) { * *

An example would be:

*
    - *
  • count("hello", {"c-f","o"}) returns 2. + *
  • count("hello", {"c-f", "o"}) returns 2.
  • *
* * @param str String target to count characters in @@ -168,9 +168,9 @@ public static int count(String str, String set) { *

Takes an argument in set-syntax, see evaluateSet, * and returns the number of characters present in the specified string.

* - * An example would be:

+ *

An example would be:

*
    - *
  • count("hello", {"c-f","o"}) returns 2. + *
  • count("hello", {"c-f", "o"}) returns 2.
  • *
* * @param str String target to count characters in @@ -195,7 +195,7 @@ public static int count(String str, String[] set) { * *

An example would be:

*
    - *
  • keep("hello", {"c-fo"}) returns "hll" + *
  • keep("hello", {"c-fo"}) returns "hll"
  • *
* * @param str String target to keep characters from @@ -213,7 +213,8 @@ public static String keep(String str, String set) { * *

An example would be:

*
    - *
  • keep("hello", {"c-f","o"}) returns "hll" + *
  • keep("hello", {"c-f", "o"}) + * returns "hll"
  • *
* * @param str String target to keep characters from @@ -231,7 +232,7 @@ public static String keep(String str, String[] set) { * *

An example would be:

*
    - *
  • delete("hello", {"c-fo"}) returns "hll" + *
  • delete("hello", {"c-fo"}) returns "hll"
  • *
* * @param str String target to delete characters from @@ -249,7 +250,8 @@ public static String delete(String str, String set) { * *

An example would be:

*
    - *
  • delete("hello", {"c-f","o"}) returns "hll" + *
  • delete("hello", {"c-f", "o"}) returns + * "hll"
  • *
* * @param str String target to delete characters from @@ -280,7 +282,8 @@ private static String modify(String str, String[] set, boolean expect) { * *

An example is:

*
    - *
  • translate("hello", "ho", "jy") => jelly + *
  • translate("hello", "ho", "jy") + * => jelly
  • *
* *

If the length of characters to search for is greater than the diff --git a/src/java/org/apache/commons/lang/ClassUtils.java b/src/java/org/apache/commons/lang/ClassUtils.java index 4131487a3..2258b3e49 100644 --- a/src/java/org/apache/commons/lang/ClassUtils.java +++ b/src/java/org/apache/commons/lang/ClassUtils.java @@ -62,27 +62,27 @@ * @author Stephen Colebourne * @author Gary Gregory * @since 2.0 - * @version $Id: ClassUtils.java,v 1.12 2003/05/29 21:02:53 ggregory Exp $ + * @version $Id: ClassUtils.java,v 1.13 2003/07/14 22:25:02 bayard Exp $ */ public class ClassUtils { /** - * The package separator character: . + *

The package separator character: ..

*/ public static final char PACKAGE_SEPARATOR_CHAR = '.'; /** - * The package separator String: . + *

The package separator String: ..

*/ public static final String PACKAGE_SEPARATOR = String.valueOf(PACKAGE_SEPARATOR_CHAR); /** - * The inner class separator character: $ + *

The inner class separator character: $.

*/ public static final char INNER_CLASS_SEPARATOR_CHAR = '$'; /** - * The inner class separator String: $ + *

The inner class separator String: $.

*/ public static final String INNER_CLASS_SEPARATOR = String.valueOf(INNER_CLASS_SEPARATOR_CHAR); @@ -319,9 +319,9 @@ public static List getAllInterfaces(Class cls) { // ------------------------------------------------------------------------- /** - *

Given a List of class names, this method converts them into classes. + *

Given a List of class names, this method converts them into classes.

* - * A new List is returned. If the class name cannot be found, null + *

A new List is returned. If the class name cannot be found, null * is stored in the List. If the class name in the List is * null, null is stored in the output List.

* @@ -348,8 +348,9 @@ public static List convertClassNamesToClasses(List classNames) { /** *

Given a List of Class objects, this method converts - * them into class names. - * A new List is returned. null objects will be copied into + * them into class names.

+ * + *

A new List is returned. null objects will be copied into * the returned list as null.

* * @param classes the classes to change diff --git a/src/java/org/apache/commons/lang/IllegalClassException.java b/src/java/org/apache/commons/lang/IllegalClassException.java index 72ea7b038..724febdb7 100644 --- a/src/java/org/apache/commons/lang/IllegalClassException.java +++ b/src/java/org/apache/commons/lang/IllegalClassException.java @@ -54,17 +54,17 @@ package org.apache.commons.lang; /** - * Thrown when an object is an instance of an unexpected type (a class or interface). + *

Thrown when an object is an instance of an unexpected type (a class or interface).

* * @author Matthew Hawthorne * @author Gary Gregory * @since 2.0 - * @version $Id: IllegalClassException.java,v 1.3 2003/06/03 20:49:59 ggregory Exp $ + * @version $Id: IllegalClassException.java,v 1.4 2003/07/14 22:25:02 bayard Exp $ */ public class IllegalClassException extends IllegalArgumentException { /** - * Instantiates with the specified types (classes or interfaces). + *

Instantiates with the specified types (classes or interfaces).

* * @param expected the expected type * @param actual the actual type @@ -78,7 +78,7 @@ public IllegalClassException(Class expected, Class actual) { } /** - * Instantiates with the specified message. + *

Instantiates with the specified message.

* * @param message the exception message */ @@ -87,7 +87,8 @@ public IllegalClassException(String message) { } /** - * Returns the class name or null if the class is null. + *

Returns the class name or null if the class is + * null.

* * @param cls a Class * @return the name of cls, or null if if cls is null. diff --git a/src/java/org/apache/commons/lang/IncompleteArgumentException.java b/src/java/org/apache/commons/lang/IncompleteArgumentException.java index 2f7740ce6..50c3f0f47 100644 --- a/src/java/org/apache/commons/lang/IncompleteArgumentException.java +++ b/src/java/org/apache/commons/lang/IncompleteArgumentException.java @@ -56,16 +56,16 @@ import java.util.Arrays; /** - * Thrown to indicate an incomplete argument to a method. + *

Thrown to indicate an incomplete argument to a method.

* * @author Matthew Hawthorne * @since 2.0 - * @version $Id: IncompleteArgumentException.java,v 1.2 2003/05/16 16:14:17 scolebourne Exp $ + * @version $Id: IncompleteArgumentException.java,v 1.3 2003/07/14 22:25:02 bayard Exp $ */ public class IncompleteArgumentException extends IllegalArgumentException { /** - * Instantiates with the specified description. + *

Instantiates with the specified description.

* * @param argName a description of the incomplete argument */ @@ -74,7 +74,7 @@ public IncompleteArgumentException(String argName) { } /** - * Instantiates with the specified description. + *

Instantiates with the specified description.

* * @param argName a description of the incomplete argument * @param items an array describing the arguments missing @@ -87,7 +87,7 @@ public IncompleteArgumentException(String argName, String[] items) { } /** - * Converts an array to a string without throwing an exception. + *

7Converts an array to a string without throwing an exception.

* * @param array an array * @return the array as a string diff --git a/src/java/org/apache/commons/lang/IntHashMap.java b/src/java/org/apache/commons/lang/IntHashMap.java index 7a22615b2..152f0c1fb 100644 --- a/src/java/org/apache/commons/lang/IntHashMap.java +++ b/src/java/org/apache/commons/lang/IntHashMap.java @@ -58,14 +58,15 @@ package org.apache.commons.lang; /** - * A hash map that uses primitive ints for the key rather than objects. - * Note that this class is for internal optimization purposes only, and may + *

A hash map that uses primitive ints for the key rather than objects.

+ * + *

Note that this class is for internal optimization purposes only, and may * not be supported in future releases of Jakarta Commons Lang. Utilities of - * this sort may be included in future releases of Jakarta Commons Collections. + * this sort may be included in future releases of Jakarta Commons Collections.

* * @author Justin Couch * @author Alex Chaffee (alex@apache.org) - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * @see java.util.HashMap */ public class IntHashMap @@ -96,8 +97,8 @@ public class IntHashMap private float loadFactor; /** - * Innerclass that acts as a datastructure to create a new entry in the - * table. + *

Innerclass that acts as a datastructure to create a new entry in the + * table.

*/ private static class Entry { @@ -107,7 +108,7 @@ private static class Entry Entry next; /** - * Create a new entry with the given values. + *

Create a new entry with the given values.

* * @param hash The code used to hash the object with * @param key The key used to enter this in the table @@ -124,8 +125,8 @@ protected Entry(int hash, int key, Object value, Entry next) } /** - * Constructs a new, empty hashtable with a default capacity and load - * factor, which is 20 and 0.75 respectively. + *

Constructs a new, empty hashtable with a default capacity and load + * factor, which is 20 and 0.75 respectively.

*/ public IntHashMap() { @@ -133,8 +134,8 @@ public IntHashMap() } /** - * Constructs a new, empty hashtable with the specified initial capacity - * and default load factor, which is 0.75. + *

Constructs a new, empty hashtable with the specified initial capacity + * and default load factor, which is 0.75.

* * @param initialCapacity the initial capacity of the hashtable. * @throws IllegalArgumentException if the initial capacity is less @@ -146,8 +147,8 @@ public IntHashMap(int initialCapacity) } /** - * Constructs a new, empty hashtable with the specified initial - * capacity and the specified load factor. + *

Constructs a new, empty hashtable with the specified initial + * capacity and the specified load factor.

* * @param initialCapacity the initial capacity of the hashtable. * @param loadFactor the load factor of the hashtable. @@ -171,7 +172,7 @@ public IntHashMap(int initialCapacity, float loadFactor) } /** - * Returns the number of keys in this hashtable. + *

Returns the number of keys in this hashtable.

* * @return the number of keys in this hashtable. */ @@ -181,7 +182,7 @@ public int size() } /** - * Tests if this hashtable maps no keys to values. + *

Tests if this hashtable maps no keys to values.

* * @return true if this hashtable maps no keys to values; * false otherwise. @@ -192,12 +193,12 @@ public boolean isEmpty() } /** - * Tests if some key maps into the specified value in this hashtable. + *

Tests if some key maps into the specified value in this hashtable. * This operation is more expensive than the containsKey - * method.

+ * method.

* - * Note that this method is identical in functionality to containsValue, - * (which is part of the Map interface in the collections framework). + *

Note that this method is identical in functionality to containsValue, + * (which is part of the Map interface in the collections framework).

* * @param value a value to search for. * @return true if and only if some key maps to the @@ -231,10 +232,11 @@ public boolean contains(Object value) } /** - * Returns true if this HashMap maps one or more keys to this value.

+ *

Returns true if this HashMap maps one or more keys + * to this value.

* - * Note that this method is identical in functionality to contains - * (which predates the Map interface). + *

Note that this method is identical in functionality to contains + * (which predates the Map interface).

* * @param value value whose presence in this HashMap is to be tested. * @see java.util.Map @@ -246,7 +248,7 @@ public boolean containsValue(Object value) } /** - * Tests if the specified object is a key in this hashtable. + *

Tests if the specified object is a key in this hashtable.

* * @param key possible key. * @return true if and only if the specified object is a @@ -270,7 +272,7 @@ public boolean containsKey(int key) } /** - * Returns the value to which the specified key is mapped in this map. + *

Returns the value to which the specified key is mapped in this map.

* * @param key a key in the hashtable. * @return the value to which the key is mapped in this hashtable; @@ -294,11 +296,13 @@ public Object get(int key) } /** - * Increases the capacity of and internally reorganizes this + *

Increases the capacity of and internally reorganizes this * hashtable, in order to accommodate and access its entries more - * efficiently. This method is called automatically when the - * number of keys in the hashtable exceeds this hashtable's capacity - * and load factor. + * efficiently.

+ * + *

This method is called automatically when the number of keys + * in the hashtable exceeds this hashtable's capacity and load + * factor.

*/ protected void rehash() { @@ -326,12 +330,12 @@ protected void rehash() } /** - * Maps the specified key to the specified + *

Maps the specified key to the specified * value in this hashtable. The key cannot be - * null.

+ * null.

* - * The value can be retrieved by calling the get method - * with a key that is equal to the original key. + *

The value can be retrieved by calling the get method + * with a key that is equal to the original key.

* * @param key the hashtable key. * @param value the value. @@ -373,8 +377,11 @@ public Object put(int key, Object value) } /** - * Removes the key (and its corresponding value) from this - * hashtable. This method does nothing if the key is not in the hashtable. + *

Removes the key (and its corresponding value) from this + * hashtable.

+ * + *

This method does nothing if the key is not present in the + * hashtable.

* * @param key the key that needs to be removed. * @return the value to which the key had been mapped in this hashtable, @@ -407,7 +414,7 @@ public Object remove(int key) } /** - * Clears this hashtable so that it contains no keys. + *

Clears this hashtable so that it contains no keys.

*/ public synchronized void clear() { diff --git a/src/java/org/apache/commons/lang/NotImplementedException.java b/src/java/org/apache/commons/lang/NotImplementedException.java index 11186b72c..387524278 100644 --- a/src/java/org/apache/commons/lang/NotImplementedException.java +++ b/src/java/org/apache/commons/lang/NotImplementedException.java @@ -54,16 +54,16 @@ package org.apache.commons.lang; /** - * Thrown to indicate that a method has not been implemented. + *

Thrown to indicate that a method has not been implemented.

* * @author Matthew Hawthorne * @since 2.0 - * @version $Id: NotImplementedException.java,v 1.2 2003/05/16 16:14:17 scolebourne Exp $ + * @version $Id: NotImplementedException.java,v 1.3 2003/07/14 22:25:02 bayard Exp $ */ public class NotImplementedException extends UnsupportedOperationException { /** - * Constructes the exception with the specified class. + *

Constructes the exception with the specified class.

* * @param clazz the Class that has not implemented the method */ @@ -74,7 +74,7 @@ public NotImplementedException(Class clazz) { } /** - * Constructs the exception with the specified message. + *

Constructs the exception with the specified message.

* * @param msg the exception message. */ diff --git a/src/java/org/apache/commons/lang/NullArgumentException.java b/src/java/org/apache/commons/lang/NullArgumentException.java index fe242e5eb..3b89a3212 100644 --- a/src/java/org/apache/commons/lang/NullArgumentException.java +++ b/src/java/org/apache/commons/lang/NullArgumentException.java @@ -54,18 +54,19 @@ package org.apache.commons.lang; /** - * Thrown to indicate that an argument was null and should not have been. + *

Thrown to indicate that an argument was null and should + * not have been.

* * @author Matthew Hawthorne * @since 2.0 - * @version $Id: NullArgumentException.java,v 1.2 2003/05/16 16:14:17 scolebourne Exp $ + * @version $Id: NullArgumentException.java,v 1.3 2003/07/14 22:25:02 bayard Exp $ */ public class NullArgumentException extends IllegalArgumentException { /** - * Instantiates with the given argument name. - * - * @param argName the name of the argument that was null. + *

Instantiates with the given argument name.

+ * + * @param argName the name of the argument that was null. */ public NullArgumentException(String argName) { super(argName + " cannot be null."); diff --git a/src/java/org/apache/commons/lang/NumberRange.java b/src/java/org/apache/commons/lang/NumberRange.java index 2406647e3..de479b7a3 100644 --- a/src/java/org/apache/commons/lang/NumberRange.java +++ b/src/java/org/apache/commons/lang/NumberRange.java @@ -63,7 +63,7 @@ * @author Christopher Elkins * @author Stephen Colebourne * @since 1.0 - * @version $Revision: 1.8 $ $Date: 2003/06/08 14:10:54 $ + * @version $Revision: 1.9 $ $Date: 2003/07/14 22:25:03 $ * * @deprecated Use one of the Range classes in org.apache.commons.lang.math. * Class will be removed in Commons Lang 3.0. @@ -79,8 +79,9 @@ public final class NumberRange { /** - *

Constructs a new NumberRange using the specified - * number as both the minimum and maximum in this range.

+ *

Constructs a new NumberRange using + * number as both the minimum and maximum in + * this range.

* * @param num the number to use for this range * @throws NullPointerException if the number is null @@ -98,8 +99,8 @@ public NumberRange(Number num) { *

Constructs a new NumberRange with the specified * minimum and maximum numbers.

* - *

If the maximum is less than the minimum, the range will be constructed - * from the minimum value to the minimum value, not what you would expect!.

+ *

If the maximum is less than the minimum, the range will be constructed + * from the minimum value to the minimum value, not what you would expect!.

* * @param min the minimum number in this range * @param max the maximum number in this range @@ -190,8 +191,8 @@ public boolean overlaps(NumberRange range) { } /** - *

Indicates whether some other Object is "equal" to - * this one.

+ *

Indicates whether some other Object is + * "equal" to this one.

* * @param obj the reference object with which to compare * @return true if this object is the same as the obj diff --git a/src/java/org/apache/commons/lang/ObjectUtils.java b/src/java/org/apache/commons/lang/ObjectUtils.java index e5bb5ded4..c20e1206e 100644 --- a/src/java/org/apache/commons/lang/ObjectUtils.java +++ b/src/java/org/apache/commons/lang/ObjectUtils.java @@ -62,7 +62,7 @@ * @author Daniel Rall * @author Stephen Colebourne * @since 1.0 - * @version $Id: ObjectUtils.java,v 1.8 2003/02/22 20:19:16 scolebourne Exp $ + * @version $Id: ObjectUtils.java,v 1.9 2003/07/14 22:25:03 bayard Exp $ */ public class ObjectUtils { @@ -149,7 +149,8 @@ public static String identityToString(Object object) { } /** - *

Class used as a null placeholder where null has another meaning.

+ *

Class used as a null placeholder where null + * has another meaning.

* *

For example, in a HashMap the * {@link java.util.HashMap#get(java.lang.Object)} method returns @@ -166,7 +167,7 @@ public static class Null implements Serializable { private static final long serialVersionUID = 7092611880189329093L; /** - * Restricted constructor - singleton + * Restricted constructor - singleton. */ Null() { } diff --git a/src/java/org/apache/commons/lang/builder/CompareToBuilder.java b/src/java/org/apache/commons/lang/builder/CompareToBuilder.java index 5a2d7656d..9ecfe0534 100644 --- a/src/java/org/apache/commons/lang/builder/CompareToBuilder.java +++ b/src/java/org/apache/commons/lang/builder/CompareToBuilder.java @@ -68,7 +68,7 @@ * {@link HashCodeBuilder}.

* *

Two object that compare equal using equals should normally compare - * equals using compareTo

. + * equals using compareTo

. * *

All relevant fields should be included in the calculation of the * comparison. Derived fields may be ignored. The same fields, in the same @@ -76,6 +76,7 @@ * equals.

* *

Typical use for the code is as follows:

+ * *
  *  public int compareTo(Object o) {
  *    MyClass rhs = (MyClass) o;
@@ -106,7 +107,7 @@
  * @author Stephen Colebourne
  * @author Gary Gregory
  * @since 1.0
- * @version $Id: CompareToBuilder.java,v 1.15 2003/06/24 21:14:50 scolebourne Exp $
+ * @version $Id: CompareToBuilder.java,v 1.16 2003/07/14 22:25:03 bayard Exp $
  */
 public class CompareToBuilder {
     
@@ -234,8 +235,8 @@ public static int reflectionCompare(Object lhs, Object rhs, boolean testTransien
     }
 
     /**
-     * Appends the fields and values defined by the given object of the
-     * given Class.
+     * 

Appends the fields and values defined by the given object of the + * given Class.

* * @param lhs the left hand object * @param rhs the right hand object @@ -287,14 +288,15 @@ public CompareToBuilder appendSuper(int superHashCode) { /** *

Comparison of two Object references.

+ * *
    - *
  1. Check if Objects are same using == - *
  2. Check if either is null, a null object is less than a non-null - *
  3. Check the object contents + *
  4. Check if Objects are same using ==
  5. + *
  6. Check if either is null, a null object is less than a non-null
  7. + *
  8. Check the object contents
  9. *
* *

The first parameter to be compared must either be an array or implement - * Comparable.

+ * Comparable.

* * @param lhs the Object from this object * @param rhs the Object from the other object @@ -309,14 +311,14 @@ public CompareToBuilder append(Object lhs, Object rhs) { /** *

Comparison of two Object references.

*
    - *
  1. Check if Objects are same using == - *
  2. Check if either is null, a null object is less than a non-null - *
  3. Check the object contents + *
  4. Check if Objects are same using ==
  5. + *
  6. Check if either is null, a null object is less than a non-null
  7. + *
  8. Check the object contents
  9. *
* *

If the first parameter to be compared is an array, the array methods will * be used. Otherwise the comparator will be used. If the comparator is null, - * the lhs will be cast to Comparable.

+ * the lhs will be cast to Comparable.

* * @param lhs the Object from this object * @param rhs the Object from the other object @@ -379,7 +381,7 @@ public CompareToBuilder append(Object lhs, Object rhs, Comparator comparator) { } /** - *

Test if two longs are <, > or ==.

+ *

Test if two longs are <, > or ==.

* * @param lhs the long from this object * @param rhs the long from the other object @@ -394,7 +396,7 @@ public CompareToBuilder append(long lhs, long rhs) { } /** - *

Test if two ints are <, > or ==.

+ *

Test if two ints are <, > or ==.

* * @param lhs the int from this object * @param rhs the int from the other object @@ -409,7 +411,7 @@ public CompareToBuilder append(int lhs, int rhs) { } /** - *

Test if two shorts are <, > or ==.

+ *

Test if two shorts are <, > or ==.

* * @param lhs the short from this object * @param rhs the short from the other object @@ -424,7 +426,7 @@ public CompareToBuilder append(short lhs, short rhs) { } /** - *

Test if two chars are <, > or ==.

+ *

Test if two chars are <, > or ==.

* * @param lhs the char from this object * @param rhs the char from the other object @@ -439,7 +441,7 @@ public CompareToBuilder append(char lhs, char rhs) { } /** - *

Test if two bytes are <, > or ==.

+ *

Test if two bytes are <, > or ==.

* * @param lhs the byte from this object * @param rhs the byte from the other object @@ -454,7 +456,7 @@ public CompareToBuilder append(byte lhs, byte rhs) { } /** - *

Test if two doubles are <, > or ==.

+ *

Test if two doubles are <, > or ==.

* *

This handles NaNs, Infinties, and -0.0.

* @@ -474,7 +476,7 @@ public CompareToBuilder append(double lhs, double rhs) { } /** - *

Test if two floats are <, > or ==.

+ *

Test if two floats are <, > or ==.

* *

This handles NaNs, Infinties, and -0.0.

* @@ -494,7 +496,7 @@ public CompareToBuilder append(float lhs, float rhs) { } /** - *

Test if two booleanss are <, > or ==.

+ *

Test if two booleanss are <, > or ==.

* * @param lhs the boolean from this object * @param rhs the boolean from the other object @@ -517,11 +519,12 @@ public CompareToBuilder append(boolean lhs, boolean rhs) { /** *

Deep comparison of an Object array.

+ * *
    - *
  1. Check if arrays are same using == - *
  2. Check if either is null, a null array is less than a non-null - *
  3. Check array length, a short length array is less than a long length array - *
  4. Check array contents element by element using {@link #append(long, long)} + *
  5. Check if arrays are same using ==
  6. + *
  7. Check if either is null, a null array is less than a non-null
  8. + *
  9. Check array length, a short length array is less than a long length array
  10. + *
  11. Check array contents element by element using {@link #append(long, long)}
  12. *
* *

This method will also will be called for the top level of multi-dimensional, @@ -539,11 +542,12 @@ public CompareToBuilder append(Object[] lhs, Object[] rhs) { /** *

Deep comparison of an Object array.

+ * *
    - *
  1. Check if arrays are same using == - *
  2. Check if either is null, a null array is less than a non-null - *
  3. Check array length, a shorter length array is less than a longer length array - *
  4. Check array contents element by element using {@link #append(Object, Object, Comparator)} + *
  5. Check if arrays are same using ==
  6. + *
  7. Check if either is null, a null array is less than a non-null
  8. + *
  9. Check array length, a shorter length array is less than a longer length array
  10. + *
  11. Check array contents element by element using {@link #append(Object, Object, Comparator)}
  12. *
* *

This method will also will be called for the top level of multi-dimensional, @@ -584,11 +588,12 @@ public CompareToBuilder append(Object[] lhs, Object[] rhs, Comparator comparator /** *

Deep comparison of a long array.

+ * *
    - *
  1. Check if arrays are same using == - *
  2. Check if either is null, a null array is less than a non-null - *
  3. Check array length, a shorter length array is less than a longer length array - *
  4. Check array contents element by element using {@link #append(long, long)} + *
  5. Check if arrays are same using ==
  6. + *
  7. Check if either is null, a null array is less than a non-null
  8. + *
  9. Check array length, a shorter length array is less than a longer length array
  10. + *
  11. Check array contents element by element using {@link #append(long, long)}
  12. *
* * @param lhs array from this object @@ -622,11 +627,12 @@ public CompareToBuilder append(long[] lhs, long[] rhs) { /** *

Deep comparison of an int array.

+ * *
    - *
  1. Check if arrays are same using == - *
  2. Check if either is null, a null array is less than a non-null - *
  3. Check array length, a shorter length array is less than a longer length array - *
  4. Check array contents element by element using {@link #append(int, int)} + *
  5. Check if arrays are same using ==
  6. + *
  7. Check if either is null, a null array is less than a non-null
  8. + *
  9. Check array length, a shorter length array is less than a longer length array
  10. + *
  11. Check array contents element by element using {@link #append(int, int)}
  12. *
* * @param lhs array from this object @@ -660,11 +666,12 @@ public CompareToBuilder append(int[] lhs, int[] rhs) { /** *

Deep comparison of a short array.

+ * *
    - *
  1. Check if arrays are same using == - *
  2. Check if either is null, a null array is less than a non-null - *
  3. Check array length, a shorter length array is less than a longer length array - *
  4. Check array contents element by element using {@link #append(short, short)} + *
  5. Check if arrays are same using ==
  6. + *
  7. Check if either is null, a null array is less than a non-null
  8. + *
  9. Check array length, a shorter length array is less than a longer length array
  10. + *
  11. Check array contents element by element using {@link #append(short, short)}
  12. *
* * @param lhs array from this object @@ -698,11 +705,12 @@ public CompareToBuilder append(short[] lhs, short[] rhs) { /** *

Deep comparison of a char array.

+ * *
    - *
  1. Check if arrays are same using == - *
  2. Check if either is null, a null array is less than a non-null - *
  3. Check array length, a shorter length array is less than a longer length array - *
  4. Check array contents element by element using {@link #append(char, char)} + *
  5. Check if arrays are same using ==
  6. + *
  7. Check if either is null, a null array is less than a non-null
  8. + *
  9. Check array length, a shorter length array is less than a longer length array
  10. + *
  11. Check array contents element by element using {@link #append(char, char)}
  12. *
* * @param lhs array from this object @@ -736,11 +744,12 @@ public CompareToBuilder append(char[] lhs, char[] rhs) { /** *

Deep comparison of a byte array.

+ * *
    - *
  1. Check if arrays are same using == - *
  2. Check if either is null, a null array is less than a non-null - *
  3. Check array length, a shorter length array is less than a longer length array - *
  4. Check array contents element by element using {@link #append(byte, byte)} + *
  5. Check if arrays are same using ==
  6. + *
  7. Check if either is null, a null array is less than a non-null
  8. + *
  9. Check array length, a shorter length array is less than a longer length array
  10. + *
  11. Check array contents element by element using {@link #append(byte, byte)}
  12. *
* * @param lhs array from this object @@ -774,11 +783,12 @@ public CompareToBuilder append(byte[] lhs, byte[] rhs) { /** *

Deep comparison of a double array.

+ * *
    - *
  1. Check if arrays are same using == - *
  2. Check if either is null, a null array is less than a non-null - *
  3. Check array length, a shorter length array is less than a longer length array - *
  4. Check array contents element by element using {@link #append(double, double)} + *
  5. Check if arrays are same using ==
  6. + *
  7. Check if either is null, a null array is less than a non-null
  8. + *
  9. Check array length, a shorter length array is less than a longer length array
  10. + *
  11. Check array contents element by element using {@link #append(double, double)}
  12. *
* * @param lhs array from this object @@ -812,11 +822,12 @@ public CompareToBuilder append(double[] lhs, double[] rhs) { /** *

Deep comparison of a float array.

+ * *
    - *
  1. Check if arrays are same using == - *
  2. Check if either is null, a null array is less than a non-null - *
  3. Check array length, a shorter length array is less than a longer length array - *
  4. Check array contents element by element using {@link #append(float, float)} + *
  5. Check if arrays are same using ==
  6. + *
  7. Check if either is null, a null array is less than a non-null
  8. + *
  9. Check array length, a shorter length array is less than a longer length array
  10. + *
  11. Check array contents element by element using {@link #append(float, float)} *
* * @param lhs array from this object @@ -850,11 +861,12 @@ public CompareToBuilder append(float[] lhs, float[] rhs) { /** *

Deep comparison of a boolean/code> array.

+ * *
    - *
  1. Check if arrays are same using == - *
  2. Check if either is null, a null array is less than a non-null - *
  3. Check array length, a shorter length array is less than a longer length array - *
  4. Check array contents element by element using {@link #append(boolean, boolean)} + *
  5. Check if arrays are same using ==
  6. + *
  7. Check if either is null, a null array is less than a non-null
  8. + *
  9. Check array length, a shorter length array is less than a longer length array
  10. + *
  11. Check array contents element by element using {@link #append(boolean, boolean)}
  12. *
* * @param lhs array from this object @@ -887,9 +899,9 @@ public CompareToBuilder append(boolean[] lhs, boolean[] rhs) { } /** - *

Return a negative integer if the Object is less than, a positive - * integer if the Object is greater than, or 0 if the - * Object is equal. + *

Return a negative integer if the Object is less + * than, a positive integer if the Object is greater than, + * or 0 if the Object is equal.

* * @return int - a negative integer, zero, or a positive integer as this * Object is less than, equal to, or greater than the specified Object. diff --git a/src/java/org/apache/commons/lang/builder/EqualsBuilder.java b/src/java/org/apache/commons/lang/builder/EqualsBuilder.java index 657b1c827..76be3656a 100644 --- a/src/java/org/apache/commons/lang/builder/EqualsBuilder.java +++ b/src/java/org/apache/commons/lang/builder/EqualsBuilder.java @@ -108,7 +108,7 @@ * @author Stephen Colebourne * @author Gary Gregory * @since 1.0 - * @version $Id: EqualsBuilder.java,v 1.13 2003/04/18 09:12:16 ggregory Exp $ + * @version $Id: EqualsBuilder.java,v 1.14 2003/07/14 22:25:03 bayard Exp $ */ public class EqualsBuilder { /** @@ -130,7 +130,8 @@ public EqualsBuilder() { //------------------------------------------------------------------------- /** - *

This method uses reflection to determine if the two Object are equal.

+ *

This method uses reflection to determine if the two Objects + * are equal.

* *

It uses Field.setAccessible to gain access to private * fields. This means that it will throw a security exception if run under @@ -151,7 +152,8 @@ public static boolean reflectionEquals(Object lhs, Object rhs) { } /** - *

This method uses reflection to determine if the two Object are equal.

+ *

This method uses reflection to determine if the two Objects + * are equal.

* *

It uses Field.setAccessible to gain access to private * fields. This means that it will throw a security exception if run under @@ -160,7 +162,7 @@ public static boolean reflectionEquals(Object lhs, Object rhs) { * *

If the TestTransients parameter is set to true, transient * members will be tested, otherwise they are ignored, as they are likely - * derived fields, and not part of the value of the Object.

+ * derived fields, and not part of the value of the Object.

* *

Static fields will not be tested. Superclass fields will be included.

* @@ -174,7 +176,8 @@ public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTrans } /** - *

This method uses reflection to determine if the two Object are equal.

+ *

This method uses reflection to determine if the two Objects + * are equal.

* *

It uses Field.setAccessible to gain access to private * fields. This means that it will throw a security exception if run under @@ -183,7 +186,7 @@ public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTrans * *

If the testTransients parameter is set to true, transient * members will be tested, otherwise they are ignored, as they are likely - * derived fields, and not part of the value of the Object.

+ * derived fields, and not part of the value of the Object.

* *

Static fields will not be included. Superclass fields will be appended * up to and including the specified superclass. A null superclass is treated @@ -192,7 +195,8 @@ public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTrans * @param lhs this object * @param rhs the other object * @param testTransients whether to include transient fields - * @param reflectUpToClass the superclass to reflect up to (inclusive), may be null + * @param reflectUpToClass the superclass to reflect up to (inclusive), + * may be null * @return true if the two Objects have tested equals. */ public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients, Class reflectUpToClass) { @@ -244,8 +248,8 @@ public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTrans } /** - * Appends the fields and values defined by the given object of the - * given Class. + *

Appends the fields and values defined by the given object of the + * given Class.

* * @param lhs the left hand object * @param rhs the right hand object @@ -280,7 +284,7 @@ private static void reflectionAppend( //------------------------------------------------------------------------- /** - *

Adds the result of super.equals() to this builder.

+ *

Adds the result of super.equals() to this builder.

* * @param superEquals the result of calling super.equals() * @return EqualsBuilder - used to chain calls. @@ -476,7 +480,7 @@ public EqualsBuilder append(boolean lhs, boolean rhs) { } /** - *

Performs a deep comparison of two Object arrays.

+ *

Performs a deep comparison of two Object arrays.

* *

This also will be called for the top level of * multi-dimensional, ragged, and multi-typed arrays.

@@ -512,8 +516,8 @@ public EqualsBuilder append(Object[] lhs, Object[] rhs) { } /** - *

Deep comparison of array of long Length and all values - * are compared.

+ *

Deep comparison of array of long. Length and all + * values are compared.

* *

The method {@link #append(long, long)} is used.

* @@ -543,8 +547,8 @@ public EqualsBuilder append(long[] lhs, long[] rhs) { } /** - *

Deep comparison of array of int Length and all values - * are compared.

+ *

Deep comparison of array of int. Length and all + * values are compared.

* *

The method {@link #append(int, int)} is used.

* @@ -574,8 +578,8 @@ public EqualsBuilder append(int[] lhs, int[] rhs) { } /** - *

Deep comparison of array of short Length and all values - * are compared.

+ *

Deep comparison of array of short. Length and all + * values are compared.

* *

The method {@link #append(short, short)} is used.

* @@ -605,8 +609,8 @@ public EqualsBuilder append(short[] lhs, short[] rhs) { } /** - *

Deep comparison of array of char Length and all values - * are compared.

+ *

Deep comparison of array of char. Length and all + * values are compared.

* *

The method {@link #append(char, char)} is used.

* @@ -636,8 +640,8 @@ public EqualsBuilder append(char[] lhs, char[] rhs) { } /** - *

Deep comparison of array of byte Length and all values - * are compared.

+ *

Deep comparison of array of byte. Length and all + * values are compared.

* *

The method {@link #append(byte, byte)} is used.

* @@ -667,8 +671,8 @@ public EqualsBuilder append(byte[] lhs, byte[] rhs) { } /** - *

Deep comparison of array of double Length and all values - * are compared.

+ *

Deep comparison of array of double. Length and all + * values are compared.

* *

The method {@link #append(double, double)} is used.

* @@ -698,8 +702,8 @@ public EqualsBuilder append(double[] lhs, double[] rhs) { } /** - *

Deep comparison of array of float Length and all values - * are compared.

+ *

Deep comparison of array of float. Length and all + * values are compared.

* *

The method {@link #append(float, float)} is used.

* @@ -729,8 +733,8 @@ public EqualsBuilder append(float[] lhs, float[] rhs) { } /** - *

Deep comparison of array of boolean Length and all values - * are compared.

+ *

Deep comparison of array of boolean. Length and all + * values are compared.

* *

The method {@link #append(boolean, boolean)} is used.

* diff --git a/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java b/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java index 528935c98..461d7e11d 100644 --- a/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java +++ b/src/java/org/apache/commons/lang/builder/HashCodeBuilder.java @@ -64,7 +64,7 @@ * , by Joshua Bloch. Writing a good hashCode is actually quite * difficult. This class aims to simplify the process.

* - *

All relevant fields from the object should be included in the + *

All relevant fields from the object should be included in the * hashCode. Derived fields may be excluded. In general, any * field used in the equals method must be used in the hashCode * method.

@@ -108,16 +108,16 @@ * @author Stephen Colebourne * @author Gary Gregory * @since 1.0 - * @version $Id: HashCodeBuilder.java,v 1.12 2003/04/18 09:12:16 ggregory Exp $ + * @version $Id: HashCodeBuilder.java,v 1.13 2003/07/14 22:25:03 bayard Exp $ */ public class HashCodeBuilder { /** - * Constant to use in building the hashCode + * Constant to use in building the hashCode. */ private final int iConstant; /** - * Running total of the hashCode + * Running total of the hashCode. */ private int iTotal = 0; @@ -178,7 +178,7 @@ public HashCodeBuilder(int initialNonZeroOddNumber, int multiplierNonZeroOddNumb * also not as efficient as testing explicitly.

* *

Transient members will be not be used, as they are likely derived - * fields, and not part of the value of the Object.

+ * fields, and not part of the value of the Object.

* *

Static fields will not be tested. Superclass fields will be included.

* @@ -203,7 +203,7 @@ public static int reflectionHashCode(Object object) { * *

If the TestTransients parameter is set to true, transient * members will be tested, otherwise they are ignored, as they are likely - * derived fields, and not part of the value of the Object.

+ * derived fields, and not part of the value of the Object.

* *

Static fields will not be tested. Superclass fields will be included.

* @@ -225,7 +225,7 @@ public static int reflectionHashCode(Object object, boolean testTransients) { * also not as efficient as testing explicitly.

* *

Transient members will be not be used, as they are likely derived - * fields, and not part of the value of the Object.

+ * fields, and not part of the value of the Object.

* *

Static fields will not be tested. Superclass fields will be included.

* @@ -255,7 +255,7 @@ public static int reflectionHashCode( * *

If the TestTransients parameter is set to true, transient * members will be tested, otherwise they are ignored, as they are likely - * derived fields, and not part of the value of the Object.

+ * derived fields, and not part of the value of the Object.

* *

Static fields will not be tested. Superclass fields will be included.

* @@ -287,7 +287,7 @@ public static int reflectionHashCode( * *

If the TestTransients parameter is set to true, transient * members will be tested, otherwise they are ignored, as they are likely - * derived fields, and not part of the value of the Object.

+ * derived fields, and not part of the value of the Object.

* *

Static fields will not be included. Superclass fields will be included * up to and including the specified superclass. A null superclass is treated @@ -301,7 +301,8 @@ public static int reflectionHashCode( * @param multiplierNonZeroOddNumber a non-zero, odd number used as the multiplier * @param object the Object to create a hashCode for * @param testTransients whether to include transient fields - * @param reflectUpToClass the superclass to reflect up to (inclusive), may be null + * @param reflectUpToClass the superclass to reflect up to (inclusive), + * may be null * @return int hash code * @throws IllegalArgumentException if the Object is null * @throws IllegalArgumentException if the number is zero or even @@ -327,8 +328,8 @@ public static int reflectionHashCode( } /** - * Appends the fields and values defined by the given object of the - * given Class. + *

Appends the fields and values defined by the given object of the + * given Class.

* * @param object the object to append details of * @param clazz the class to append details of diff --git a/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java b/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java index 814fb789c..ff85542a2 100644 --- a/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java +++ b/src/java/org/apache/commons/lang/builder/ReflectionToStringBuilder.java @@ -30,8 +30,8 @@ * *

A subclass can control field output by overriding the methods: *

    - *
  • {@link #accept(java.lang.reflect.Field)}
  • - *
  • {@link #getValue(java.lang.reflect.Field)}
  • + *
  • {@link #accept(java.lang.reflect.Field)}
  • + *
  • {@link #getValue(java.lang.reflect.Field)}
  • *
*

* @@ -41,13 +41,13 @@ * @author Gary Gregory * @author Stephen Colebourne * @since 2.0 - * @version $Id: ReflectionToStringBuilder.java,v 1.1 2003/06/03 03:51:56 ggregory Exp $ + * @version $Id: ReflectionToStringBuilder.java,v 1.2 2003/07/14 22:25:03 bayard Exp $ */ public class ReflectionToStringBuilder extends ToStringBuilder { /** - * A registry of objects used by reflectionToString methods to detect cyclical object references - * and avoid infinite loops. + * A registry of objects used by reflectionToString methods to detect + * cyclical object references and avoid infinite loops. */ private static ThreadLocal registry = new ThreadLocal() { protected synchronized Object initialValue() { @@ -58,8 +58,9 @@ protected synchronized Object initialValue() { }; /** - * Returns the registry of objects being traversed by the - * reflectionToString methods in the current thread. + *

Returns the registry of objects being traversed by the + * reflectionToString methods in the current thread.

+ * * @return Set the registry of objects being traversed */ static Set getRegistry() { @@ -67,8 +68,8 @@ static Set getRegistry() { } /** - * Returns true if the registry contains the given object. - * Used by the reflection methods to avoid infinite loops. + *

Returns true if the registry contains the given object. + * Used by the reflection methods to avoid infinite loops.

* * @param value The object to lookup in the registry. * @return boolean true if the registry contains the given object. @@ -149,8 +150,7 @@ public static String toString(Object object, ToStringStyle style) { * *

Static fields will not be included. Superclass fields will be appended.

* - *

- * If the style is null, the default + *

If the style is null, the default * ToStringStyle is used.

* * @param object the Object to be output @@ -202,8 +202,9 @@ public static String toString( } /** - * Unregisters the given object. - * Used by the reflection methods to avoid infinite loops. + *

Unregisters the given object.

+ * + *

Used by the reflection methods to avoid infinite loops.

* * @param value The object to unregister. */ @@ -296,9 +297,9 @@ public ReflectionToStringBuilder( /** * Returns whether or not to append the given Field. *
    - *
  • Static fields are not appended.
  • - *
  • Transient fields are appended only if {@link #isAppendTransients()} returns true. - *
  • Inner class fields are not appened.
  • + *
  • Static fields are not appended.
  • + *
  • Transient fields are appended only if {@link #isAppendTransients()} returns true. + *
  • Inner class fields are not appened.
  • *
* @param field The Field to test. * @return Whether or not to append the given Field. @@ -311,10 +312,12 @@ protected boolean accept(Field field) { } /** - * Appends the fields and values defined by the given object of the - * given Class. If a cycle is detected as an objects is "toString()'ed", + *

Appends the fields and values defined by the given object of the + * given Class.

+ * + *

If a cycle is detected as an objects is "toString()'ed", * such an object is rendered as if Object.toString() - * had been called and not implemented by the object. + * had been called and not implemented by the object.

* * @param clazz The class of object parameter */ @@ -370,7 +373,7 @@ protected void appendFieldsIn(Class clazz) { } /** - * Gets the last super class to stop appending fields for. + *

Gets the last super class to stop appending fields for.

* * @return The last super class to stop appending fields for. */ @@ -379,7 +382,8 @@ public Class getUpToClass() { } /** - * Calls java.lang.reflect.Field.get(Object) + *

Calls java.lang.reflect.Field.get(Object)

+ * * @see java.lang.reflect.Field#get(Object) * @throws IllegalArgumentException * @throws IllegalAccessException @@ -389,7 +393,7 @@ protected Object getValue(Field field) throws IllegalArgumentException, IllegalA } /** - * Returns whether or not to append transient fields. + *

Returns whether or not to append transient fields.

* * @return Whether or not to append transient fields. */ @@ -410,14 +414,15 @@ public ToStringBuilder reflectionAppendArray(Object array) { } /** - * Registers this builder's source object to avoid infinite loops processing circular object references. + *

Registers this builder's source object to avoid infinite + * loops processing circular object references.

*/ void registerObject() { register(this.getObject()); } /** - * Sets whether or not to append transient fields. + *

Sets whether or not to append transient fields.

* * @param appendTransients Whether or not to append transient fields. */ @@ -426,7 +431,7 @@ public void setAppendTransients(boolean appendTransients) { } /** - * Sets the last super class to stop appending fields for. + *

Sets the last super class to stop appending fields for.

* * @param clazz The last super class to stop appending fields for. */ @@ -448,7 +453,8 @@ public String toString() { } /** - * Unegisters this builder's source object to avoid infinite loops processing circular object references. + *

Unegisters this builder's source object to avoid infinite + * loops processing circular object references.

*/ void unregisterObject() { unregister(this.getObject()); diff --git a/src/java/org/apache/commons/lang/builder/StandardToStringStyle.java b/src/java/org/apache/commons/lang/builder/StandardToStringStyle.java index db4332b68..5ea411c02 100644 --- a/src/java/org/apache/commons/lang/builder/StandardToStringStyle.java +++ b/src/java/org/apache/commons/lang/builder/StandardToStringStyle.java @@ -65,7 +65,7 @@ * * @author Stephen Colebourne * @since 1.0 - * @version $Id: StandardToStringStyle.java,v 1.8 2003/03/23 17:54:16 scolebourne Exp $ + * @version $Id: StandardToStringStyle.java,v 1.9 2003/07/14 22:25:03 bayard Exp $ */ public class StandardToStringStyle extends ToStringStyle { @@ -419,7 +419,7 @@ public String getNullText() { *

Null is accepted, but will be converted * to a empty String.

* - * @param nullText the new text to output when null found + * @param nullText the new text to output when null found */ public void setNullText(String nullText) { super.setNullText(nullText); diff --git a/src/java/org/apache/commons/lang/builder/ToStringBuilder.java b/src/java/org/apache/commons/lang/builder/ToStringBuilder.java index 2d9a23bb6..a944cc91c 100644 --- a/src/java/org/apache/commons/lang/builder/ToStringBuilder.java +++ b/src/java/org/apache/commons/lang/builder/ToStringBuilder.java @@ -61,15 +61,16 @@ *

This class enables a good and consistent toString() to be built for any * class or object. This class aims to simplify the process by:

*
    - *
  • allowing field names - *
  • handling all types consistently - *
  • handling nulls consistently - *
  • outputting arrays and multi-dimensional arrays - *
  • enabling the detail level to be controlled for Objects and Collections - *
  • handling class hierarchies + *
  • allowing field names
  • + *
  • handling all types consistently
  • + *
  • handling nulls consistently
  • + *
  • outputting arrays and multi-dimensional arrays
  • + *
  • enabling the detail level to be controlled for Objects and Collections
  • + *
  • handling class hierarchies
  • *
* - *

To use this class write code as follows: + *

To use this class write code as follows:

+ * *
  * public class Person {
  *   String name;
@@ -87,6 +88,7 @@
  *   }
  * }
  * 
+ * *

This will produce a toString of the format: * Person@7f54[name=Stephen,age=29,smoker=false]

* @@ -102,6 +104,7 @@ * slower than testing explicitly.

* *

A typical invocation for this method would look like:

+ * *
  * public String toString() {
  *   return ToStringBuilder.reflectionToString(this);
@@ -109,6 +112,7 @@
  * 
* *

You can also use the builder to debug 3rd party objects:

+ * *
  * System.out.println("An object: " + ToStringBuilder.reflectionToString(anObject));
  * 
@@ -119,12 +123,12 @@ * @author Stephen Colebourne * @author Gary Gregory * @since 1.0 - * @version $Id: ToStringBuilder.java,v 1.23 2003/06/23 17:04:39 ggregory Exp $ + * @version $Id: ToStringBuilder.java,v 1.24 2003/07/14 22:25:03 bayard Exp $ */ public class ToStringBuilder { /** - * The default style of output to use + * The default style of output to use. */ private static ToStringStyle defaultStyle = ToStringStyle.DEFAULT_STYLE; @@ -147,7 +151,7 @@ public static ToStringStyle getDefaultStyle() { } /** - * Forwards to ReflectionToStringBuilder. + *

Forwards to ReflectionToStringBuilder.

* * @see ReflectionToStringBuilder#toString(Object) */ @@ -156,7 +160,7 @@ public static String reflectionToString(Object object) { } /** - * Forwards to ReflectionToStringBuilder. + *

Forwards to ReflectionToStringBuilder.

* * @see ReflectionToStringBuilder#toString(Object,ToStringStyle) */ @@ -165,7 +169,7 @@ public static String reflectionToString(Object object, ToStringStyle style) { } /** - * Forwards to ReflectionToStringBuilder. + *

Forwards to ReflectionToStringBuilder.

* * @see ReflectionToStringBuilder#toString(Object,ToStringStyle,boolean) */ @@ -174,7 +178,7 @@ public static String reflectionToString(Object object, ToStringStyle style, bool } /** - * Forwards to ReflectionToStringBuilder. + *

Forwards to ReflectionToStringBuilder.

* * @see ReflectionToStringBuilder#toString(Object,ToStringStyle,boolean,Class) */ @@ -997,8 +1001,8 @@ public ToStringBuilder appendSuper(String superToString) { *

Append the toString from another object.

* *

This method is useful where a class delegates most of the implementation of - * it's properties to another class. You can then call toString() on the other - * class and pass the result into this method.

+ * it's properties to another class. You can then call toString() on + * the other class and pass the result into this method.

* *
      *   private AnotherObject delegate;
@@ -1014,7 +1018,7 @@ public ToStringBuilder appendSuper(String superToString) {
      * 

This method asumes that the other object uses the same ToStringStyle * as this one.

* - *

If the toString is null, no change is made.

+ *

If the toString is null, no change is made.

* * @param toString the result of toString() on another object * @return this @@ -1060,7 +1064,7 @@ public String toString() { } /** - * Returns the object being output. + *

Returns the Object being output.

* * @return The object being output. */ diff --git a/src/java/org/apache/commons/lang/builder/ToStringStyle.java b/src/java/org/apache/commons/lang/builder/ToStringStyle.java index db558765d..ac2061a3c 100644 --- a/src/java/org/apache/commons/lang/builder/ToStringStyle.java +++ b/src/java/org/apache/commons/lang/builder/ToStringStyle.java @@ -83,7 +83,7 @@ * @author Stephen Colebourne * @author Gary Gregory * @since 1.0 - * @version $Id: ToStringStyle.java,v 1.14 2003/06/03 03:51:56 ggregory Exp $ + * @version $Id: ToStringStyle.java,v 1.15 2003/07/14 22:25:04 bayard Exp $ */ public abstract class ToStringStyle implements Serializable { @@ -175,15 +175,15 @@ public abstract class ToStringStyle implements Serializable { */ private String sizeStartText = "'>'
. + * The summary size text start '>'. */ private String sizeEndText = ">"; /** - * The summary object text start '<'. + * The summary object text start '<'. */ private String summaryObjectStartText = "<"; /** - * The summary object text start '>'. + * The summary object text start '>'. */ private String summaryObjectEndText = ">"; @@ -201,7 +201,7 @@ protected ToStringStyle() { /** *

Append the superclass toString.

* - *

A null super.toString() is ignored.

+ *

A null super.toString() is ignored.

* * @param buffer the StringBuffer to populate * @param superToString the super.toString() @@ -213,7 +213,7 @@ public void appendSuper(StringBuffer buffer, String superToString) { /** *

Append a toString.

* - *

A null toString() is ignored.

+ *

A null toString() is ignored.

* * @param buffer the StringBuffer to populate * @param toString the super.toString() @@ -321,7 +321,8 @@ public void append(StringBuffer buffer, String fieldName, Object value, Boolean * *

Either detail or summary views can be specified.

* - *

If a cycle is detected, an object will be appended with the Object.toString() format.

+ *

If a cycle is detected, an object will be appended with the + * Object.toString() format.

* * @param buffer the StringBuffer to populate * @param fieldName the field name, typically not used as already appended @@ -459,7 +460,7 @@ protected void appendDetail(StringBuffer buffer, String fieldName, Map map) { /** *

Append to the toString an Object - * value, printing a summary of the Object.

+ * value, printing a summary of the Object.

* * @param buffer the StringBuffer to populate * @param fieldName the field name, typically not used as already appended diff --git a/src/java/org/apache/commons/lang/enum/EnumUtils.java b/src/java/org/apache/commons/lang/enum/EnumUtils.java index a61439042..c974a4ef1 100644 --- a/src/java/org/apache/commons/lang/enum/EnumUtils.java +++ b/src/java/org/apache/commons/lang/enum/EnumUtils.java @@ -58,85 +58,98 @@ import java.util.Map; /** - * Utility class for accessing and manipulating Enums. + *

Utility class for accessing and manipulating {@link Enum}s.

* * @see Enum * @see ValuedEnum * @author Stephen Colebourne * @since 1.0 - * @version $Id: EnumUtils.java,v 1.6 2003/03/06 22:50:21 scolebourne Exp $ + * @version $Id: EnumUtils.java,v 1.7 2003/07/14 22:25:04 bayard Exp $ */ public class EnumUtils { /** - * Restricted constructor + * Restricted constructor. */ private EnumUtils() { } /** - * Gets an Enum object by class and name. + *

Gets an Enum object by class and name.

* - * @param enumClass the class of the Enum to get - * @param name the name of the Enum to get, may be null + * @param enumClass the class of the Enum to get + * @param name the name of the Enum to get, may be null * @return the enum object - * @throws IllegalArgumentException if the enum class is null + * @throws IllegalArgumentException if the enum class is null */ public static Enum getEnum(Class enumClass, String name) { return Enum.getEnum(enumClass, name); } /** - * Gets a ValuedEnum object by class and value. + *

Gets a ValuedEnum object by class and value.

* - * @param enumClass the class of the Enum to get - * @param value the value of the Enum to get + * @param enumClass the class of the Enum to get + * @param value the value of the Enum to get * @return the enum object, or null if the enum does not exist - * @throws IllegalArgumentException if the enum class is null + * @throws IllegalArgumentException if the enum class is null */ public static ValuedEnum getEnum(Class enumClass, int value) { return (ValuedEnum) ValuedEnum.getEnum(enumClass, value); } /** - * Gets the Map of Enum objects by name using the Enum class. - * If the requested class has no enum objects an empty Map is returned. - * The Map is unmodifiable. + *

Gets the Map of Enum objects by + * name using the Enum class.

+ * + *

If the requested class has no enum objects an empty + * Map is returned. The Map is unmodifiable.

* - * @param enumClass the class of the Enum to get + * @param enumClass the class of the Enum to get * @return the enum object Map - * @throws IllegalArgumentException if the enum class is null - * @throws IllegalArgumentException if the enum class is not a subclass of Enum + * @throws IllegalArgumentException if the enum class is null + * @throws IllegalArgumentException if the enum class is not a subclass + * of Enum */ public static Map getEnumMap(Class enumClass) { return Enum.getEnumMap(enumClass); } /** - * Gets the List of Enum objects using the Enum class. - * The list is in the order that the objects were created (source code order). - * If the requested class has no enum objects an empty List is returned. - * The List is unmodifiable. + *

Gets the List of Enum objects using + * the Enum class.

+ * + *

The list is in the order that the objects were created + * (source code order).

+ * + *

If the requested class has no enum objects an empty + * List is returned. The List is unmodifiable.

* * @param enumClass the class of the Enum to get * @return the enum object Map - * @throws IllegalArgumentException if the enum class is null - * @throws IllegalArgumentException if the enum class is not a subclass of Enum + * @throws IllegalArgumentException if the enum class is null + * @throws IllegalArgumentException if the enum class is not a subclass + * of Enum */ public static List getEnumList(Class enumClass) { return Enum.getEnumList(enumClass); } /** - * Gets an iterator over the Enum objects in an Enum class. - * The iterator is in the order that the objects were created (source code order). - * If the requested class has no enum objects an empty Iterator is returned. - * The Iterator is unmodifiable. + *

Gets an Iterator over the Enum objects + * in an Enum class.

+ * + *

The iterator is in the order that the objects were created + * (source code order).

+ * + *

If the requested class has no enum objects an empty + * Iterator is returned. The Iterator + * is unmodifiable.

* - * @param enumClass the class of the Enum to get - * @return an iterator of the Enum objects - * @throws IllegalArgumentException if the enum class is null - * @throws IllegalArgumentException if the enum class is not a subclass of Enum + * @param enumClass the class of the Enum to get + * @return an Iterator of the Enum objects + * @throws IllegalArgumentException if the enum class is null + * @throws IllegalArgumentException if the enum class is not a subclass of Enum */ public static Iterator iterator(Class enumClass) { return Enum.getEnumList(enumClass).iterator(); diff --git a/src/java/org/apache/commons/lang/enum/ValuedEnum.java b/src/java/org/apache/commons/lang/enum/ValuedEnum.java index 2d8d906c6..4e8144327 100644 --- a/src/java/org/apache/commons/lang/enum/ValuedEnum.java +++ b/src/java/org/apache/commons/lang/enum/ValuedEnum.java @@ -56,14 +56,15 @@ import java.util.Iterator; import java.util.List; /** - * Abstract superclass for type-safe enums with integer values suitable - * for use in switch statements. - *

- * NOTE:Due to the way in which Java ClassLoaders work, comparing Enum objects - * should always be done using the equals() method, not ==. The equals() method will - * try == first so in most cases the effect is the same. - *

- * To use this class, it must be subclassed. For example: + *

Abstract superclass for type-safe enums with integer values suitable + * for use in switch statements.

+ * + *

NOTE:Due to the way in which Java ClassLoaders work, comparing + * Enum objects should always be done using the equals() method, + * not ==. The equals() method will try == first so + * in most cases the effect is the same.

+ * + *

To use this class, it must be subclassed. For example:

* *
  * public final class JavaVersionEnum extends ValuedEnum {
@@ -103,7 +104,8 @@
  * }
  * 
* - * The above class could then be used as follows: + *

The above class could then be used as follows:

+ * *
  * public void doSomething(JavaVersion ver) {
  *   switch (ver.getValue()) {
@@ -117,20 +119,19 @@
  *   }
  * }
  * 
- *

- * As shown, each enum has a name and a value. These can be accessed using - * getName and getValue. - *

- * The getEnum and iterator methods are recommended. + * + *

As shown, each enum has a name and a value. These can be accessed using + * getName and getValue.

+ * + *

The getEnum and iterator methods are recommended. * Unfortunately, Java restrictions require these to be coded as shown in each subclass. - * An alternative choice is to use the {@link EnumUtils} class. - *

- * NOTE: This class originated in the Jakarta Avalon project. - *

+ * An alternative choice is to use the {@link EnumUtils} class.

+ * + *

NOTE: This class originated in the Jakarta Avalon project.

* * @author Stephen Colebourne * @since 1.0 - * @version $Id: ValuedEnum.java,v 1.5 2003/02/04 18:30:07 scolebourne Exp $ + * @version $Id: ValuedEnum.java,v 1.6 2003/07/14 22:25:04 bayard Exp $ */ public abstract class ValuedEnum extends Enum { /** @@ -150,14 +151,16 @@ protected ValuedEnum(String name, int value) { } /** - * Gets an Enum object by class and value. - * This method loops through the list of Enums, thus if there - * are many Enums this will be slow. + *

Gets an Enum object by class and value.

+ * + *

This method loops through the list of Enum, + * thus if there are many Enums this will be + * slow.

* - * @param enumClass the class of the Enum to get - * @param value the value of the Enum to get + * @param enumClass the class of the Enum to get + * @param value the value of the Enum to get * @return the enum object, or null if the enum does not exist - * @throws IllegalArgumentException if the enum class is null + * @throws IllegalArgumentException if the enum class is null */ protected static Enum getEnum(Class enumClass, int value) { if (enumClass == null) { @@ -174,7 +177,7 @@ protected static Enum getEnum(Class enumClass, int value) { } /** - * Get value of enum item. + *

Get value of enum item.

* * @return the enum item's value. */ @@ -183,25 +186,30 @@ public final int getValue() { } /** - * Tests for order. The default ordering is numeric by value, but this - * can be overridden by subclasses. + *

Tests for order.

+ * + *

The default ordering is numeric by value, but this + * can be overridden by subclasses.

* * @see java.lang.Comparable#compareTo(Object) * @param other the other object to compare to - * @return -ve if this is less than the other object, +ve if greater than, 0 of equal - * @throws ClassCastException if other is not an Enum - * @throws NullPointerException if other is null + * @return -ve if this is less than the other object, +ve if greater than, + * 0 of equal + * @throws ClassCastException if other is not an Enum + * @throws NullPointerException if other is null */ public int compareTo(Object other) { return iValue - ((ValuedEnum) other).iValue; } /** - * Human readable description of this Enum item. For use when debugging. + *

Human readable description of this Enum item.

+ * + *

For use when debugging.

* * @return String in the form type[name=value], for example: - * JavaVersion[Java 1.0=100]. Note that the package name is - * stripped from the type name. + * JavaVersion[Java 1.0=100]. Note that the package name is + * stripped from the type name. */ public String toString() { String shortName = Enum.getEnumClass(getClass()).getName(); diff --git a/src/java/org/apache/commons/lang/math/DoubleRange.java b/src/java/org/apache/commons/lang/math/DoubleRange.java index be5b511ea..efead45fd 100644 --- a/src/java/org/apache/commons/lang/math/DoubleRange.java +++ b/src/java/org/apache/commons/lang/math/DoubleRange.java @@ -60,24 +60,36 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: DoubleRange.java,v 1.2 2003/03/23 17:51:15 scolebourne Exp $ + * @version $Id: DoubleRange.java,v 1.3 2003/07/14 22:25:04 bayard Exp $ */ public final class DoubleRange extends Range implements Serializable { private static final long serialVersionUID = 71849363892740L; - /* The minimum number in this range (inclusive). */ + /** + * The minimum number in this range (inclusive). + */ private final double min; - /* The maximum number in this range (inclusive). */ + /** + * The maximum number in this range (inclusive). + */ private final double max; - /** Cached output minObject (class is immutable) */ + /** + * Cached output minObject (class is immutable). + */ private transient Double minObject = null; - /** Cached output maxObject (class is immutable) */ + /** + * Cached output maxObject (class is immutable). + */ private transient Double maxObject = null; - /** Cached output hashCode (class is immutable) */ + /** + * Cached output hashCode (class is immutable). + */ private transient int hashCode = 0; - /** Cached output toString (class is immutable) */ + /** + * Cached output toString (class is immutable). + */ private transient String toString = null; /** @@ -100,7 +112,8 @@ public DoubleRange(double number) { *

Constructs a new DoubleRange using the specified * number as both the minimum and maximum in this range.

* - * @param number the number to use for this range, must not be null + * @param number the number to use for this range, must not + * be null * @throws IllegalArgumentException if the number is null * @throws IllegalArgumentException if the number is NaN */ diff --git a/src/java/org/apache/commons/lang/math/FloatRange.java b/src/java/org/apache/commons/lang/math/FloatRange.java index 7263b2668..1967ee34a 100644 --- a/src/java/org/apache/commons/lang/math/FloatRange.java +++ b/src/java/org/apache/commons/lang/math/FloatRange.java @@ -60,24 +60,36 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: FloatRange.java,v 1.2 2003/03/23 17:51:15 scolebourne Exp $ + * @version $Id: FloatRange.java,v 1.3 2003/07/14 22:25:04 bayard Exp $ */ public final class FloatRange extends Range implements Serializable { private static final long serialVersionUID = 71849363892750L; - /* The minimum number in this range (inclusive). */ + /** + * The minimum number in this range (inclusive). + */ private final float min; - /* The maximum number in this range (inclusive). */ + /** + * The maximum number in this range (inclusive). + */ private final float max; - /** Cached output minObject (class is immutable) */ + /** + * Cached output minObject (class is immutable). + */ private transient Float minObject = null; - /** Cached output maxObject (class is immutable) */ + /** + * Cached output maxObject (class is immutable). + */ private transient Float maxObject = null; - /** Cached output hashCode (class is immutable) */ + /** + * Cached output hashCode (class is immutable). + */ private transient int hashCode = 0; - /** Cached output toString (class is immutable) */ + /** + * Cached output toString (class is immutable). + */ private transient String toString = null; /** @@ -100,7 +112,8 @@ public FloatRange(float number) { *

Constructs a new FloatRange using the specified * number as both the minimum and maximum in this range.

* - * @param number the number to use for this range, must not be null + * @param number the number to use for this range, must not + * be null * @throws IllegalArgumentException if the number is null * @throws IllegalArgumentException if the number is NaN */ diff --git a/src/java/org/apache/commons/lang/math/Fraction.java b/src/java/org/apache/commons/lang/math/Fraction.java index a46b1eff7..f1938880c 100644 --- a/src/java/org/apache/commons/lang/math/Fraction.java +++ b/src/java/org/apache/commons/lang/math/Fraction.java @@ -58,53 +58,63 @@ /** *

Fraction is a Number implementation that * stores fractions accurately.

- * + * *

This class is immutable, and interoperable with most methods that accept * a Number.

* * @author Travis Reeder * @author Stephen Colebourne * @since 2.0 - * @version $Id: Fraction.java,v 1.3 2003/04/09 01:08:30 ggregory Exp $ + * @version $Id: Fraction.java,v 1.4 2003/07/14 22:25:05 bayard Exp $ */ public final class Fraction extends Number implements Serializable, Comparable { - + private static final long serialVersionUID = 65382027393090L; - + public static final Fraction ZERO = new Fraction(0, 1); public static final Fraction ONE = new Fraction(1, 1); - + public static final Fraction ONE_HALF = new Fraction(1, 2); - + public static final Fraction ONE_THIRD = new Fraction(1, 3); public static final Fraction TWO_THIRDS = new Fraction(2, 3); - + public static final Fraction ONE_QUARTER = new Fraction(1, 4); public static final Fraction TWO_QUARTERS = new Fraction(2, 4); public static final Fraction THREE_QUARTERS = new Fraction(3, 4); - + public static final Fraction ONE_FIFTH = new Fraction(1, 5); public static final Fraction TWO_FIFTHS = new Fraction(2, 5); public static final Fraction THREE_FIFTHS = new Fraction(3, 5); public static final Fraction FOUR_FIFTHS = new Fraction(4, 5); - - /** The numerator number part of the fraction (the three in three sevenths) */ + + /** + * The numerator number part of the fraction (the three in three sevenths). + */ private final int numerator; - /** The denominator number part of the fraction (the seven in three sevenths) */ + /** + * The denominator number part of the fraction (the seven in three sevenths). + */ private final int denominator; - /** Cached output hashCode (class is immutable) */ - private transient int hashCode = 0; - /** Cached output toString (class is immutable) */ - private transient String toString = null; - /** Cached output toProperString (class is immutable) */ - private transient String toProperString = null; - /** - *

Constructs a Fraction instance with the 2 parts + * Cached output hashCode (class is immutable). + */ + private transient int hashCode = 0; + /** + * Cached output toString (class is immutable). + */ + private transient String toString = null; + /** + * Cached output toProperString (class is immutable). + */ + private transient String toProperString = null; + + /** + *

Constructs a Fraction instance with the 2 parts * of a fraction Y/Z.

- * + * * @param numerator the numerator, for example the three in 'three sevenths' * @param denominator the denominator, for example the seven in 'three sevenths' */ @@ -113,17 +123,17 @@ private Fraction(int numerator, int denominator) { this.numerator = numerator; this.denominator = denominator; } - + /** - *

Creates a Fraction instance with the 2 parts + *

Creates a Fraction instance with the 2 parts * of a fraction Y/Z.

- * + * *

Any negative signs are resolved to be on the numerator.

- * + * * @param numerator the numerator, for example the three in 'three sevenths' * @param denominator the denominator, for example the seven in 'three sevenths' * @return a new fraction instance - * @throws ArithmeticException if the denomiator is zero + * @throws ArithmeticException if the denomiator is zero */ public static Fraction getFraction(int numerator, int denominator) { if (denominator == 0) { @@ -137,16 +147,16 @@ public static Fraction getFraction(int numerator, int denominator) { } /** - *

Creates a Fraction instance with the 3 parts + *

Creates a Fraction instance with the 3 parts * of a fraction X Y/Z.

- * + * *

The negative sign must be passed in on the whole number part.

- * + * * @param whole the whole number, for example the one in 'one and three sevenths' * @param numerator the numerator, for example the three in 'one and three sevenths' * @param denominator the denominator, for example the seven in 'one and three sevenths' * @return a new fraction instance - * @throws ArithmeticException if the denomiator is zero + * @throws ArithmeticException if the denomiator is zero * @throws ArithmeticException if the denomiator is negative * @throws ArithmeticException if the numerator is negative */ @@ -156,7 +166,7 @@ public static Fraction getFraction(int whole, int numerator, int denominator) { } if (denominator < 0) { throw new ArithmeticException("The denominator must not be negative"); - } + } if (numerator < 0) { throw new ArithmeticException("The numerator must not be negative"); } @@ -169,15 +179,15 @@ public static Fraction getFraction(int whole, int numerator, int denominator) { } /** - *

Creates a Fraction instance with the 2 parts + *

Creates a Fraction instance with the 2 parts * of a fraction Y/Z.

- * + * *

Any negative signs are resolved to be on the numerator.

- * + * * @param numerator the numerator, for example the three in 'three sevenths' * @param denominator the denominator, for example the seven in 'three sevenths' * @return a new fraction instance, with the numerator and denominator reduced - * @throws ArithmeticException if the denomiator is zero + * @throws ArithmeticException if the denomiator is zero */ public static Fraction getReducedFraction(int numerator, int denominator) { if (denominator == 0) { @@ -193,16 +203,16 @@ public static Fraction getReducedFraction(int numerator, int denominator) { } return new Fraction(numerator / gcd, denominator / gcd); } - + /** *

Creates a Fraction instance from a double value.

- * + * *

This method uses the continued fraction algorithm.

* * @param value the double value to convert * @return a new fraction instance that is close to the value - * @throws ArithmeticException if the value is infinite or NaN - * @throws ArithmeticException if the calculated denomiator is zero + * @throws ArithmeticException if the value is infinite or NaN + * @throws ArithmeticException if the calculated denomiator is zero */ public static Fraction getFraction(double value) { if (Double.isInfinite(value) || Double.isNaN(value)) { @@ -212,7 +222,7 @@ public static Fraction getFraction(double value) { value = Math.abs(value); int wholeNumber = (int) value; value -= wholeNumber; - + // http://archives.math.utk.edu/articles/atuyl/confrac/ int numer0 = 0; // the pre-previous int denom0 = 1; // the pre-previous @@ -258,17 +268,20 @@ public static Fraction getFraction(double value) { /** *

Creates a Fraction from a String.

- * + * *

The formats accepted are:

+ * + *

*

    - *
  1. double String containing a dot - *
  2. 'X Y/Z' - *
  3. 'Y/Z' - *
and a .

- * + *
  • double String containing a dot
  • + *
  • 'X Y/Z'
  • + *
  • 'Y/Z'
  • + * + * and a .

    + * * @param str the string to parse, must not be null * @return the new Fraction instance - * @throws IllegalArgumentException if the string is null + * @throws IllegalArgumentException if the string is null * @throws NumberFormatException if the number format is invalid */ public static Fraction getFraction(String str) { @@ -280,7 +293,7 @@ public static Fraction getFraction(String str) { if (pos >= 0) { return getFraction(Double.parseDouble(str)); } - + // parse X Y/Z format pos = str.indexOf(' '); if (pos > 0) { @@ -297,7 +310,7 @@ public static Fraction getFraction(String str) { ); } } - + // parse Y/Z format pos = str.indexOf('/'); if (pos < 0) { @@ -316,10 +329,10 @@ public static Fraction getFraction(String str) { /** *

    Gets the numerator part of the fraction.

    - * + * *

    This method may return a value greater than the denominator, an * improper fraction, such as the seven in 7/8.

    - * + * * @return the numerator fraction part */ public int getNumerator() { @@ -328,22 +341,22 @@ public int getNumerator() { /** *

    Gets the denominator part of the fraction.

    - * + * * @return the denominator fraction part */ public int getDenominator() { return denominator; } - + /** *

    Gets the proper numerator, always positive.

    - * + * *

    An improper fraction 7/8 can be resolved into a proper one, 1 3/4. * This method returns the 3 from the proper fraction.

    - * + * *

    If the fraction is negative such as -7/8, it can be resolved into * -1 3/4, so this method returns the positive proper numerator, 3.

    - * + * * @return the numerator fraction part of a proper fraction, always positive */ public int getProperNumerator() { @@ -352,13 +365,13 @@ public int getProperNumerator() { /** *

    Gets the proper whole part of the fraction.

    - * + * *

    An improper fraction 7/8 can be resolved into a proper one, 1 3/4. * This method returns the 1 from the proper fraction.

    - * + * *

    If the fraction is negative such as -7/8, it can be resolved into * -1 3/4, so this method returns the positive whole part -1.

    - * + * * @return the whole fraction part of a proper fraction, that includes the sign */ public int getProperWhole() { @@ -371,7 +384,7 @@ public int getProperWhole() { /** *

    Gets the fraction as an int. This returns the whole number * part of the fraction.

    - * + * * @return the whole number fraction part */ public int intValue() { @@ -381,7 +394,7 @@ public int intValue() { /** *

    Gets the fraction as a long. This returns the whole number * part of the fraction.

    - * + * * @return the whole number fraction part */ public long longValue() { @@ -391,7 +404,7 @@ public long longValue() { /** *

    Gets the fraction as a float. This calculates the fraction * as the numerator divided by denominator.

    - * + * * @return the fraction as a float */ public float floatValue() { @@ -401,7 +414,7 @@ public float floatValue() { /** *

    Gets the fraction as a double. This calculates the fraction * as the numerator divided by denominator.

    - * + * * @return the fraction as a double */ public double doubleValue() { @@ -412,9 +425,9 @@ public double doubleValue() { //------------------------------------------------------------------- /** - *

    Reduce the fraction to the smallest values for the numerator and + *

    Reduce the fraction to the smallest values for the numerator and * denominator, returning the result..

    - * + * * @return a new reduce fraction instance, or this if no simplification possible */ public Fraction reduce() { @@ -424,14 +437,14 @@ public Fraction reduce() { } return Fraction.getFraction(numerator / gcd, denominator / gcd); } - + /** *

    Gets a fraction that is the invert (1/fraction) of this one.

    - * + * *

    The returned fraction is not reduced.

    - * + * * @return a new fraction instance with the numerator and denominator inverted - * @throws ArithmeticException if the numerator is zero + * @throws ArithmeticException if the numerator is zero */ public Fraction invert() { if (numerator == 0) { @@ -439,24 +452,24 @@ public Fraction invert() { } return getFraction(denominator, numerator); } - + /** *

    Gets a fraction that is the negative (-fraction) of this one.

    - * + * *

    The returned fraction is not reduced.

    - * + * * @return a new fraction instance with the opposite signed numerator */ public Fraction negate() { return getFraction(-numerator, denominator); } - + /** *

    Gets a fraction that is the positive equivalent of this one.

    *

    More precisely:

    (fraction >= 0 ? this : -fraction)

    - * + * *

    The returned fraction is not reduced.

    - * + * * @return this if it is positive, or a new positive fraction * instance with the opposite signed numerator */ @@ -469,11 +482,11 @@ public Fraction abs() { /** *

    Gets a fraction that is raised to the passed in power.

    - * + * *

    The returned fraction is not reduced.

    - * + * * @param power the power to raise the fraction to - * @return this if the power is one, ONE if the power + * @return this if the power is one, ONE if the power * is zero or a new fraction instance raised to the appropriate power */ public Fraction pow(int power) { @@ -489,7 +502,7 @@ public Fraction pow(int power) { /** *

    Gets the greatest common denominator of two numbers.

    - * + * * @param number1 a positive number * @param number2 a positive number * @return the greatest common denominator @@ -509,14 +522,14 @@ private static int greatestCommonDenominator(int number1, int number2) { /** *

    Adds the value of this fraction to another, returning the result.

    - * - *

    The implementation spots common cases of zero numerators and equal + * + *

    The implementation spots common cases of zero numerators and equal * denominators. Otherwise, it uses (a/b) + (c/d) = (a*d + b*c) / (b*d) * and then reduces the result.

    - * - * @param the fraction to add, must not be null + * + * @param fraction the fraction to add, must not be null * @return a Fraction instance with the resulting values - * @throws IllegalArgumentException if the fraction is null + * @throws IllegalArgumentException if the fraction is null */ public Fraction add(Fraction fraction) { if (fraction == null) { @@ -538,16 +551,16 @@ public Fraction add(Fraction fraction) { } /** - *

    Subtracts the value of another fraction from the value of this one, + *

    Subtracts the value of another fraction from the value of this one, * returning the result.

    - * - *

    The implementation spots common cases of zero numerators and equal + * + *

    The implementation spots common cases of zero numerators and equal * denominators. Otherwise, it uses (a/b) - (c/d) = (a*d - b*c) / (b*d) * and then reduces the result.

    - * - * @param the fraction to subtract, must not be null + * + * @param fraction the fraction to subtract, must not be null * @return a Fraction instance with the resulting values - * @throws IllegalArgumentException if the fraction is null + * @throws IllegalArgumentException if the fraction is null */ public Fraction subtract(Fraction fraction) { if (fraction == null) { @@ -567,16 +580,16 @@ public Fraction subtract(Fraction fraction) { denominator * fraction.denominator ); } - + /** *

    Multiplies the value of this fraction by another, returning the result.

    - * + * *

    The implementation uses (a/b)*(c/d) = (a*c)/(b*d) * and then reduces the result.

    - * - * @param the fraction to multipy by, must not be null + * + * @param fraction the fraction to multipy by, must not be null * @return a Fraction instance with the resulting values - * @throws IllegalArgumentException if the fraction is null + * @throws IllegalArgumentException if the fraction is null */ public Fraction multiplyBy(Fraction fraction) { if (fraction == null) { @@ -590,16 +603,16 @@ public Fraction multiplyBy(Fraction fraction) { denominator * fraction.denominator ); } - + /** *

    Divide the value of this fraction by another, returning the result.

    - * + * *

    The implementation uses (a/b)/(c/d) = a/b * d/c = (a*d)/(b*c) * and then reduces the result.

    - * - * @param the fraction to divide by, must not be null + * + * @param fraction the fraction to divide by, must not be null * @return a Fraction instance with the resulting values - * @throws IllegalArgumentException if the fraction is null + * @throws IllegalArgumentException if the fraction is null * @throws ArithmeticException if the fraction to divide by is zero */ public Fraction divideBy(Fraction fraction) { @@ -623,7 +636,7 @@ public Fraction divideBy(Fraction fraction) { /** *

    Compares this fraction to another object to test if they are equal.

    . - * + * *

    To be equal, both values must be equal. Thus 2/4 is not equal to 1/2.

    * * @param obj the reference object with which to compare @@ -657,7 +670,7 @@ public int hashCode() { /** *

    Compares this object to another based on size.

    - * + * * @param object the object to compare to * @return -ve if this is less, 0 if equal, +ve if greater * @throws ClassCastException if the object is not a Fraction @@ -683,9 +696,9 @@ public int compareTo(Object object) { /** *

    Gets the fraction as a String.

    - * + * *

    The format used is 'numerator/denominator' always. - * + * * @return a String form of the fraction */ public String toString() { @@ -700,11 +713,11 @@ public String toString() { /** *

    Gets the fraction as a proper String in the format X Y/Z.

    - * + * *

    The format used in 'wholeNumber numerator/denominator'. * If the whole number is zero it will be ommitted. If the numerator is zero, * only the whole number is returned.

    - * + * * @return a String form of the fraction */ public String toProperString() { @@ -731,5 +744,5 @@ public String toProperString() { } return toProperString; } - + } diff --git a/src/java/org/apache/commons/lang/math/IntRange.java b/src/java/org/apache/commons/lang/math/IntRange.java index 2711e759f..6fbbcc315 100644 --- a/src/java/org/apache/commons/lang/math/IntRange.java +++ b/src/java/org/apache/commons/lang/math/IntRange.java @@ -60,24 +60,36 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: IntRange.java,v 1.2 2003/03/23 17:51:15 scolebourne Exp $ + * @version $Id: IntRange.java,v 1.3 2003/07/14 22:25:05 bayard Exp $ */ public final class IntRange extends Range implements Serializable { private static final long serialVersionUID = 71849363892730L; - /* The minimum number in this range (inclusive). */ + /** + * The minimum number in this range (inclusive). + */ private final int min; - /* The maximum number in this range (inclusive). */ + /** + * The maximum number in this range (inclusive). + */ private final int max; - /** Cached output minObject (class is immutable) */ + /** + * Cached output minObject (class is immutable) + */ private transient Integer minObject = null; - /** Cached output maxObject (class is immutable) */ + /** + * Cached output maxObject (class is immutable). + */ private transient Integer maxObject = null; - /** Cached output hashCode (class is immutable) */ + /** + * Cached output hashCode (class is immutable). + */ private transient int hashCode = 0; - /** Cached output toString (class is immutable) */ + /** + * Cached output toString (class is immutable). + */ private transient String toString = null; /** @@ -96,7 +108,7 @@ public IntRange(int number) { *

    Constructs a new IntRange using the specified * number as both the minimum and maximum in this range.

    * - * @param number the number to use for this range, must not be null + * @param number the number to use for this range, must not be null * @throws IllegalArgumentException if the number is null */ public IntRange(Number number) { diff --git a/src/java/org/apache/commons/lang/math/JVMRandom.java b/src/java/org/apache/commons/lang/math/JVMRandom.java index 3da7a79ae..90ac1c800 100644 --- a/src/java/org/apache/commons/lang/math/JVMRandom.java +++ b/src/java/org/apache/commons/lang/math/JVMRandom.java @@ -57,42 +57,50 @@ /** *

    JVMRandom is a wrapper that supports all possible - * Random methods via the java.lang.Math.random() method and its system-wide - * Random object. + * Random methods via the {@link java.lang.Math#random()} method + * and its system-wide {@link Random} object.

    * * @author Henri Yandell * @since 2.0 - * @version $Id: JVMRandom.java,v 1.6 2003/06/16 02:26:41 bayard Exp $ + * @version $Id: JVMRandom.java,v 1.7 2003/07/14 22:25:05 bayard Exp $ */ public final class JVMRandom extends Random { - /** ensures that only the constructor can call reseed */ + /** + * Ensures that only the constructor can call reseed. + */ private boolean constructed = false; public JVMRandom() { this.constructed = true; } - /** Unsupported in 2.0 */ + /** + * Unsupported in 2.0. + */ public synchronized void setSeed(long seed) { if (this.constructed) { throw new UnsupportedOperationException(); } } - /** Unsupported in 2.0 */ + /** + * Unsupported in 2.0. + */ public synchronized double nextGaussian() { throw new UnsupportedOperationException(); } - /** Unsupported in 2.0 */ + /** + * Unsupported in 2.0. + */ public void nextBytes(byte[] byteArray) { throw new UnsupportedOperationException(); } /** - * Returns the next pseudorandom, uniformly distributed int value - * from the Math.random() sequence. + *

    Returns the next pseudorandom, uniformly distributed int value + * from the Math.random() sequence.

    * * @return the random int */ @@ -100,14 +108,13 @@ public int nextInt() { return nextInt(Integer.MAX_VALUE); } /** - * Returns a pseudorandom, uniformly distributed int value between 0 - * (inclusive) and the specified value (exclusive), from the - * Math.random() sequence. + *

    Returns a pseudorandom, uniformly distributed int value between + * 0 (inclusive) and the specified value (exclusive), from + * the Math.random() sequence.

    * * @param n the specified exclusive max-value - * @throws IllegalArgumentException when n <= 0 - * * @return the random int + * @throws IllegalArgumentException when n <= 0 */ public int nextInt(int n) { if (n <= 0) { @@ -119,9 +126,8 @@ public int nextInt(int n) { return (int)(Math.random() * n); } /** - * Returns the next pseudorandom, uniformly distributed long value - * from the Math.random() sequence. - * + *

    Returns the next pseudorandom, uniformly distributed long value + * from the Math.random() sequence.

    * @return the random long */ public long nextLong() { @@ -131,14 +137,13 @@ public long nextLong() { /** - * Returns a pseudorandom, uniformly distributed long value between 0 - * (inclusive) and the specified value (exclusive), from the - * Math.random() sequence. + *

    Returns a pseudorandom, uniformly distributed long value between + * 0 (inclusive) and the specified value (exclusive), from + * the Math.random() sequence.

    * * @param n the specified exclusive max-value - * @throws IllegalArgumentException when n <= 0 - * * @return the random long + * @throws IllegalArgumentException when n <= 0 */ public static long nextLong(long n) { if (n <= 0) { @@ -151,8 +156,8 @@ public static long nextLong(long n) { } /** - * Returns the next pseudorandom, uniformly distributed boolean value - * from the Math.random() sequence. + *

    Returns the next pseudorandom, uniformly distributed boolean value + * from the Math.random() sequence.

    * * @return the random boolean */ @@ -160,8 +165,9 @@ public boolean nextBoolean() { return (Math.random() > 0.5); } /** - * Returns the next pseudorandom, uniformly distributed float value - * between 0.0 and 1.0 from the Math.random() sequence. + *

    Returns the next pseudorandom, uniformly distributed float value + * between 0.0 and 1.0 from the Math.random() + * sequence.

    * * @return the random float */ @@ -169,7 +175,7 @@ public float nextFloat() { return (float)Math.random(); } /** - * Synonymous to the Math.random() call. + *

    Synonymous to the Math.random() call.

    * * @return the random double */ diff --git a/src/java/org/apache/commons/lang/math/LongRange.java b/src/java/org/apache/commons/lang/math/LongRange.java index 0d439aa5b..dbfda47b3 100644 --- a/src/java/org/apache/commons/lang/math/LongRange.java +++ b/src/java/org/apache/commons/lang/math/LongRange.java @@ -60,24 +60,36 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: LongRange.java,v 1.2 2003/03/23 17:51:15 scolebourne Exp $ + * @version $Id: LongRange.java,v 1.3 2003/07/14 22:25:05 bayard Exp $ */ public final class LongRange extends Range implements Serializable { private static final long serialVersionUID = 71849363892720L; - /* The minimum number in this range (inclusive). */ + /** + * The minimum number in this range (inclusive). + */ private final long min; - /* The maximum number in this range (inclusive). */ + /** + * The maximum number in this range (inclusive). + */ private final long max; - /** Cached output minObject (class is immutable) */ + /** + * Cached output minObject (class is immutable). + */ private transient Long minObject = null; - /** Cached output maxObject (class is immutable) */ + /** + * Cached output maxObject (class is immutable). + */ private transient Long maxObject = null; - /** Cached output hashCode (class is immutable) */ + /** + * Cached output hashCode (class is immutable). + */ private transient int hashCode = 0; - /** Cached output toString (class is immutable) */ + /** + * Cached output toString (class is immutable). + */ private transient String toString = null; /** @@ -96,7 +108,8 @@ public LongRange(long number) { *

    Constructs a new LongRange using the specified * number as both the minimum and maximum in this range.

    * - * @param number the number to use for this range, must not be null + * @param number the number to use for this range, must not + * be null * @throws IllegalArgumentException if the number is null */ public LongRange(Number number) { diff --git a/src/java/org/apache/commons/lang/math/NumberRange.java b/src/java/org/apache/commons/lang/math/NumberRange.java index 894904cd6..3d3897200 100644 --- a/src/java/org/apache/commons/lang/math/NumberRange.java +++ b/src/java/org/apache/commons/lang/math/NumberRange.java @@ -57,25 +57,33 @@ /** *

    NumberRange represents an inclusive range of - * {@link java.lang.Number Number} objects of the same type.

    + * {@link java.lang.Number} objects of the same type.

    * * @author Christopher Elkins * @author Stephen Colebourne * @since 2.0 (previously in org.apache.commons.lang) - * @version $Id: NumberRange.java,v 1.3 2003/04/09 01:04:47 ggregory Exp $ + * @version $Id: NumberRange.java,v 1.4 2003/07/14 22:25:05 bayard Exp $ */ public final class NumberRange extends Range implements Serializable { private static final long serialVersionUID = 71849363892710L; - /* The minimum number in this range. */ + /** + * The minimum number in this range. + */ private final Number min; - /* The maximum number in this range. */ + /** + * The maximum number in this range. + */ private final Number max; - /** Cached output hashCode (class is immutable) */ + /** + * Cached output hashCode (class is immutable). + */ private transient int hashCode = 0; - /** Cached output toString (class is immutable) */ + /** + * Cached output toString (class is immutable). + */ private transient String toString = null; /** diff --git a/src/java/org/apache/commons/lang/math/NumberUtils.java b/src/java/org/apache/commons/lang/math/NumberUtils.java index f1017dfce..2df7357aa 100644 --- a/src/java/org/apache/commons/lang/math/NumberUtils.java +++ b/src/java/org/apache/commons/lang/math/NumberUtils.java @@ -69,7 +69,7 @@ * @author Phil Steitz * @author Matthew Hawthorne * @since 2.0 - * @version $Id: NumberUtils.java,v 1.2 2003/06/28 18:42:03 scolebourne Exp $ + * @version $Id: NumberUtils.java,v 1.3 2003/07/14 22:25:05 bayard Exp $ */ public final class NumberUtils { @@ -443,7 +443,7 @@ public static BigDecimal createBigDecimal(String val) { // Min in array //-------------------------------------------------------------------- /** - * Returns the minimum value in an array. + *

    Returns the minimum value in an array.

    * * @param array an array * @return the minimum value in the array @@ -470,7 +470,7 @@ public static long min(long[] array) { } /** - * Returns the minimum value in an array. + *

    Returns the minimum value in an array.

    * * @param array an array * @return the minimum value in the array @@ -497,7 +497,7 @@ public static int min(int[] array) { } /** - * Returns the minimum value in an array. + *

    Returns the minimum value in an array.

    * * @param array an array * @return the minimum value in the array @@ -524,7 +524,7 @@ public static short min(short[] array) { } /** - * Returns the minimum value in an array. + *

    Returns the minimum value in an array.

    * * @param array an array * @return the minimum value in the array @@ -551,7 +551,7 @@ public static double min(double[] array) { } /** - * Returns the minimum value in an array. + *

    Returns the minimum value in an array.

    * * @param array an array * @return the minimum value in the array @@ -580,7 +580,7 @@ public static float min(float[] array) { // Max in array //-------------------------------------------------------------------- /** - * Returns the maximum value in an array. + *

    Returns the maximum value in an array.

    * * @param array an array * @return the minimum value in the array @@ -607,7 +607,7 @@ public static long max(long[] array) { } /** - * Returns the maximum value in an array. + *

    Returns the maximum value in an array.

    * * @param array an array * @return the minimum value in the array @@ -634,7 +634,7 @@ public static int max(int[] array) { } /** - * Returns the maximum value in an array. + *

    Returns the maximum value in an array.

    * * @param array an array * @return the minimum value in the array @@ -661,7 +661,7 @@ public static short max(short[] array) { } /** - * Returns the maximum value in an array. + *

    Returns the maximum value in an array.

    * * @param array an array * @return the minimum value in the array @@ -688,7 +688,7 @@ public static double max(double[] array) { } /** - * Returns the maximum value in an array. + *

    Returns the maximum value in an array.

    * * @param array an array * @return the minimum value in the array @@ -791,7 +791,8 @@ public static byte min(byte a, byte b, byte c) { /** *

    Gets the minimum of three double values.

    * - *

    If any value is NaN, NaN is returned. Infinity is handled.

    + *

    If any value is NaN, NaN is + * returned. Infinity is handled.

    * * @param a value 1 * @param b value 2 @@ -805,8 +806,9 @@ public static double min(double a, double b, double c) { /** *

    Gets the minimum of three float values.

    * - *

    If any value is NaN, NaN is returned. Infinity is handled.

    - * + *

    If any value is NaN, NaN is + * returned. Infinity is handled.

    + * * @param a value 1 * @param b value 2 * @param c value 3 @@ -893,8 +895,9 @@ public static byte max(byte a, byte b, byte c) { /** *

    Gets the maximum of three double values.

    * - *

    If any value is NaN, NaN is returned. Infinity is handled.

    - * + *

    If any value is NaN, NaN is + * returned. Infinity is handled.

    + * * @param a value 1 * @param b value 2 * @param c value 3 @@ -907,8 +910,9 @@ public static double max(double a, double b, double c) { /** *

    Gets the maximum of three float values.

    * - *

    If any value is NaN, NaN is returned. Infinity is handled.

    - * + *

    If any value is NaN, NaN is + * returned. Infinity is handled.

    + * * @param a value 1 * @param b value 2 * @param c value 3 @@ -925,9 +929,9 @@ public static float max(float a, float b, float c) { *

    This method is more comprehensive than the standard Java greater * than, less than and equals operators.

    *
      - *
    • It returns -1 if the first value is less than the second. - *
    • It returns +1 if the first value is greater than the second. - *
    • It returns 0 if the values are equal. + *
    • It returns -1 if the first value is less than the second.
    • + *
    • It returns +1 if the first value is greater than the second.
    • + *
    • It returns 0 if the values are equal.
    • *
    * *

    @@ -940,7 +944,7 @@ public static float max(float a, float b, float c) { *

  • +0.0 *
  • -0.0 *
  • Normal negative numbers - *
  • Minimum double (-Double.MAX_VALUE) + *
  • Minimum double (-Double.MAX_VALUE) *
  • Negative infinity * *

    @@ -1002,7 +1006,7 @@ public static int compare(double lhs, double rhs) { *
  • +0.0 *
  • -0.0 *
  • Normal negative numbers - *
  • Minimum float (-Float.MAX_VALUE) + *
  • Minimum float (-Float.MAX_VALUE) *
  • Negative infinity * * diff --git a/src/java/org/apache/commons/lang/math/RandomUtils.java b/src/java/org/apache/commons/lang/math/RandomUtils.java index 46f4bf2df..d673e8f13 100644 --- a/src/java/org/apache/commons/lang/math/RandomUtils.java +++ b/src/java/org/apache/commons/lang/math/RandomUtils.java @@ -57,12 +57,12 @@ /** *

    RandomUtils is a wrapper that supports all possible - * Random methods via the java.lang.Math.random() method and its system-wide - * Random object. + * {@link java.util.Random} methods via the {@link java.lang.Math#random()} + * method and its system-wide Random object. * * @author Henri Yandell * @since 2.0 - * @version $Id: RandomUtils.java,v 1.2 2003/05/07 15:09:19 bayard Exp $ + * @version $Id: RandomUtils.java,v 1.3 2003/07/14 22:25:05 bayard Exp $ */ public final class RandomUtils { @@ -74,8 +74,8 @@ public final class RandomUtils { // } /** - * Returns the next pseudorandom, uniformly distributed int value - * from the Math.random() sequence. + *

    Returns the next pseudorandom, uniformly distributed int value + * from the Math.random() sequence.

    * * @return the random int */ @@ -86,9 +86,9 @@ public static int nextInt(Random rnd) { return rnd.nextInt(); } /** - * Returns a pseudorandom, uniformly distributed int value between 0 - * (inclusive) and the specified value (exclusive), from the - * Math.random() sequence. + *

    Returns a pseudorandom, uniformly distributed int value + * between 0 (inclusive) and the specified value + * (exclusive), from the Math.random() sequence.

    * * @param n the specified exclusive max-value * @@ -102,8 +102,8 @@ public static int nextInt(Random rnd, int n) { return rnd.nextInt(n); } /** - * Returns the next pseudorandom, uniformly distributed long value - * from the Math.random() sequence. + *

    Returns the next pseudorandom, uniformly distributed long value + * from the Math.random() sequence.

    * * @return the random long */ @@ -114,8 +114,8 @@ public static long nextLong(Random rnd) { return rnd.nextLong(); } /** - * Returns the next pseudorandom, uniformly distributed boolean value - * from the Math.random() sequence. + *

    Returns the next pseudorandom, uniformly distributed boolean value + * from the Math.random() sequence.

    * * @return the random boolean */ @@ -126,8 +126,9 @@ public static boolean nextBoolean(Random rnd) { return rnd.nextBoolean(); } /** - * Returns the next pseudorandom, uniformly distributed float value - * between 0.0 and 1.0 from the Math.random() sequence. + *

    Returns the next pseudorandom, uniformly distributed float value + * between 0.0 and 1.0 from the Math.random() + * sequence.

    * * @return the random float */ @@ -138,7 +139,7 @@ public static float nextFloat(Random rnd) { return rnd.nextFloat(); } /** - * Synonymous to the Math.random() call. + *

    Synonymous to the Math.random() call.

    * * @return the random double */ diff --git a/src/java/org/apache/commons/lang/time/DateFormatUtils.java b/src/java/org/apache/commons/lang/time/DateFormatUtils.java index 4e74a147d..f60a0fd99 100644 --- a/src/java/org/apache/commons/lang/time/DateFormatUtils.java +++ b/src/java/org/apache/commons/lang/time/DateFormatUtils.java @@ -58,17 +58,17 @@ import java.util.TimeZone; /** - * Date and time formatting utilites and constants. - *

    - * Formatting is performed using the - * {@link org.apache.commons.lang.time.FastDateFormat} class. + *

    Date and time formatting utilites and constants.

    + * + *

    Formatting is performed using the + * {@link org.apache.commons.lang.time.FastDateFormat} class.

    * * @author Apache Ant - DateUtils * @author Stephane Bailliez * @author Stefan Bodewig * @author Stephen Colebourne * @since 2.0 - * @version $Id: DateFormatUtils.java,v 1.2 2003/06/09 21:22:31 scolebourne Exp $ + * @version $Id: DateFormatUtils.java,v 1.3 2003/07/14 22:25:05 bayard Exp $ */ public class DateFormatUtils { @@ -143,16 +143,16 @@ public class DateFormatUtils { //----------------------------------------------------------------------- /** - * DateFormatUtils instances should NOT be constructed in standard programming. - *

    - * This constructor is public to permit tools that require a JavaBean instance - * to operate. + *

    DateFormatUtils instances should NOT be constructed in standard programming.

    + * + *

    This constructor is public to permit tools that require a JavaBean instance + * to operate.

    */ public DateFormatUtils() { } /** - * Format a date/time into a specific pattern using the UTC timezone. + *

    Format a date/time into a specific pattern using the UTC timezone.

    * * @param millis the date to format expressed in milliseconds * @param pattern the pattern to use to format the date @@ -163,7 +163,7 @@ public static String formatUTC(long millis, String pattern) { } /** - * Format a date/time into a specific pattern using the UTC timezone. + *

    Format a date/time into a specific pattern using the UTC timezone.

    * * @param date the date to format * @param pattern the pattern to use to format the date @@ -174,11 +174,11 @@ public static String formatUTC(Date date, String pattern) { } /** - * Format a date/time into a specific pattern using the UTC timezone. + *

    Format a date/time into a specific pattern using the UTC timezone.

    * * @param millis the date to format expressed in milliseconds * @param pattern the pattern to use to format the date - * @param locale the locale to use, may be null + * @param locale the locale to use, may be null * @return the formatted date */ public static String formatUTC(long millis, String pattern, Locale locale) { @@ -186,11 +186,11 @@ public static String formatUTC(long millis, String pattern, Locale locale) { } /** - * Format a date/time into a specific pattern using the UTC timezone. + *

    Format a date/time into a specific pattern using the UTC timezone.

    * * @param date the date to format * @param pattern the pattern to use to format the date - * @param locale the locale to use, may be null + * @param locale the locale to use, may be null * @return the formatted date */ public static String formatUTC(Date date, String pattern, Locale locale) { @@ -198,7 +198,7 @@ public static String formatUTC(Date date, String pattern, Locale locale) { } /** - * Format a date/time into a specific pattern. + *

    Format a date/time into a specific pattern.

    * * @param millis the date to format expressed in milliseconds * @param pattern the pattern to use to format the date @@ -209,7 +209,7 @@ public static String format(long millis, String pattern) { } /** - * Format a date/time into a specific pattern. + *

    Format a date/time into a specific pattern.

    * * @param date the date to format * @param pattern the pattern to use to format the date @@ -220,11 +220,11 @@ public static String format(Date date, String pattern) { } /** - * Format a date/time into a specific pattern in a timezone. + *

    Format a date/time into a specific pattern in a timezone.

    * * @param millis the time expressed in milliseconds * @param pattern the pattern to use to format the date - * @param timeZone the timezone to use, may be null + * @param timeZone the timezone to use, may be null * @return the formatted date */ public static String format(long millis, String pattern, TimeZone timeZone) { @@ -232,11 +232,11 @@ public static String format(long millis, String pattern, TimeZone timeZone) { } /** - * Format a date/time into a specific pattern in a timezone. + *

    Format a date/time into a specific pattern in a timezone.

    * * @param date the date to format * @param pattern the pattern to use to format the date - * @param timeZone the timezone to use, may be null + * @param timeZone the timezone to use, may be null * @return the formatted date */ public static String format(Date date, String pattern, TimeZone timeZone) { @@ -244,11 +244,11 @@ public static String format(Date date, String pattern, TimeZone timeZone) { } /** - * Format a date/time into a specific pattern in a locale. + *

    Format a date/time into a specific pattern in a locale.

    * * @param millis the date to format expressed in milliseconds * @param pattern the pattern to use to format the date - * @param locale the locale to use, may be null + * @param locale the locale to use, may be null * @return the formatted date */ public static String format(long millis, String pattern, Locale locale) { @@ -256,11 +256,11 @@ public static String format(long millis, String pattern, Locale locale) { } /** - * Format a date/time into a specific pattern in a locale. + *

    Format a date/time into a specific pattern in a locale.

    * * @param date the date to format * @param pattern the pattern to use to format the date - * @param locale the locale to use, may be null + * @param locale the locale to use, may be null * @return the formatted date */ public static String format(Date date, String pattern, Locale locale) { @@ -268,12 +268,12 @@ public static String format(Date date, String pattern, Locale locale) { } /** - * Format a date/time into a specific pattern in a timezone and locale. + *

    Format a date/time into a specific pattern in a timezone and locale.

    * * @param millis the date to format expressed in milliseconds * @param pattern the pattern to use to format the date - * @param timeZone the timezone to use, may be null - * @param locale the locale to use, may be null + * @param timeZone the timezone to use, may be null + * @param locale the locale to use, may be null * @return the formatted date */ public static String format(long millis, String pattern, TimeZone timeZone, Locale locale) { @@ -281,12 +281,12 @@ public static String format(long millis, String pattern, TimeZone timeZone, Loca } /** - * Format a date/time into a specific pattern in a timezone and locale. + *

    Format a date/time into a specific pattern in a timezone and locale.

    * * @param date the date to format * @param pattern the pattern to use to format the date - * @param timeZone the timezone to use, may be null - * @param locale the locale to use, may be null + * @param timeZone the timezone to use, may be null + * @param locale the locale to use, may be null * @return the formatted date */ public static String format(Date date, String pattern, TimeZone timeZone, Locale locale) { diff --git a/src/java/org/apache/commons/lang/time/DateUtils.java b/src/java/org/apache/commons/lang/time/DateUtils.java index 37198faff..7e62863b9 100644 --- a/src/java/org/apache/commons/lang/time/DateUtils.java +++ b/src/java/org/apache/commons/lang/time/DateUtils.java @@ -66,13 +66,14 @@ import java.util.TimeZone; /** - * A suite of utilities surrounding the use of the Calendar and Date object. + *

    A suite of utilities surrounding the use of the + * {@link java.util.Calendar} and {@link java.util.Date} object.

    * * @author Serge Knystautas * @author Stephen Colebourne * @author Janek Bogucki * @since 2.0 - * @version $Id: DateUtils.java,v 1.5 2003/06/28 17:49:53 scolebourne Exp $ + * @version $Id: DateUtils.java,v 1.6 2003/07/14 22:25:05 bayard Exp $ */ public class DateUtils { @@ -164,16 +165,19 @@ public DateUtils() { //----------------------------------------------------------------------- /** - * Round this date, leaving the field specified as the most significant - * field. For example, if you had the datetime of 28 Mar 2002 - * 13:45:01.231, if this was passed with HOUR, it would return 28 Mar - * 2002 14:00:00.000. If this was passed with MONTH, it would return - * 1 April 2002 0:00:00.000. + *

    Round this date, leaving the field specified as the most + * significant field.

    + * + *

    For example, if you had the datetime of 28 Mar 2002 + * 13:45:01.231, if this was passed with HOUR, it would return + * 28 Mar 2002 14:00:00.000. If this was passed with MONTH, it + * would return 1 April 2002 0:00:00.000.

    * * @param date the date to work with - * @param field the field from Calendar or SEMI_MONTH + * @param field the field from Calendar + * or SEMI_MONTH * @return the rounded date - * @throws IllegalArgumentException if the date is null + * @throws IllegalArgumentException if the date is null */ public static Date round(Date date, int field) { if (date == null) { @@ -186,16 +190,19 @@ public static Date round(Date date, int field) { } /** - * Round this date, leaving the field specified as the most significant - * field. For example, if you had the datetime of 28 Mar 2002 - * 13:45:01.231, if this was passed with HOUR, it would return 28 Mar - * 2002 14:00:00.000. If this was passed with MONTH, it would return - * 1 April 2002 0:00:00.000. + *

    Round this date, leaving the field specified as the most + * significant field.

    + * + *

    For example, if you had the datetime of 28 Mar 2002 + * 13:45:01.231, if this was passed with HOUR, it would return + * 28 Mar 2002 14:00:00.000. If this was passed with MONTH, it + * would return 1 April 2002 0:00:00.000.

    * * @param date the date to work with - * @param field the field from Calendar or SEMI_MONTH + * @param field the field from Calendar + * or SEMI_MONTH * @return the rounded date (a different object) - * @throws IllegalArgumentException if the date is null + * @throws IllegalArgumentException if the date is null */ public static Calendar round(Calendar date, int field) { if (date == null) { @@ -207,17 +214,21 @@ public static Calendar round(Calendar date, int field) { } /** - * Round this date, leaving the field specified as the most significant - * field. For example, if you had the datetime of 28 Mar 2002 - * 13:45:01.231, if this was passed with HOUR, it would return 28 Mar - * 2002 14:00:00.000. If this was passed with MONTH, it would return - * 1 April 2002 0:00:00.000. + *

    Round this date, leaving the field specified as the most + * significant field.

    + * + *

    For example, if you had the datetime of 28 Mar 2002 + * 13:45:01.231, if this was passed with HOUR, it would return + * 28 Mar 2002 14:00:00.000. If this was passed with MONTH, it + * would return 1 April 2002 0:00:00.000.

    * * @param date the date to work with, either Date or Calendar - * @param field the field from Calendar or SEMI_MONTH + * @param field the field from Calendar + * or SEMI_MONTH * @return the rounded date - * @throws IllegalArgumentException if the date is null - * @throws ClassCastException if the object type is not a Date or Calendar + * @throws IllegalArgumentException if the date is null + * @throws ClassCastException if the object type is not a Date + * or Calendar */ public static Date round(Object date, int field) { if (date == null) { @@ -234,16 +245,19 @@ public static Date round(Object date, int field) { //----------------------------------------------------------------------- /** - * Truncate this date, leaving the field specified as the most significant - * field. For example, if you had the datetime of 28 Mar 2002 + *

    Truncate this date, leaving the field specified as the most + * significant field.

    + * + *

    For example, if you had the datetime of 28 Mar 2002 * 13:45:01.231, if you passed with HOUR, it would return 28 Mar - * 2002 13:00:00.000. If this was passed with MONTH, it would return - * 1 Mar 2002 0:00:00.000. + * 2002 13:00:00.000. If this was passed with MONTH, it would + * return 1 Mar 2002 0:00:00.000.

    * * @param date the date to work with - * @param field the field from Calendar or SEMI_MONTH + * @param field the field from Calendar + * or SEMI_MONTH * @return the rounded date - * @throws IllegalArgumentException if the date is null + * @throws IllegalArgumentException if the date is null */ public static Date truncate(Date date, int field) { if (date == null) { @@ -256,16 +270,19 @@ public static Date truncate(Date date, int field) { } /** - * Truncate this date, leaving the field specified as the most significant - * field. For example, if you had the datetime of 28 Mar 2002 + *

    Truncate this date, leaving the field specified as the most + * significant field.

    + * + *

    For example, if you had the datetime of 28 Mar 2002 * 13:45:01.231, if you passed with HOUR, it would return 28 Mar - * 2002 13:00:00.000. If this was passed with MONTH, it would return - * 1 Mar 2002 0:00:00.000. + * 2002 13:00:00.000. If this was passed with MONTH, it would + * return 1 Mar 2002 0:00:00.000.

    * * @param date the date to work with - * @param field the field from Calendar or SEMI_MONTH + * @param field the field from Calendar + * or SEMI_MONTH * @return the rounded date (a different object) - * @throws IllegalArgumentException if the date is null + * @throws IllegalArgumentException if the date is null */ public static Calendar truncate(Calendar date, int field) { if (date == null) { @@ -277,17 +294,23 @@ public static Calendar truncate(Calendar date, int field) { } /** - * Truncate this date, leaving the field specified as the most significant - * field. For example, if you had the datetime of 28 Mar 2002 + *

    Truncate this date, leaving the field specified as the most + * significant field.

    + * + *

    For example, if you had the datetime of 28 Mar 2002 * 13:45:01.231, if you passed with HOUR, it would return 28 Mar - * 2002 13:00:00.000. If this was passed with MONTH, it would return - * 1 Mar 2002 0:00:00.000. + * 2002 13:00:00.000. If this was passed with MONTH, it would + * return 1 Mar 2002 0:00:00.000.

    * - * @param date the date to work with, either Date or Calendar - * @param field the field from Calendar or SEMI_MONTH + * @param date the date to work with, either Date + * or Calendar + * @param field the field from Calendar + * or SEMI_MONTH * @return the rounded date - * @throws IllegalArgumentException if the date is null - * @throws ClassCastException if the object type is not a Date or Calendar + * @throws IllegalArgumentException if the date + * is null + * @throws ClassCastException if the object type is not a + * Date or Calendar */ public static Date truncate(Object date, int field) { if (date == null) { @@ -304,7 +327,7 @@ public static Date truncate(Object date, int field) { //----------------------------------------------------------------------- /** - * Internal calculation method + *

    Internal calculation method.

    * * @param val the calendar * @param field the field constant @@ -387,7 +410,7 @@ private static void modify(Calendar val, int field, boolean round) { //----------------------------------------------------------------------- /** - * Parses a date string formatted in CVS format. + *

    Parses a date string formatted in CVS format.

    * * @param dateStr the date to parse * @return the parsed date @@ -398,7 +421,7 @@ public static Calendar parseCVS(String dateStr) { } /** - * Parses a date string formatted in CVS format. + *

    Parses a date string formatted in CVS format.

    * * @param dateStr the date to parse * @param locale the locale to parse in @@ -517,16 +540,19 @@ public static Calendar parseCVS(String dateStr, Locale locale) { //----------------------------------------------------------------------- /** - * This constructs an Iterator that will start and stop over a date - * range based on the focused date and the range style. For instance, - * passing Thursday, July 4, 2002 and a RANGE_MONTH_SUNDAY will return - * an Iterator that starts with Sunday, June 30, 2002 and ends with - * Saturday, August 3, 2002. + *

    This constructs an Iterator that will + * start and stop over a date range based on the focused + * date and the range style.

    + * + *

    For instance, passing Thursday, July 4, 2002 and a + * RANGE_MONTH_SUNDAY will return an + * Iterator that starts with Sunday, June 30, + * 2002 and ends with Saturday, August 3, 2002. * * @param focus the date to work with * @param rangeStyle the style constant to use * @return the date iterator - * @throws IllegalArgumentException if the date is null + * @throws IllegalArgumentException if the date is null */ public static Iterator iterator(Date focus, int rangeStyle) { if (focus == null) { @@ -538,16 +564,19 @@ public static Iterator iterator(Date focus, int rangeStyle) { } /** - * This constructs an Iterator that will start and stop over a date - * range based on the focused date and the range style. For instance, - * passing Thursday, July 4, 2002 and a RANGE_MONTH_SUNDAY will return - * an Iterator that starts with Sunday, June 30, 2002 and ends with - * Saturday, August 3, 2002. + *

    This constructs an Iterator that will + * start and stop over a date range based on the focused + * date and the range style.

    + * + *

    For instance, passing Thursday, July 4, 2002 and a + * RANGE_MONTH_SUNDAY will return an + * Iterator that starts with Sunday, June 30, + * 2002 and ends with Saturday, August 3, 2002. * * @param focus the date to work with * @param rangeStyle the style constant to use * @return the date iterator - * @throws IllegalArgumentException if the date is null + * @throws IllegalArgumentException if the date is null */ public static Iterator iterator(Calendar focus, int rangeStyle) { if (focus == null) { @@ -622,17 +651,23 @@ public static Iterator iterator(Calendar focus, int rangeStyle) { } /** - * This constructs an Iterator that will start and stop over a date - * range based on the focused date and the range style. For instance, - * passing Thursday, July 4, 2002 and a RANGE_MONTH_SUNDAY will return - * an Iterator that starts with Sunday, June 30, 2002 and ends with - * Saturday, August 3, 2002. + *

    This constructs an Iterator that will + * start and stop over a date range based on the focused + * date and the range style.

    + * + *

    For instance, passing Thursday, July 4, 2002 and a + * RANGE_MONTH_SUNDAY will return an + * Iterator that starts with Sunday, June 30, + * 2002 and ends with Saturday, August 3, 2002.

    * - * @param focus the date to work with, either Date or Calendar + * @param focus the date to work with, either + * Date or Calendar * @param rangeStyle the style constant to use * @return the date iterator - * @throws IllegalArgumentException if the date is null - * @throws ClassCastException if the object type is not a Date or Calendar + * @throws IllegalArgumentException if the date + * is null + * @throws ClassCastException if the object type is + * not a Date or Calendar */ public static Iterator iterator(Object focus, int rangeStyle) { if (focus == null) { @@ -648,7 +683,7 @@ public static Iterator iterator(Object focus, int rangeStyle) { } /** - * Date iterator. + *

    Date iterator.

    */ static class DateIterator implements Iterator { private final Calendar endFinal; diff --git a/src/java/org/apache/commons/lang/time/DurationFormatUtils.java b/src/java/org/apache/commons/lang/time/DurationFormatUtils.java index aecaba943..847b38d68 100644 --- a/src/java/org/apache/commons/lang/time/DurationFormatUtils.java +++ b/src/java/org/apache/commons/lang/time/DurationFormatUtils.java @@ -54,36 +54,39 @@ package org.apache.commons.lang.time; /** - * Duration formatting utilites and constants. + *

    Duration formatting utilites and constants.

    * * @author Apache Ant - DateUtils * @author Stephane Bailliez * @author Stefan Bodewig * @author Stephen Colebourne * @since 2.0 - * @version $Id: DurationFormatUtils.java,v 1.2 2003/06/09 21:23:14 scolebourne Exp $ + * @version $Id: DurationFormatUtils.java,v 1.3 2003/07/14 22:25:05 bayard Exp $ */ class DurationFormatUtils { // TODO: Make class public once methods can fully select which fields to output /** - * DurationFormatUtils instances should NOT be constructed in standard programming. - *

    - * This constructor is public to permit tools that require a JavaBean instance - * to operate. + *

    DurationFormatUtils instances should NOT be constructed in standard programming.

    + * + *

    This constructor is public to permit tools that require a JavaBean instance + * to operate.

    */ public DurationFormatUtils() { } /** - * Format an elapsed time into a plurialization correct string. + *

    Format an elapsed time into a plurialization correct string. * It is limited only to report elapsed time in minutes and - * seconds and has the following behavior. + * seconds and has the following behavior.

    + * *
      - *
    • minutes are not displayed when 0. (ie: "45 seconds")
    • - *
    • seconds are always displayed in plural form (ie "0 seconds" or - * "10 seconds") except for 1 (ie "1 second")
    • - *
    + *
  • minutes are not displayed when 0. (ie: + * "45 seconds")
  • + *
  • seconds are always displayed in plural form (ie + * "0 seconds" or "10 seconds") except + * for 1 (ie "1 second")
  • + * * * @param millis the elapsed time to report in milliseconds * @return the formatted text in minutes/seconds diff --git a/src/java/org/apache/commons/lang/time/FastDateFormat.java b/src/java/org/apache/commons/lang/time/FastDateFormat.java index 5aff909d5..2e97be65d 100644 --- a/src/java/org/apache/commons/lang/time/FastDateFormat.java +++ b/src/java/org/apache/commons/lang/time/FastDateFormat.java @@ -70,27 +70,29 @@ import java.util.TimeZone; /** - * FastDateFormat is a fast and thread-safe version of {@link java.text.SimpleDateFormat}. - *

    - * Only formatting is supported, but all patterns are compatible with - * SimpleDateFormat (except timezones - see below). - *

    - * Java 1.4 introduced a new pattern letter, 'Z', to represent time zones in - * RFC822 format (eg. +0800 or -1100). This pattern letter can be used here (on - * all JDK versions). - *

    - * In addition, the pattern 'ZZ' has been made to represent ISO8601 full format - * time zones (eg. +08:00 or -11:00). This introduces a minor incompatability with - * Java 1.4, but at a gain of useful functionality. - *

    - * NOTE: Code originally taken from the open source TeaTrove project. + *

    FastDateFormat is a fast and thread-safe version of + * {@link java.text.SimpleDateFormat}.

    + * + *

    Only formatting is supported, but all patterns are compatible with + * SimpleDateFormat (except timezones - see below).

    + * + *

    Java 1.4 introduced a new pattern letter, 'Z', to represent + * time zones in RFC822 format (eg. +0800 or -1100). + * This pattern letter can be used here (on all JDK versions).

    + * + *

    In addition, the pattern 'ZZ' has been made to represent + * ISO8601 full format time zones (eg. +08:00 or -11:00). + * This introduces a minor incompatability with Java 1.4, but at a gain of + * useful functionality.

    + * + *

    NOTE: Code originally taken from the open source TreeTrove project.

    * * @author Brian S O'Neill * @author Sean Schofield * @author Gary Gregory * @author Stephen Colebourne * @since 2.0 - * @version $Id: FastDateFormat.java,v 1.7 2003/07/12 08:26:22 scolebourne Exp $ + * @version $Id: FastDateFormat.java,v 1.8 2003/07/14 22:25:05 bayard Exp $ */ public class FastDateFormat extends Format { // A lot of the speed in this class comes from caching, but some comes @@ -105,13 +107,21 @@ public class FastDateFormat extends Format { // taking the value and adding (mathematically) the ASCII value for '0'. // So, don't change this code! It works and is very fast. - /** FULL locale dependent date or time style */ + /** + * FULL locale dependent date or time style. + */ public static final int FULL = SimpleDateFormat.FULL; - /** LONG locale dependent date or time style */ + /** + * LONG locale dependent date or time style + */ public static final int LONG = SimpleDateFormat.LONG; - /** MEDIUM locale dependent date or time style */ + /** + * MEDIUM locale dependent date or time style + */ public static final int MEDIUM = SimpleDateFormat.MEDIUM; - /** SHORT locale dependent date or time style */ + /** + * SHORT locale dependent date or time style + */ public static final int SHORT = SimpleDateFormat.SHORT; // package scoped as used by inner class @@ -125,24 +135,39 @@ public class FastDateFormat extends Format { private static Map cDateTimeInstanceCache = new HashMap(7); private static Map cTimeZoneDisplayCache = new HashMap(7); - /** The pattern */ + /** + * The pattern. + */ private final String mPattern; - /** The time zone */ + /** + * The time zone. + */ private final TimeZone mTimeZone; - /** Whether the time zone overrides any on Calendars */ + /** + * Whether the time zone overrides any on Calendars. + */ private final boolean mTimeZoneForced; - /** The locale */ + /** + * The locale. + */ private final Locale mLocale; - /** Whether the locale overrides the default */ + /** + * Whether the locale overrides the default. + */ private final boolean mLocaleForced; - /** The parsed rules */ + /** + * The parsed rules. + */ private Rule[] mRules; - /** The estimated maximum length */ + /** + * The estimated maximum length. + */ private int mMaxLengthEstimate; //----------------------------------------------------------------------- /** - * Gets a formatter instance using the default pattern in the default locale. + *

    Gets a formatter instance using the default pattern in the + * default locale.

    * * @return a date/time formatter */ @@ -151,9 +176,11 @@ public static FastDateFormat getInstance() { } /** - * Gets a formatter instance using the specified pattern in the default locale. + *

    Gets a formatter instance using the specified pattern in the + * default locale.

    * - * @param pattern {@link java.text.SimpleDateFormat} compatible pattern + * @param pattern {@link java.text.SimpleDateFormat} compatible + * pattern * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid */ @@ -162,10 +189,13 @@ public static FastDateFormat getInstance(String pattern) { } /** - * Gets a formatter instance using the specified pattern and time zone. + *

    Gets a formatter instance using the specified pattern and + * time zone.

    * - * @param pattern {@link java.text.SimpleDateFormat} compatible pattern - * @param timeZone optional time zone, overrides time zone of formatted date + * @param pattern {@link java.text.SimpleDateFormat} compatible + * pattern + * @param timeZone optional time zone, overrides time zone of + * formatted date * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid */ @@ -174,9 +204,11 @@ public static FastDateFormat getInstance(String pattern, TimeZone timeZone) { } /** - * Gets a formatter instance using the specified pattern and locale. + *

    Gets a formatter instance using the specified pattern and + * locale.

    * - * @param pattern {@link java.text.SimpleDateFormat} compatible pattern + * @param pattern {@link java.text.SimpleDateFormat} compatible + * pattern * @param locale optional locale, overrides system locale * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid @@ -186,13 +218,17 @@ public static FastDateFormat getInstance(String pattern, Locale locale) { } /** - * Gets a formatter instance using the specified pattern, time zone and locale. + *

    Gets a formatter instance using the specified pattern, time zone + * and locale.

    * - * @param pattern {@link java.text.SimpleDateFormat} compatible pattern - * @param timeZone optional time zone, overrides time zone of formatted date + * @param pattern {@link java.text.SimpleDateFormat} compatible + * pattern + * @param timeZone optional time zone, overrides time zone of + * formatted date * @param locale optional locale, overrides system locale * @return a pattern based date/time formatter - * @throws IllegalArgumentException if pattern is invalid or null + * @throws IllegalArgumentException if pattern is invalid + * or null */ public static synchronized FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale) { FastDateFormat emptyFormat = new FastDateFormat(pattern, timeZone, locale); @@ -206,13 +242,16 @@ public static synchronized FastDateFormat getInstance(String pattern, TimeZone t } /** - * Gets a date formatter instance using the specified style, time zone and locale. + *

    Gets a date formatter instance using the specified style, time + * zone and locale.

    * * @param style date style: FULL, LONG, MEDIUM, or SHORT - * @param timeZone optional time zone, overrides time zone of formatted date + * @param timeZone optional time zone, overrides time zone of + * formatted date * @param locale optional locale, overrides system locale * @return a localized standard date formatter - * @throws IllegalArgumentException if the Locale has no date pattern defined + * @throws IllegalArgumentException if the Locale has no date + * pattern defined */ public static synchronized FastDateFormat getDateInstance(int style, TimeZone timeZone, Locale locale) { Object key = new Integer(style); @@ -243,13 +282,16 @@ public static synchronized FastDateFormat getDateInstance(int style, TimeZone ti } /** - * Gets a time formatter instance using the specified style, time zone and locale. + *

    Gets a time formatter instance using the specified style, time + * zone and locale.

    * * @param style time style: FULL, LONG, MEDIUM, or SHORT - * @param timeZone optional time zone, overrides time zone of formatted time + * @param timeZone optional time zone, overrides time zone of + * formatted time * @param locale optional locale, overrides system locale * @return a localized standard time formatter - * @throws IllegalArgumentException if the Locale has no time pattern defined + * @throws IllegalArgumentException if the Locale has no time + * pattern defined */ public static synchronized FastDateFormat getTimeInstance(int style, TimeZone timeZone, Locale locale) { Object key = new Integer(style); @@ -280,14 +322,17 @@ public static synchronized FastDateFormat getTimeInstance(int style, TimeZone ti } /** - * Gets a date/time formatter instance using the specified style, time zone and locale. + *

    Gets a date/time formatter instance using the specified style, + * time zone and locale.

    * * @param dateStyle date style: FULL, LONG, MEDIUM, or SHORT * @param timeStyle time style: FULL, LONG, MEDIUM, or SHORT - * @param timeZone optional time zone, overrides time zone of formatted date + * @param timeZone optional time zone, overrides time zone of + * formatted date * @param locale optional locale, overrides system locale * @return a localized standard date/time formatter - * @throws IllegalArgumentException if the Locale has no date/time pattern defined + * @throws IllegalArgumentException if the Locale has no date/time + * pattern defined */ public static synchronized FastDateFormat getDateTimeInstance( int dateStyle, int timeStyle, TimeZone timeZone, Locale locale) { @@ -321,11 +366,12 @@ public static synchronized FastDateFormat getDateTimeInstance( //----------------------------------------------------------------------- /** - * Gets the time zone display name, using a cache for performance. + *

    Gets the time zone display name, using a cache for performance.

    * * @param tz the zone to query * @param daylight true if daylight savings - * @param style the style to use TimeZone.LONG or TimeZone.SHORT + * @param style the style to use TimeZone.LONG + * or TimeZone.SHORT * @param locale the locale to use * @return the textual name of the time zone */ @@ -341,7 +387,7 @@ static synchronized String getTimeZoneDisplay(TimeZone tz, boolean daylight, int } /** - * Gets the default pattern. + *

    Gets the default pattern.

    * * @return the default pattern */ @@ -355,13 +401,17 @@ private static synchronized String getDefaultPattern() { // Constructor //----------------------------------------------------------------------- /** - * Constructs a new FastDateFormat. + *

    Constructs a new FastDateFormat.

    * - * @param pattern {@link java.text.SimpleDateFormat} compatible pattern - * @param timeZone time zone to use, null means use default for Date and - * value within for Calendar - * @param locale locale, null means use system default - * @throws IllegalArgumentException if pattern is invalid or null + * @param pattern {@link java.text.SimpleDateFormat} compatible + * pattern + * @param timeZone time zone to use, null means use + * default for Date and value within for + * Calendar + * @param locale locale, null means use system + * default + * @throws IllegalArgumentException if pattern is invalid or + * null */ protected FastDateFormat(String pattern, TimeZone timeZone, Locale locale) { super(); @@ -384,7 +434,7 @@ protected FastDateFormat(String pattern, TimeZone timeZone, Locale locale) { } /** - * Initialise the instance for first use. + *

    Initialise the instance for first use.

    */ protected void init() { List rulesList = parsePattern(); @@ -401,9 +451,9 @@ protected void init() { // Parse the pattern //----------------------------------------------------------------------- /** - * Returns a list of Rules given a pattern. + *

    Returns a list of Rules given a pattern.

    * - * @return a List of Rule objects + * @return a List of Rule objects * @throws IllegalArgumentException if pattern is invalid */ protected List parsePattern() { @@ -530,7 +580,7 @@ protected List parsePattern() { } /** - * Performs the parsing of tokens. + *

    Performs the parsing of tokens.

    * * @param pattern the pattern * @param indexRef index references @@ -589,7 +639,7 @@ protected String parseToken(String pattern, int[] indexRef) { } /** - * Gets an appropriate rule for the padding required. + *

    Gets an appropriate rule for the padding required.

    * * @param field the field to get a rule for * @param padding the padding required @@ -609,7 +659,8 @@ protected NumberRule selectNumberRule(int field, int padding) { // Format methods //----------------------------------------------------------------------- /** - * Format either a Date or a Calendar object. + *

    Format either a Date or a + * Calendar object.

    * * @param obj the object to format * @param toAppendTo the buffer to append to @@ -628,7 +679,7 @@ public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition po } /** - * Formats a Date object. + *

    Formats a Date object.

    * * @param date the date to format * @return the formatted string @@ -640,7 +691,7 @@ public String format(Date date) { } /** - * Formats a Calendar object. + *

    Formats a Calendar object.

    * * @param calendar the calendar to format * @return the formatted string @@ -650,7 +701,8 @@ public String format(Calendar calendar) { } /** - * Formats a Date object into the supplied StringBuffer. + *

    Formats a Date object into the + * supplied StringBuffer.

    * * @param date the date to format * @param buf the buffer to format into @@ -663,7 +715,8 @@ public StringBuffer format(Date date, StringBuffer buf) { } /** - * Formats a Calendar object into the supplied StringBuffer. + *

    Formats a Calendar object into the + * supplied StringBuffer.

    * * @param calendar the calendar to format * @param buf the buffer to format into @@ -678,7 +731,8 @@ public StringBuffer format(Calendar calendar, StringBuffer buf) { } /** - * Performs the formatting by applying the rules to the specified calendar. + *

    Performs the formatting by applying the rules to the + * specified calendar.

    * * @param calendar the calendar to format * @param buf the buffer to format into @@ -696,11 +750,11 @@ protected StringBuffer applyRules(Calendar calendar, StringBuffer buf) { // Parsing //----------------------------------------------------------------------- /** - * Parsing not supported. + *

    Parsing not supported.

    * * @param source the string to parse * @param pos the parsing position - * @return null as not supported + * @return null as not supported */ public Object parseObject(String source, ParsePosition pos) { pos.setIndex(0); @@ -711,7 +765,7 @@ public Object parseObject(String source, ParsePosition pos) { // Accessors //----------------------------------------------------------------------- /** - * Gets the pattern used by this formatter. + *

    Gets the pattern used by this formatter.

    * * @return the pattern, {@link java.text.SimpleDateFormat} compatible */ @@ -720,11 +774,12 @@ public String getPattern() { } /** - * Gets the time zone used by this formatter. - *

    - * This zone is always used for Date formatting. - * If a Calendar is passed in to be formatted, the time zone on that may - * be used depending on {@link #getTimeZoneOverridesCalendar()}. + *

    Gets the time zone used by this formatter.

    + * + *

    This zone is always used for Date formatting. + * If a Calendar is passed in to be formatted, the + * time zone on that may be used depending on + * {@link #getTimeZoneOverridesCalendar()}.

    * * @return the time zone */ @@ -733,17 +788,18 @@ public TimeZone getTimeZone() { } /** - * Returns true if the time zone of the calendar overrides the time zone - * of the formatter + *

    Returns true if the time zone of the + * calendar overrides the time zone of the formatter.

    * - * @return true if time zone of formatter overridden for calendars + * @return true if time zone of formatter + * overridden for calendars */ public boolean getTimeZoneOverridesCalendar() { return mTimeZoneForced; } /** - * Gets the locale used by this formatter. + *

    Gets the locale used by this formatter.

    * * @return the locale */ @@ -752,8 +808,11 @@ public Locale getLocale() { } /** - * Gets an estimate for the maximum string length that the formatter will produce. - * The actual formatted length will almost always be less than or equal to this amount. + *

    Gets an estimate for the maximum string length that the + * formatter will produce.

    + * + *

    The actual formatted length will almost always be less than or + * equal to this amount.

    * * @return the maximum formatted length */ @@ -764,10 +823,10 @@ public int getMaxLengthEstimate() { // Basics //----------------------------------------------------------------------- /** - * Compare two objects for equality. + *

    Compare two objects for equality.

    * * @param obj the object to compare to - * @return true if equal + * @return true if equal */ public boolean equals(Object obj) { if (obj instanceof FastDateFormat == false) { @@ -787,7 +846,7 @@ public boolean equals(Object obj) { } /** - * A suitable hashcode. + *

    A suitable hashcode.

    * * @return a hashcode compatable with equals */ @@ -802,7 +861,7 @@ public int hashCode() { } /** - * Gets a debugging string version of this formatter. + *

    Gets a debugging string version of this formatter.

    * * @return a debugging string */ @@ -813,7 +872,7 @@ public String toString() { // Rules //----------------------------------------------------------------------- /** - * Inner class defining a rule. + *

    Inner class defining a rule.

    */ private interface Rule { int estimateLength(); @@ -821,14 +880,14 @@ private interface Rule { } /** - * Inner class defining a numeric rule. + *

    Inner class defining a numeric rule.

    */ private interface NumberRule extends Rule { void appendTo(StringBuffer buffer, int value); } /** - * Inner class to output a constant single character. + *

    Inner class to output a constant single character.

    */ private static class CharacterLiteral implements Rule { private final char mValue; @@ -847,7 +906,7 @@ public void appendTo(StringBuffer buffer, Calendar calendar) { } /** - * Inner class to output a constant string. + *

    Inner class to output a constant string.

    */ private static class StringLiteral implements Rule { private final String mValue; @@ -866,7 +925,7 @@ public void appendTo(StringBuffer buffer, Calendar calendar) { } /** - * Inner class to output one of a set of values. + *

    Inner class to output one of a set of values.

    */ private static class TextField implements Rule { private final int mField; @@ -894,7 +953,7 @@ public void appendTo(StringBuffer buffer, Calendar calendar) { } /** - * Inner class to output an unpadded number. + *

    Inner class to output an unpadded number.

    */ private static class UnpaddedNumberField implements NumberRule { static final UnpaddedNumberField INSTANCE_YEAR = new UnpaddedNumberField(Calendar.YEAR); @@ -926,7 +985,7 @@ public final void appendTo(StringBuffer buffer, int value) { } /** - * Inner class to output an unpadded month. + *

    Inner class to output an unpadded month.

    */ private static class UnpaddedMonthField implements NumberRule { static final UnpaddedMonthField INSTANCE = new UnpaddedMonthField(); @@ -953,7 +1012,7 @@ public final void appendTo(StringBuffer buffer, int value) { } /** - * Inner class to output a padded number. + *

    Inner class to output a padded number.

    */ private static class PaddedNumberField implements NumberRule { private final int mField; @@ -999,7 +1058,7 @@ public final void appendTo(StringBuffer buffer, int value) { } /** - * Inner class to output a two digit number. + *

    Inner class to output a two digit number.

    */ private static class TwoDigitNumberField implements NumberRule { private final int mField; @@ -1027,7 +1086,7 @@ public final void appendTo(StringBuffer buffer, int value) { } /** - * Inner class to output a two digit year. + *

    Inner class to output a two digit year.

    */ private static class TwoDigitYearField implements NumberRule { static final TwoDigitYearField INSTANCE = new TwoDigitYearField(); @@ -1050,7 +1109,7 @@ public final void appendTo(StringBuffer buffer, int value) { } /** - * Inner class to output a two digit month. + *

    Inner class to output a two digit month.

    */ private static class TwoDigitMonthField implements NumberRule { static final TwoDigitMonthField INSTANCE = new TwoDigitMonthField(); @@ -1073,7 +1132,7 @@ public final void appendTo(StringBuffer buffer, int value) { } /** - * Inner class to output the twelve hour field. + *

    Inner class to output the twelve hour field.

    */ private static class TwelveHourField implements NumberRule { private final NumberRule mRule; @@ -1100,7 +1159,7 @@ public void appendTo(StringBuffer buffer, int value) { } /** - * Inner class to output the twenty four hour field. + *

    Inner class to output the twenty four hour field.

    */ private static class TwentyFourHourField implements NumberRule { private final NumberRule mRule; @@ -1127,7 +1186,7 @@ public void appendTo(StringBuffer buffer, int value) { } /** - * Inner class to output a time zone name. + *

    Inner class to output a time zone name.

    */ private static class TimeZoneNameRule implements Rule { private final TimeZone mTimeZone; @@ -1181,7 +1240,8 @@ public void appendTo(StringBuffer buffer, Calendar calendar) { } /** - * Inner class to output a time zone as a number +/-HHMM or +/-HH:MM. + *

    Inner class to output a time zone as a number +/-HHMM + * or +/-HH:MM.

    */ private static class TimeZoneNumberRule implements Rule { static final TimeZoneNumberRule INSTANCE_COLON = new TimeZoneNumberRule(true); @@ -1223,7 +1283,7 @@ public void appendTo(StringBuffer buffer, Calendar calendar) { // ---------------------------------------------------------------------- /** - * Inner class that acts as a compound key for time zone names. + *

    Inner class that acts as a compound key for time zone names.

    */ private static class TimeZoneDisplayKey { private final TimeZone mTimeZone; @@ -1261,8 +1321,10 @@ public boolean equals(Object obj) { // ---------------------------------------------------------------------- /** - * Helper class for creating compound objects. One use for this class is to create a - * hashtable key out of multiple objects. + *

    Helper class for creating compound objects.

    + * + *

    One use for this class is to create a hashtable key + * out of multiple objects.

    */ private static class Pair { private final Object mObj1; diff --git a/src/java/org/apache/commons/lang/time/StopWatch.java b/src/java/org/apache/commons/lang/time/StopWatch.java index 793e49bbd..17d1e71e3 100644 --- a/src/java/org/apache/commons/lang/time/StopWatch.java +++ b/src/java/org/apache/commons/lang/time/StopWatch.java @@ -62,14 +62,15 @@ * *

    To start the watch, call {@link #start()}. At this point you can:

    *
      - *
    • {@link #split()} the watch to get the time whilst the watch continues in the - * background. {@link #unsplit()} will remove the effect of the split. At this point, - * these three options are available again. - *
    • {@link #suspend()} the watch to pause it. {@link #resume()} allows the watch - * to continue. Any time between the suspend and resume will not be counted in - * the total. At this point, these three options are available again. - *
    • {@link #stop()} the watch to complete the timing session. + *
    • {@link #split()} the watch to get the time whilst the watch continues in the + * background. {@link #unsplit()} will remove the effect of the split. At this point, + * these three options are available again.
    • + *
    • {@link #suspend()} the watch to pause it. {@link #resume()} allows the watch + * to continue. Any time between the suspend and resume will not be counted in + * the total. At this point, these three options are available again.
    • + *
    • {@link #stop()} the watch to complete the timing session.
    • *
    + * *

    It is intended that the output methods {@link #toString()} and {@link #getTime()} * should only be called after stop, split or suspend, however a suitable result will * be returned at other points.

    @@ -77,13 +78,17 @@ * @author Henri Yandell * @author Stephen Colebourne * @since 2.0 - * @version $Id: StopWatch.java,v 1.4 2003/06/08 23:14:23 scolebourne Exp $ + * @version $Id: StopWatch.java,v 1.5 2003/07/14 22:25:05 bayard Exp $ */ public class StopWatch { - /** The start time */ + /** + * The start time. + */ private long startTime = -1; - /** The stop time */ + /** + * The stop time. + */ private long stopTime = -1; /** diff --git a/src/java/org/apache/commons/lang/util/BitField.java b/src/java/org/apache/commons/lang/util/BitField.java index e090d740f..760f4e629 100644 --- a/src/java/org/apache/commons/lang/util/BitField.java +++ b/src/java/org/apache/commons/lang/util/BitField.java @@ -54,16 +54,16 @@ package org.apache.commons.lang.util; /** - * Manage operations dealing with bit-mapped fields. - *

    - * Code originated from the POI project. + *

    Manage operations dealing with bit-mapped fields.

    + * + *

    Code originated from the POI project.

    * * @author Scott Sanders (sanders at apache dot org) * @author Marc Johnson (mjohnson at apache dot org) * @author Andrew C. Oliver (acoliver at apache dot org) * @author Stephen Colebourne * @since 2.0 - * @version $Id: BitField.java,v 1.5 2003/04/09 00:07:49 ggregory Exp $ + * @version $Id: BitField.java,v 1.6 2003/07/14 22:25:06 bayard Exp $ */ public class BitField { @@ -71,11 +71,11 @@ public class BitField { private final int _shift_count; /** - * Create a BitField instance + *

    Create a BitField instance.

    * * @param mask the mask specifying which bits apply to this - * BitField. Bits that are set in this mask are the - * bits that this BitField operates on + * BitField. Bits that are set in this mask are the bits + * that this BitField operates on */ public BitField(final int mask) { _mask = mask; @@ -92,15 +92,16 @@ public BitField(final int mask) { } /** - * Obtain the value for the specified BitField, appropriately - * shifted right. Many users of a BitField will want to treat the - * specified bits as an int value, and will not want to be aware - * that the value is stored as a BitField (and so shifted left so - * many bits) + *

    Obtain the value for the specified BitField, appropriately + * shifted right.

    + * + *

    Many users of a BitField will want to treat the specified + * bits as an int value, and will not want to be aware that the + * value is stored as a BitField (and so shifted left so many + * bits).

    * * @param holder the int data containing the bits we're interested - * in - * + * in * @return the selected bits, shifted right appropriately */ public int getValue(final int holder) { @@ -108,15 +109,16 @@ public int getValue(final int holder) { } /** - * Obtain the value for the specified BitField, appropriately - * shifted right, as a short. Many users of a BitField will want - * to treat the specified bits as an int value, and will not want - * to be aware that the value is stored as a BitField (and so - * shifted left so many bits) + *

    Obtain the value for the specified BitField, appropriately + * shifted right, as a short.

    + * + *

    Many users of a BitField will want to treat the specified + * bits as an int value, and will not want to be aware that the + * value is stored as a BitField (and so shifted left so many + * bits).

    * * @param holder the short data containing the bits we're - * interested in - * + * interested in * @return the selected bits, shifted right appropriately */ public short getShortValue(final short holder) { @@ -124,11 +126,10 @@ public short getShortValue(final short holder) { } /** - * Obtain the value for the specified BitField, unshifted - * - * @param holder the int data containing the bits we're interested - * in + *

    Obtain the value for the specified BitField, unshifted.

    * + * @param holder the int data containing the bits we're + * interested in * @return the selected bits */ public int getRawValue(final int holder) { @@ -136,11 +137,10 @@ public int getRawValue(final int holder) { } /** - * Obtain the value for the specified BitField, unshifted + *

    Obtain the value for the specified BitField, unshifted.

    * * @param holder the short data containing the bits we're - * interested in - * + * interested in * @return the selected bits */ public short getShortRawValue(final short holder) { @@ -148,144 +148,144 @@ public short getShortRawValue(final short holder) { } /** - * Returns whether the field is set or not. This is most commonly used for a - * single-bit field, which is often used to represent a boolean - * value; the results of using it for a multi-bit field is to - * determine whether *any* of its bits are set + *

    Returns whether the field is set or not.

    + * + *

    This is most commonly used for a single-bit field, which is + * often used to represent a boolean value; the results of using + * it for a multi-bit field is to determine whether *any* of its + * bits are set.

    * * @param holder the int data containing the bits we're interested - * in - * - * @return true if any of the bits are set, else false + * in + * @return true if any of the bits are set, + * else false */ public boolean isSet(final int holder) { return (holder & _mask) != 0; } /** - * Returns whether all of the bits are set or not. This is a stricter test than - * isSet, in that all of the bits in a multi-bit set must be set - * for this method to return true + *

    Returns whether all of the bits are set or not.

    * - * @param holder the int data containing the bits we're interested - * in + *

    This is a stricter test than {@link #isSet(int)}, + * in that all of the bits in a multi-bit set must be set + * for this method to return true.

    * - * @return true if all of the bits are set, else false + * @param holder the int data containing the bits we're + * interested in + * @return true if all of the bits are set, + * else false */ public boolean isAllSet(final int holder) { return (holder & _mask) == _mask; } /** - * Replace the bits with new values. + *

    Replace the bits with new values.

    * - * @param holder the int data containint the bits we're interested - * in + * @param holder the int data containint the bits we're + * interested in * @param value the new value for the specified bits - * * @return the value of holder with the bits from the value - * parameter replacing the old bits + * parameter replacing the old bits */ public int setValue(final int holder, final int value) { return (holder & ~_mask) | ((value << _shift_count) & _mask); } /** - * Replace the bits with new values. + *

    Replace the bits with new values.

    * * @param holder the short data containing the bits we're - * interested in + * interested in * @param value the new value for the specified bits - * * @return the value of holder with the bits from the value - * parameter replacing the old bits + * parameter replacing the old bits */ public short setShortValue(final short holder, final short value) { return (short) setValue(holder, value); } /** - * Clear the bits. - * - * @param holder the int data containing the bits we're interested - * in + *

    Clear the bits.

    * + * @param holder the int data containing the bits we're + * interested in * @return the value of holder with the specified bits cleared - * (set to 0) + * (set to 0) */ public int clear(final int holder) { return holder & ~_mask; } /** - * Clear the bits. + *

    Clear the bits.

    * * @param holder the short data containing the bits we're - * interested in - * + * interested in * @return the value of holder with the specified bits cleared - * (set to 0) + * (set to 0) */ public short clearShort(final short holder) { return (short) clear(holder); } /** - * Clear the bits. + *

    Clear the bits.

    * * @param holder the byte data containing the bits we're - * interested in + * interested in * * @return the value of holder with the specified bits cleared - * (set to 0) + * (set to 0) */ public byte clearByte(final byte holder) { return (byte) clear(holder); } /** - * Set the bits. + *

    Set the bits.

    * - * @param holder the int data containing the bits we're interested - * in - * - * @return the value of holder with the specified bits set to 1 + * @param holder the int data containing the bits we're + * interested in + * @return the value of holder with the specified bits set + * to 1 */ public int set(final int holder) { return holder | _mask; } /** - * Set the bits. + *

    Set the bits.

    * * @param holder the short data containing the bits we're - * interested in - * - * @return the value of holder with the specified bits set to 1 + * interested in + * @return the value of holder with the specified bits set + * to 1 */ public short setShort(final short holder) { return (short) set(holder); } /** - * Set the bits. + *

    Set the bits.

    * * @param holder the byte data containing the bits we're - * interested in + * interested in * - * @return the value of holder with the specified bits set to 1 + * @return the value of holder with the specified bits set + * to 1 */ public byte setByte(final byte holder) { return (byte) set(holder); } /** - * Set a boolean BitField + *

    Set a boolean BitField.

    * - * @param holder the int data containing the bits we're interested - * in + * @param holder the int data containing the bits we're + * interested in * @param flag indicating whether to set or clear the bits - * * @return the value of holder with the specified bits set or * cleared */ @@ -294,28 +294,26 @@ public int setBoolean(final int holder, final boolean flag) { } /** - * Set a boolean BitField + *

    Set a boolean BitField.

    * * @param holder the short data containing the bits we're - * interested in + * interested in * @param flag indicating whether to set or clear the bits - * * @return the value of holder with the specified bits set or - * cleared + * cleared */ public short setShortBoolean(final short holder, final boolean flag) { return flag ? setShort(holder) : clearShort(holder); } /** - * Set a boolean BitField + *

    Set a boolean BitField.

    * * @param holder the byte data containing the bits we're - * interested in + * interested in * @param flag indicating whether to set or clear the bits - * * @return the value of holder with the specified bits set or - * cleared + * cleared */ public byte setByteBoolean(final byte holder, final boolean flag) { return flag ? setByte(holder) : clearByte(holder); diff --git a/src/java/org/apache/commons/lang/util/IdentifierUtils.java b/src/java/org/apache/commons/lang/util/IdentifierUtils.java index dc6961c81..ab3dba082 100644 --- a/src/java/org/apache/commons/lang/util/IdentifierUtils.java +++ b/src/java/org/apache/commons/lang/util/IdentifierUtils.java @@ -67,7 +67,7 @@ * * @author Stephen Colebourne * @since 2.0 - * @version $Id: IdentifierUtils.java,v 1.5 2003/05/16 22:06:43 scolebourne Exp $ + * @version $Id: IdentifierUtils.java,v 1.6 2003/07/14 22:25:06 bayard Exp $ */ public class IdentifierUtils { @@ -80,10 +80,10 @@ public class IdentifierUtils { * *

    The objects returned are:

    *
      - *
    • new Long(0L) - *
    • new Long(1L) - *
    • new Long(2L) - *
    • ... + *
    • new Long(0L)
    • + *
    • new Long(1L)
    • + *
    • new Long(2L)
    • + *
    • ...
    • *
    */ public static final LongIdentifierFactory LONG_IDENTIFIER_FACTORY = new LongNumericIdentifierFactory(true, 0L); @@ -96,10 +96,10 @@ public class IdentifierUtils { * *

    The objects returned are:

    *
      - *
    • "0" - *
    • "1" - *
    • "2" - *
    • ... + *
    • "0"
    • + *
    • "1"
    • + *
    • "2"
    • + *
    • ...
    • *
    */ public static final StringIdentifierFactory STRING_NUMERIC_IDENTIFIER_FACTORY = new StringNumericIdentifierFactory(true, 0L); @@ -113,18 +113,18 @@ public class IdentifierUtils { * *

    The objects returned are:

    *
      - *
    • "000000000000001" - *
    • "000000000000002" - *
    • "000000000000003" + *
    • "000000000000001"
    • + *
    • "000000000000002"
    • + *
    • "000000000000003"
    • *
    • ... - *
    • "00000000000000y" - *
    • "00000000000000z" - *
    • "000000000000010" - *
    • "000000000000011" - *
    • ... - *
    • "00000000000001z" - *
    • "000000000000020" + *
    • "00000000000000y"
    • + *
    • "00000000000000z"
    • + *
    • "000000000000010"
    • + *
    • "000000000000011"
    • *
    • ... + *
    • "00000000000001z"
    • + *
    • "000000000000020"
    • + *
    • ...
    • *
    */ public static final StringIdentifierFactory STRING_ALPHANUMERIC_IDENTIFIER_FACTORY = new StringAlphanumericIdentifierFactory(true, 15); @@ -156,8 +156,7 @@ public IdentifierUtils() { /** *

    Gets the next identifier using the singleton instance of the - * Long factory. - *

    + * Long factory.

    * *

    The singleton instance will wrap, so in a long-lived server, the id * may be duplicated.

    @@ -185,7 +184,7 @@ public static LongIdentifierFactory longIdentifierFactory() { *

    Gets a new identifier factory that returns a series of Long objects * increasing in size.

    * - * @param wrap should the factory wrap when it reaches the maximum + * @param wrap should the factory wrap when it reaches the maximum * long value (or throw an IllegalStateException) * @param initialValue the initial long value to start at * @return a new identifier factory @@ -198,8 +197,7 @@ public static LongIdentifierFactory longIdentifierFactory(boolean wrap, long ini /** *

    Gets the next identifier using the singleton instance of the - * String Numeric factory. - *

    + * String Numeric factory.

    * *

    The singleton instance will wrap, so in a long-lived server, the id * may be duplicated.

    @@ -227,7 +225,7 @@ public static StringIdentifierFactory stringNumericIdentifierFactory() { *

    Gets a new identifier factory that returns a series of String objects * representing numbers increasing in size.

    * - * @param wrap should the factory wrap when it reaches the maximum + * @param wrap should the factory wrap when it reaches the maximum * long value (or throw an IllegalStateException) * @param initialValue the initial long value to start at * @return a new identifier factory @@ -240,8 +238,7 @@ public static StringIdentifierFactory stringNumericIdentifierFactory(boolean wra /** *

    Gets the next identifier using the singleton instance of the - * String Alphanumeric factory. - *

    + * String Alphanumeric factory.

    * *

    The singleton instance will wrap, so in a long-lived server, the id * may be duplicated.

    @@ -268,7 +265,7 @@ public static StringIdentifierFactory stringAlphanumericIdentifierFactory() { *

    Gets a new identifier factory that returns a series of String objects * representing numbers increasing in size in base-36.

    * - * @param wrap should the factory wrap when it reaches the maximum + * @param wrap should the factory wrap when it reaches the maximum * size (or throw an IllegalStateException) * @param size the number of characters the id should fill * @return a new identifier factory @@ -281,8 +278,7 @@ public static StringIdentifierFactory stringAlphanumericIdentifierFactory(boolea /** *

    Gets the next identifier using the singleton instance of the - * String Session factory. - *

    + * String Session factory.

    * *

    The generation routine is based on a random number and a counter * within a 2 second time interval.

    @@ -295,8 +291,7 @@ public static String nextStringSessionIdentifier() { /** *

    Gets a new identifier factory that returns a series of String objects - * that appear to be random and are suitable for use as session identifiers. - *

    + * that appear to be random and are suitable for use as session identifiers.

    * *

    The generation routine is based on a random number and a counter * within a 2 second time interval.

    @@ -310,8 +305,8 @@ public static StringIdentifierFactory stringSessionIdentifierFactory() { //--------------------------------------------------------------------------------- /** - * LongIdentifierFactory is an Identifier Factory - * that generates an incrementing number as a Long object. + *

    LongIdentifierFactory is an Identifier Factory + * that generates an incrementing number as a Long object.

    * * @author Stephen Colebourne */ @@ -323,9 +318,9 @@ private static class LongNumericIdentifierFactory implements LongIdentifierFacto private long count = 0; /** - * Constructor. + *

    Constructor.

    * - * @param wrap should the factory wrap when it reaches the maximum + * @param wrap should the factory wrap when it reaches the maximum * long value (or throw an exception) * @param initialValue the initial long value to start at */ @@ -336,7 +331,7 @@ private LongNumericIdentifierFactory(boolean wrap, long initialValue) { } /** - * Gets the next new identifier. + *

    Gets the next new identifier.

    * * @return a new identifier as a Long */ @@ -345,7 +340,7 @@ public Object nextIdentifier() { } /** - * Gets the next new identifier. + *

    Gets the next new identifier.

    * * @return a new identifier as a Long */ @@ -370,8 +365,8 @@ public Long nextLongIdentifier() { //--------------------------------------------------------------------------------- /** - * StringNumericIdentifierFactory is an Identifier Factory - * that generates an incrementing number as a String object. + *

    StringNumericIdentifierFactory is an Identifier Factory + * that generates an incrementing number as a String object.

    * * @author Stephen Colebourne */ @@ -383,9 +378,9 @@ private static class StringNumericIdentifierFactory implements StringIdentifierF private long count = 0; /** - * Constructor. + *

    Constructor.

    * - * @param wrap should the factory wrap when it reaches the maximum + * @param wrap should the factory wrap when it reaches the maximum * long value (or throw an exception) * @param initialValue the initial long value to start at */ @@ -396,7 +391,7 @@ private StringNumericIdentifierFactory(boolean wrap, long initialValue) { } /** - * Gets the next new identifier. + *

    Gets the next new identifier.

    * * @return a new identifier as a String */ @@ -405,7 +400,7 @@ public Object nextIdentifier() { } /** - * Gets the next new identifier. + *

    Gets the next new identifier.

    * * @return a new identifier as a String */ @@ -431,9 +426,9 @@ public String nextStringIdentifier() { //--------------------------------------------------------------------------------- /** - * StringAlphanumericIdentifierFactory is an Identifier Factory + *

    StringAlphanumericIdentifierFactory is an Identifier Factory * that generates an incrementing incrementing number in base 36 as a String - * object. + * object.

    * * @author Stephen Colebourne */ @@ -445,9 +440,9 @@ private static class StringAlphanumericIdentifierFactory implements StringIdenti private char[] count = null; /** - * Constructor. + *

    Constructor.

    * - * @param wrap should the factory wrap when it reaches the maximum + * @param wrap should the factory wrap when it reaches the maximum * long value (or throw an exception) * @param size the size of the identifier */ @@ -464,7 +459,7 @@ private StringAlphanumericIdentifierFactory(boolean wrap, int size) { } /** - * Gets the next new identifier. + *

    Gets the next new identifier.

    * * @return a new identifier as a String */ @@ -473,7 +468,7 @@ public Object nextIdentifier() { } /** - * Gets the next new identifier. + *

    Gets the next new identifier.

    * * @return a new identifier as a String */ @@ -547,14 +542,14 @@ private static class StringSessionIdentifierFactory implements StringIdentifierF private Random randomizer = new Random(); /** - * Constructor. + *

    Constructor.

    */ private StringSessionIdentifierFactory() { super(); } /** - * Gets the next identifier. + *

    Gets the next identifier.

    * * @return the next 10 char String identifier */ @@ -563,11 +558,13 @@ public Object nextIdentifier() { } /** - * Gets the next new identifier. Only guaranteed unique within - * this JVM, but fairly safe for cross JVM usage as well. + *

    Gets the next new identifier.

    + * + *

    Only guaranteed unique within this JVM, but fairly safe + * for cross JVM usage as well.

    * *

    Format of identifier is - * [6 chars random][3 chars time][1+ chars count]

    + * [6 chars random][3 chars time][1+ chars count]

    * * @return the next 10 char String identifier */ diff --git a/src/java/org/apache/commons/lang/util/Validate.java b/src/java/org/apache/commons/lang/util/Validate.java index e13a03385..e81db695d 100644 --- a/src/java/org/apache/commons/lang/util/Validate.java +++ b/src/java/org/apache/commons/lang/util/Validate.java @@ -70,7 +70,7 @@ * @author Ola Berg * @author Stephen Colebourne * @since 2.0 - * @version $Id: Validate.java,v 1.2 2003/03/23 17:52:25 scolebourne Exp $ + * @version $Id: Validate.java,v 1.3 2003/07/14 22:25:06 bayard Exp $ */ public class Validate { @@ -84,22 +84,25 @@ public Validate() { //--------------------------------------------------------------------------------- /** - *

    Validate an argument, throwing IllegalArgumentException if the test - * result is false. + *

    Validate an argument, throwing IllegalArgumentException + * if the test result is false.

    * *

    This is used when validating according to an arbitrary boolean expression, * such as validating a primitive number or using your own custom validation - * expression. + * expression.

    + * *
          * Validate.isTrue( myObject.isOk(), "The object is not OK: ", myObject);
          * 
    + * *

    For performance reasons, the object is passed as a separate parameter and - * appended to the message string only in the case of an error. + * appended to the message string only in the case of an error.

    * * @param expression a boolean expression - * @param message the exception message you would like to see if the expression is false + * @param message the exception message you would like to see if the + * expression is false * @param value the value to append to the message in case of error - * @throws IllegalArgumentException if expression is false + * @throws IllegalArgumentException if expression is false */ public static void isTrue(boolean expression, String message, Object value) { if (expression == false) { @@ -108,22 +111,24 @@ public static void isTrue(boolean expression, String message, Object value) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the test - * result is false. + *

    Validate an argument, throwing IllegalArgumentException + * if the test result is false.

    * *

    This is used when validating according to an arbitrary boolean expression, * such as validating a primitive number or using your own custom validation - * expression. + * expression.

    + * *
          * Validate.isTrue( i > 0, "The value must be greater than zero: ", i);
          * 
    + * *

    For performance reasons, the object is passed as a separate parameter and - * appended to the message string only in the case of an error. + * appended to the message string only in the case of an error.

    * * @param expression a boolean expression - * @param message the exception message you would like to see if the expression is false + * @param message the exception message you would like to see if the expression is false * @param value the value to append to the message in case of error - * @throws IllegalArgumentException if expression is false + * @throws IllegalArgumentException if expression is false */ public static void isTrue(boolean expression, String message, long value) { if (expression == false) { @@ -132,22 +137,25 @@ public static void isTrue(boolean expression, String message, long value) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the test - * result is false. + *

    Validate an argument, throwing IllegalArgumentException + * if the test result is false.

    * *

    This is used when validating according to an arbitrary boolean expression, * such as validating a primitive number or using your own custom validation - * expression. + * expression.

    + * *
          * Validate.isTrue( d > 0.0, "The value must be greater than zero: ", d);
          * 
    + * *

    For performance reasons, the object is passed as a separate parameter and - * appended to the message string only in the case of an error. + * appended to the message string only in the case of an error.

    * * @param expression a boolean expression - * @param message the exception message you would like to see if the expression is false + * @param message the exception message you would like to see if the expression + * is false * @param value the value to append to the message in case of error - * @throws IllegalArgumentException if expression is false + * @throws IllegalArgumentException if expression is false */ public static void isTrue(boolean expression, String message, double value) { if (expression == false) { @@ -156,22 +164,25 @@ public static void isTrue(boolean expression, String message, double value) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the test - * result is false. + *

    Validate an argument, throwing IllegalArgumentException + * if the test result is false.

    * *

    This is used when validating according to an arbitrary boolean expression, * such as validating a primitive number or using your own custom validation - * expression. + * expression.

    + * *
          * Validate.isTrue( (i > 0), "The value must be greater than zero");
          * Validate.isTrue( myObject.isOk(), "The object is not OK");
          * 
    + * *

    For performance reasons, the message string should not involve a string append, - * instead use the {@link #isTrue(boolean, String, Object)} method. + * instead use the {@link #isTrue(boolean, String, Object)} method.

    * * @param expression a boolean expression - * @param message the exception message you would like to see if the expression is false - * @throws IllegalArgumentException if expression is false + * @param message the exception message you would like to see if the expression + * is false + * @throws IllegalArgumentException if expression is false */ public static void isTrue(boolean expression, String message) { if (expression == false) { @@ -180,20 +191,22 @@ public static void isTrue(boolean expression, String message) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the test - * result is false. + *

    Validate an argument, throwing IllegalArgumentException + * if the test result is false.

    * *

    This is used when validating according to an arbitrary boolean expression, * such as validating a primitive number or using your own custom validation - * expression. + * expression.

    + * *
          * Validate.isTrue( i > 0 );
          * Validate.isTrue( myObject.isOk() );
          * 
    - *

    The message in the exception is 'The validated expression is false'. + * + *

    The message in the exception is 'The validated expression is false'.

    * * @param expression a boolean expression - * @throws IllegalArgumentException if expression is false + * @throws IllegalArgumentException if expression is false */ public static void isTrue(boolean expression) { if (expression == false) { @@ -205,15 +218,17 @@ public static void isTrue(boolean expression) { //--------------------------------------------------------------------------------- /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument is null. + *

    Validate an argument, throwing IllegalArgumentException + * if the argument is null.

    + * *
          * Validate.notNull(myObject, "The object must not be null");
          * 
    * - * @param object the object to check is not null - * @param message the exception message you would like to see if the object is null - * @throws IllegalArgumentException if the object is null + * @param object the object to check is not null + * @param message the exception message you would like to see + * if the object is null + * @throws IllegalArgumentException if the object is null */ public static void notNull(Object object, String message) { if (object == null) { @@ -222,15 +237,17 @@ public static void notNull(Object object, String message) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument is null. + *

    Validate an argument, throwing IllegalArgumentException + * if the argument is null.

    + * *
          * Validate.notNull(myObject);
          * 
    - *

    The message in the exception is 'The validated object is null'. + * + *

    The message in the exception is 'The validated object is null'.

    * - * @param object the object to check is not null - * @throws IllegalArgumentException if the object is null + * @param object the object to check is not null + * @throws IllegalArgumentException if the object is null */ public static void notNull(Object object) { if (object == null) { @@ -242,8 +259,9 @@ public static void notNull(Object object) { //--------------------------------------------------------------------------------- /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument array is empty (null or no elements). + *

    Validate an argument, throwing IllegalArgumentException + * if the argument array is empty (null or no elements).

    + * *
          * Validate.notEmpty(myArray, "The array must not be empty");
          * 
    @@ -259,11 +277,13 @@ public static void notEmpty(Object[] array, String message) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument array is empty (null or no elements). + *

    Validate an argument, throwing IllegalArgumentException + * if the argument array is empty (null or no elements).

    + * *
          * Validate.notEmpty(myArray);
          * 
    + * *

    The message in the exception is 'The validated array is empty'. * * @param array the array to check is not empty @@ -279,8 +299,9 @@ public static void notEmpty(Object[] array) { //--------------------------------------------------------------------------------- /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument Collection is empty (null or no elements). + *

    Validate an argument, throwing IllegalArgumentException + * if the argument Collection is empty (null or no elements).

    + * *
          * Validate.notEmpty(myCollection, "The collection must not be empty");
          * 
    @@ -296,12 +317,14 @@ public static void notEmpty(Collection collection, String message) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument Collection is empty (null or no elements). + *

    Validate an argument, throwing IllegalArgumentException + * if the argument Collection is empty (null or no elements).

    + * *
          * Validate.notEmpty(myCollection);
          * 
    - *

    The message in the exception is 'The validated collection is empty'. + * + *

    The message in the exception is 'The validated collection is empty'.

    * * @param collection the collection to check is not empty * @throws IllegalArgumentException if the collection is empty @@ -316,8 +339,9 @@ public static void notEmpty(Collection collection) { //--------------------------------------------------------------------------------- /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument Map is empty (null or no elements). + *

    Validate an argument, throwing IllegalArgumentException + * if the argument Map is empty (null or no elements).

    + * *
          * Validate.notEmpty(myMap, "The collection must not be empty");
          * 
    @@ -333,12 +357,14 @@ public static void notEmpty(Map map, String message) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument Map is empty (null or no elements). + *

    Validate an argument, throwing IllegalArgumentException + * if the argument Map is empty (null or no elements).

    + * *
          * Validate.notEmpty(myMap);
          * 
    - *

    The message in the exception is 'The validated map is empty'. + * + *

    The message in the exception is 'The validated map is empty'.

    * * @param map the map to check is not empty * @throws IllegalArgumentException if the map is empty @@ -353,8 +379,9 @@ public static void notEmpty(Map map) { //--------------------------------------------------------------------------------- /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument String is empty (null or zero length). + *

    Validate an argument, throwing IllegalArgumentException + * if the argument String is empty (null or zero length).

    + * *
          * Validate.notEmpty(myString, "The string must not be empty");
          * 
    @@ -370,12 +397,14 @@ public static void notEmpty(String string, String message) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument String is empty (null or zero length). + *

    Validate an argument, throwing IllegalArgumentException + * if the argument String is empty (null or zero length).

    + * *
          * Validate.notEmpty(myString);
          * 
    - *

    The message in the exception is 'The validated string is empty'. + * + *

    The message in the exception is 'The validated string is empty'.

    * * @param string the string to check is not empty * @throws IllegalArgumentException if the string is empty @@ -390,15 +419,19 @@ public static void notEmpty(String string) { //--------------------------------------------------------------------------------- /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument array has null elements or is null. + *

    Validate an argument, throwing IllegalArgumentException + * if the argument array has null elements or is + * null.

    + * *
          * Validate.notEmpty(myArray, "The array must not contain null elements");
          * 
    * * @param array the array to check - * @param message the exception message if the array has null elements - * @throws IllegalArgumentException if the array has null elements or is null + * @param message the exception message if the array has + * null elements + * @throws IllegalArgumentException if the array has null + * elements or is null */ public static void noNullElements(Object[] array, String message) { Validate.notNull(array); @@ -410,15 +443,19 @@ public static void noNullElements(Object[] array, String message) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument array has null elements or is null. + *

    Validate an argument, throwing IllegalArgumentException + * if the argument array has null elements or is + * null.

    + * *
          * Validate.notEmpty(myArray);
          * 
    - *

    The message in the exception is 'The validated array contains null element at index: '. + * + *

    The message in the exception is 'The validated array contains null element at index: '.

    * * @param array the array to check - * @throws IllegalArgumentException if the array has null elements or is null + * @throws IllegalArgumentException if the array has null + * elements or is null */ public static void noNullElements(Object[] array) { Validate.notNull(array); @@ -433,15 +470,19 @@ public static void noNullElements(Object[] array) { //--------------------------------------------------------------------------------- /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument collection has null elements or is null. + *

    Validate an argument, throwing IllegalArgumentException + * if the argument collection has null elements or is + * null.

    + * *
          * Validate.notEmpty(myCollection, "The collection must not contain null elements");
          * 
    * * @param collection the collection to check - * @param message the exception message if the array has null elements - * @throws IllegalArgumentException if the collection has null elements or is null + * @param message the exception message if the array has + * null elements + * @throws IllegalArgumentException if the collection has + * null elements or is null */ public static void noNullElements(Collection collection, String message) { Validate.notNull(collection); @@ -454,15 +495,19 @@ public static void noNullElements(Collection collection, String message) { } /** - *

    Validate an argument, throwing IllegalArgumentException if the - * argument collection has null elements or is null. + *

    Validate an argument, throwing IllegalArgumentException + * if the argument collection has null elements or is + * null.

    + * *
          * Validate.notEmpty(myCollection);
          * 
    - *

    The message in the exception is 'The validated collection contains null element at index: '. + * + *

    The message in the exception is 'The validated collection contains null element at index: '.

    * * @param collection the collection to check - * @throws IllegalArgumentException if the collection has null elements or is null + * @throws IllegalArgumentException if the collection has + * null elements or is null */ public static void noNullElements(Collection collection) { Validate.notNull(collection);