Javadoc fixes and enhancements from Steve Downey

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137070 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2002-09-28 10:34:54 +00:00
parent 34d80b34e3
commit 031ff96cd3
5 changed files with 26 additions and 13 deletions

View File

@ -63,14 +63,16 @@ import java.util.LinkedList;
* *
* @author <a href="bayard@generationjava.com">Henri Yandell</a> * @author <a href="bayard@generationjava.com">Henri Yandell</a>
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @version $Id: CharSet.java,v 1.1 2002/07/19 03:35:54 bayard Exp $ * @version $Id: CharSet.java,v 1.2 2002/09/28 10:34:54 scolebourne Exp $
*/ */
public class CharSet { public class CharSet {
private LinkedList set = new LinkedList(); private LinkedList set = new LinkedList();
/** /**
* Restricted consructor. Use the factory method evaluateSet(). * Restricted constructor. Use the factory method evaluateSet().
*
* @throws NullPointerException if any of set[i] is null or if set is null
*/ */
protected CharSet(String[] set) { protected CharSet(String[] set) {
int sz = set.length; int sz = set.length;
@ -107,6 +109,7 @@ public class CharSet {
* Add a set definition string to the set * Add a set definition string to the set
* *
* @param str set definition string * @param str set definition string
* @throws NullPointerException if str is null
*/ */
protected void add(String str) { protected void add(String str) {
int sz = str.length(); int sz = str.length();

View File

@ -63,7 +63,7 @@ import java.util.LinkedList;
* *
* @author <a href="bayard@generationjava.com">Henri Yandell</a> * @author <a href="bayard@generationjava.com">Henri Yandell</a>
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @version $Id: CharSetUtils.java,v 1.4 2002/09/18 19:55:32 scolebourne Exp $ * @version $Id: CharSetUtils.java,v 1.5 2002/09/28 10:34:54 scolebourne Exp $
*/ */
public class CharSetUtils { public class CharSetUtils {
@ -84,6 +84,11 @@ public class CharSetUtils {
* "^e" implies not e. However it only negates, it's not * "^e" implies not e. However it only negates, it's not
* a set in itself due to the size of that set in unicode. * a set in itself due to the size of that set in unicode.
* "ej-m" implies e,j->m. e,j,k,l,m. * "ej-m" implies e,j->m. e,j,k,l,m.
* @param set
* @return CharSet
* @throws NullPointerException if any of set[i] is null or if set is null
* @param set
* @return CharSet
*/ */
public static CharSet evaluateSet(String[] set) { public static CharSet evaluateSet(String[] set) {
return new CharSet(set); return new CharSet(set);
@ -112,6 +117,7 @@ public class CharSetUtils {
* *
* @param str the string to work from * @param str the string to work from
* @param set the character set to use for manipulation * @param set the character set to use for manipulation
* @throws NullPointerException if str is null
*/ */
public static String squeeze(String str, String[] set) { public static String squeeze(String str, String[] set) {
CharSet chars = evaluateSet(set); CharSet chars = evaluateSet(set);
@ -189,6 +195,7 @@ public class CharSetUtils {
* *
* @param str String target to delete characters from * @param str String target to delete characters from
* @param set String[] set of characters to delete * @param set String[] set of characters to delete
* @throws NullPointerException of str is null
*/ */
public static String delete(String str, String[] set) { public static String delete(String str, String[] set) {
CharSet chars = evaluateSet(set); CharSet chars = evaluateSet(set);
@ -204,7 +211,6 @@ public class CharSetUtils {
} }
/** /**
* NEEDS TO TAKE A CHAR-SET.
* Translate characters in a String. * Translate characters in a String.
* An example is: translate("hello", "ho", "jy") => jelly * An example is: translate("hello", "ho", "jy") => jelly
* If the length of characters to search for is greater than the * If the length of characters to search for is greater than the
@ -214,6 +220,7 @@ public class CharSetUtils {
* @param target String to replace characters in * @param target String to replace characters in
* @param repl String to find that will be replaced * @param repl String to find that will be replaced
* @param with String to put into the target String * @param with String to put into the target String
* @throws NullPointerException if target, with or repl is null
*/ */
public static String translate(String target, String repl, String with) { public static String translate(String target, String repl, String with) {
StringBuffer buffer = new StringBuffer(target.length()); StringBuffer buffer = new StringBuffer(target.length());

View File

@ -63,7 +63,7 @@ import java.math.BigDecimal;
* @author <a href="mailto:rand_mcneely@yahoo.com">Rand McNeely</a> * @author <a href="mailto:rand_mcneely@yahoo.com">Rand McNeely</a>
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @author <a href="mailto:steve.downey@netfolio.com">Steve Downey</a> * @author <a href="mailto:steve.downey@netfolio.com">Steve Downey</a>
* @version $Id: NumberUtils.java,v 1.2 2002/09/15 10:26:42 scolebourne Exp $ * @version $Id: NumberUtils.java,v 1.3 2002/09/28 10:34:54 scolebourne Exp $
*/ */
public final class NumberUtils { public final class NumberUtils {
@ -491,8 +491,8 @@ public final class NumberUtils {
* <li>Normal positve numbers * <li>Normal positve numbers
* <li>+0.0 * <li>+0.0
* <li>-0.0 * <li>-0.0
* <li>Minimum double (-Double.MAX_VALUE)
* <li>Normal negative numbers * <li>Normal negative numbers
* <li>Minimum double (-Double.MAX_VALUE)
* <li>Negative infinity * <li>Negative infinity
* </ul> * </ul>
* Comparing NaN with NaN will return 0. * Comparing NaN with NaN will return 0.

View File

@ -63,7 +63,7 @@ import java.util.Random;
* @author <a href="mailto:bayard@generationjava.com">Henri Yandell</a> * @author <a href="mailto:bayard@generationjava.com">Henri Yandell</a>
* @author <a href="mailto:steven@caswell.name">Steven Caswell</a> * @author <a href="mailto:steven@caswell.name">Steven Caswell</a>
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @version $Id: RandomStringUtils.java,v 1.4 2002/09/18 19:53:52 bayard Exp $ * @version $Id: RandomStringUtils.java,v 1.5 2002/09/28 10:34:54 scolebourne Exp $
*/ */
public class RandomStringUtils { public class RandomStringUtils {
@ -178,6 +178,12 @@ public class RandomStringUtils {
/** /**
* Creates a random string based on a variety of options. * Creates a random string based on a variety of options.
* If start and end are both 0, start and end are set to ' ' and 'z', the ASCII
* printable characters, will be used, unless letters and numbers are both
* false, in which case, start and end are set to 0 and Integer.MAX_VALUE.
* <p>
* If set is not null, characters between start and end are chosen.
* <p>
* *
* @param count int length of random string to create * @param count int length of random string to create
* @param start int position in set of chars to start at * @param start int position in set of chars to start at
@ -187,6 +193,8 @@ public class RandomStringUtils {
* @param set char[] set of chars to choose randoms from. * @param set char[] set of chars to choose randoms from.
* If null, then it will use the set of all chars. * If null, then it will use the set of all chars.
* @return the random string * @return the random string
* @throws ArrayIndexOutOfBoundsException if there are not (end - start) + 1
* characters in the set array.
*/ */
public static String random(int count, int start, int end, boolean letters, boolean numbers, char[] set) { public static String random(int count, int start, int end, boolean letters, boolean numbers, char[] set) {
if( (start == 0) && (end == 0) ) { if( (start == 0) && (end == 0) ) {

View File

@ -73,15 +73,10 @@ import java.util.Iterator;
* @author <a href="mailto:rand_mcneely@yahoo.com>Rand McNeely</a> * @author <a href="mailto:rand_mcneely@yahoo.com>Rand McNeely</a>
* @author <a href="mailto:scolebourne@joda.org>Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org>Stephen Colebourne</a>
* @author <a href="mailto:fredrik@westermarck.com>Fredrik Westermarck</a> * @author <a href="mailto:fredrik@westermarck.com>Fredrik Westermarck</a>
* @version $Id: StringUtils.java,v 1.15 2002/09/27 06:08:16 bayard Exp $ * @version $Id: StringUtils.java,v 1.16 2002/09/28 10:34:54 scolebourne Exp $
*/ */
public class StringUtils { public class StringUtils {
/**
* The size of the buffer to use when working with I/O (4 kB).
*/
public static final int CHAR_BUFFER_SIZE = 4 * 1024;
/** /**
* StringUtils instances should NOT be constructed in standard programming. * StringUtils instances should NOT be constructed in standard programming.
* Instead, the class should be used as <code>StringUtils.trim(" foo ");</code>. * Instead, the class should be used as <code>StringUtils.trim(" foo ");</code>.