All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class ccl.util.Util

java.lang.Object
   |
   +----ccl.util.Util

public class Util
extends Object
A general purpose class.

There are different groups of methods in this class:

debug and assertion methods
print methods - convenience methods for System.out.print etc. that additionally make sure output is gets flushed immediately.
basic converter methods
string methods
string/vector converter methods
vector methods
sorting and inserting methods
system methods
date methods
random generator methods
miscellaneous methods

Potential candidate classes to move some code over to are: StringUtil, VectorUtil, SystemUtil, and maybe Debug.

Version:
$Id: Util.java 1.63 2000/05/14 14:48:51 clemens Exp clemens $
Author:
Chr. Clemens Lee < clemens@kclee.com >

Variable Index

 o _acUmlaut
 o _bDebug
Used to store the debug state.
 o _bNochKeinIntSwap
 o _bNochKeinSwap
 o _objSwap
 o _rnd
 o _swap
 o O_CONSTANT
This could be also private and instead you would have to use getConstantObject(), but yet you have the choice.

Constructor Index

 o Util()
This is an utility class, there is (should be) no need for an instance of this class.

Method Index

 o assert(boolean)
Most people are used to assertions.
 o assert(Object)
Assert pObject is not null.
 o atob(String)
Converts a String to a boolean.
 o atof(String)
String to float converter.
 o atoi(String)
String to int converter.
 o btoi(byte)
Converts a byte to an int. Deprecated.
 o bytesToInt(byte[])
Converts a byte array into an int.
 o byteToChar(byte)
Converts a byte to a char.
 o byteToInt(byte)
Converts a byte to an int.
 o byteToString(byte)
Converts a byte to a String.
 o compare(String, String)
If you believe it or not, in a very old jdk version there was a bug in String.compareTo(String) and I did need this as a workaround. Deprecated.
 o concat(String, char)
This function concatenates a String with a char.
 o concat(Vector)
This function concatenates different Strings into one String.
 o concat(Vector, char)
This function concatenates different Strings into one String.
 o concat(Vector, String)
This function concatenates different Strings into one String.
 o concat(Vector, Vector)
Create a new vector which consists of both given vectors.
 o contains(String, String)
Deprecated.
 o contains(Vector, String)
Test if a vector contains a given string.
 o contains(Vector, Testable)
Test if a vector contains an element which succeeds a given test filter.
 o count(String, char)
How many chars c_ contains the String pString_.
 o cToS(char)
A character to String converter.
 o debug(int)
If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.
 o debug(Object)
If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.
 o debug(Object, Object)
If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.
 o denullify(String)
Deprecated.
 o endsWith(String, char)
Tests if this string ends with the specified character.
 o endsWith(String, String)
Tests if this string ends with the second string.
 o enumerationToVector(Enumeration)
Convert an enumeration to a vector.
 o equals(Vector, Vector)
Do the elements of two vectors at the same position equal each other?
 o equalsCaseless(String, String)
Compares two strings.
 o filter(Vector, Object)
All object in this vector which equal the bad element are not copied over to the resulting vector.
 o filter(Vector, Testable)
Create a new vector and copy all elements of the pVector_ paramter over which are accepted by the test filter.
 o filter(Vector, Vector)
All object in this vector which equal an object in the bad vector are not copied over to the resulting vector.
 o firstCharToLowerCase(String)
Returns the given string with the first char converted to lower case.
 o firstCharToUpperCase(String)
Returns the given string with the first char converted to upper case.
 o gc()
System.gc() does not always garanty immediate execution.
 o getCalendar()
 o getCalendar(String)
This is a replacement of the SimpleTimeZone.getTimeZone(String) function that additionally creates a GregorianCalendar of the given timezone.
 o getConstantObject()
Sometimes you need a dummy object just to have any value for a hashtable or so and it doesn't matter at all if we always use the same object, so here is one you can use without wasting extra memory.
 o getDate(Calendar)
 o getDate(String)
For example: 1999-11-26.
 o getHeuteSortable()
Deprecated.
 o getLocalHostName()
Get the name of the localhost.
 o getObjectName(Object)
pObject_.getClass().getName() returns the name including its package.
 o getOccurances(String, int)
Count how often a string contains a special char.
 o getSpaces(int)
Returns a String which consists only of spaces and has the lenght 'length_' or which is empty if length_ equals zero.
 o getStandardDate(Date)
 o getTime(Calendar)
 o getTime(Date)
 o getTodaySortable()
 o indexOfNot(String, char)
 o indexOfNot(String, char, int)
 o insert(Vector, int, int, Object, Comparable)
Inert a new object into a vector and keep the vector sorted.
 o insert(Vector, Object, Comparable)
Inert a new object into a vector and keep the vector sorted.
 o insert(Vector, Vector, int)
Insert at a special offset all elements of the second vector into the first vector.
 o intToBytes(int)
Converts an int into a byte array.
 o invert(Vector)
Create a new vector and invert the order of the elements.
 o isAlpha(char)
 o isDateValid(String)
 o isDigit(char)
Return true for digit characters.
 o isEmpty(String)
Tests, if a given String equals null or "".
 o isEmpty(Vector)
Tests, if a given Vector is null or has size 0.
 o isOSLinux()
Returns true if the current operating system is Linux.
 o isOSSolaris()
Returns true if the current operating system is Sun Microsystem's Solaris.
 o isOSUnix()
Returns true if the current operating system is either Linux or Solaris.
 o isOSWindows()
Returns true if the current operating system is Microsoft Windows.
 o isSpaceLine(String)
Tests if a string contains only space, tab, and linefeed characters.
 o isSwingPackage(String)
Returns true if sFullPackageName_ is a swing package, either old com.sun.java.swing or new javax.swing convention.
 o isTrue(Boolean)
Boolean to boolean converter.
 o itoa(int)
Converts an int to a String.
 o ltoa(long)
Converts an long to a String.
 o ltrim(String)
Removes space, carriage, linefeed, and tab chars at the right side of a string.
 o map(Vector, Transformable)
Convert each element of the vector by a transformation object.
 o max(int, int)
 o max(long, long)
 o min(int, int)
 o multiplyChar(char, int)
Create a string by concatenating one char several times.
 o multiplyChar(String, int)
Create a string by concatenating one string several times.
 o objectsToVector(Object[])
Convert an array of objects to a vector.
 o paddWith(int, int, char)
Fill a string with a given char for alignment purposes.
 o paddWith(String, int, char)
Fill a string with a given char for alignment purposes.
 o paddWithSpace(double, int)
Fill a string with space chars for alignment purposes.
 o paddWithSpace(int, int)
Fill a string with space chars for alignment purposes.
 o paddWithSpace(long, int)
Fill a string with space chars for alignment purposes.
 o paddWithSpace(String, int)
Fill a string with space chars for alignment purposes.
 o paddWithZero(int, int)
Fill a string with zero chars for alignment purposes.
 o paddWithZero(long, int)
Fill a string with zero chars for alignment purposes.
 o paddWithZero(String, int)
Fill a string with zero chars for alignment purposes.
 o panicIf(boolean)
panicIf <=> not assert.
 o panicIf(boolean, String)
panicIf <=> not assert.
 o print(char)
Prints out a char to System.out.
 o print(Object)
Prints out the object to System.out.
 o print(String)
Prints out a String to System.out.
 o printErr(char)
Prints out a char to System.err.
 o printErr(Object)
Prints out the object to System.err.
 o printErr(String)
Prints out a String to System.err.
 o println()
Same as print('\n').
 o println(Exception)
Prints out the exception, its stack trace, and the current thread.
 o println(Object)
Prints out the object to System.out together with a new line.
 o println(String)
Prints out a String to System.out together with a new line.
 o printlnErr()
The same as println, except output goes to std err.
 o printlnErr(Object)
Prints out the object to System.err.
 o printlnErr(Object, Object)
Prints out a String with a prefix of the oClass_ class name to System.err.
 o printlnErr(String)
The same as println, except output goes to std err.
 o quickSort(Object[], int, int, Comparable)
An implementation of Quicksort using medians of 3 for partitions.
 o quickSort(Vector, int, int, Comparable)
An implementation of Quicksort using medians of 3 for partitions.
 o removeMultipleSpaces(String)
What the method name says.
 o replace(String, char, char)
Replaces all occurences of cOld_ in pString with cNew_.
 o replace(String, char, char, int)
Replaces all occurences of cOld_ in pString with cNew_.
 o replace(String, String, String)
Replaces all occurences of sOld_ in pString with sNew_.
 o replace(String, String, String, int)
Replaces all occurences of sOld_ in pString with sNew_.
 o rnd()
 o rnd(double)
Returns the a pseudorandom double number between 0.0 and excluding the provided double value.
 o rnd(float)
Returns the a pseudorandom float number between 0.0 and excluding the provided float value.
 o rnd(int)
Random number in the range [0, end_] (both inclusive).
 o rnd(int, int)
Random number in the range [start_, end_] (both inclusive).
 o rtrim(String)
Removes space, carriage, linefeed, and tab chars at the right side of a string.
 o setDate(Calendar, String)
 o setDebug(boolean)
Sets the debug mode for the running application.
 o setDebug(String)
Sets the debug mode for the running application.
 o setTime(Calendar, String)
 o showLiveSignal()
For batch applications to indicate progess to the user.
 o showLiveSignal(char)
For batch applications to indicate progess to the user.
 o sleep(int)
Current thread sleeps in seconds.
 o sort(Enumeration)
Quicksort for Enumeration.
 o sort(Enumeration, Comparable)
Quicksort for Enumeration.
 o sort(Vector)
Uses Quicksort using medians of 3 for partitions.
 o sort(Vector, Comparable)
Uses Quicksort using medians of 3 for partitions and the
 o sortCaseSensitive(Vector)
Uses Quicksort using medians of 3 for partitions
 o sortFast(Vector)
Uses Quicksort using medians of 3 for partitions.
 o sortFast(Vector, Comparable)
Like sort but works directly on the input vector.
 o stringToDate(String)
For example: 1999-11-26.
 o stringToLines(int, String)
This function takes a String and separates it into different lines.
 o stringToLines(int, String, char)
This function takes a String and separates it into different lines.
 o stringToLines(String)
This function takes a String and separates it into different lines.
 o stringToLines(String, char)
This function takes a String and separates it into different lines.
 o stringToLines(String, String)
This function takes a String and separates it into different lines.
 o stringToLines(String, String, boolean)
This function takes a String and separates it into different lines.
 o subtract(Vector, Vector)
Create a new vector through extracting all elements of the second vector from the first vector.
 o swap()
 o swap(Object, Object)
 o swapInt()
 o swapInt(int, int)
 o system(String)
This method does return immediately.
 o system(String[])
Execute an external command.
 o system(Vector)
Execute an external command.
 o systemAndGetError(Vector)
Does a system exec and returns the stderr output.
 o systemAndWait(Vector)
Does a system exec and returns the stdout.
 o toLowerCase(int)
Works with ints instead of chars.
 o toString(Object)
Before returning pObject_.toString() it checks if pObject_ is null.
 o toUpperCase(int)
Works with ints instead of chars.
 o toVector(Enumeration)
Enumeration to Vector converter.
 o unifySpaces(String)
Seems to do the same as 'removeMultipleSpaces(String)'.
 o vectorToObjects(Vector)
Convenience class for java.util.Vector.copyInto(..).

Variables

 o _rnd
 private static Random _rnd
 o _objSwap
 private static Object _objSwap
 o _bNochKeinSwap
 private static boolean _bNochKeinSwap
 o _swap
 private static int _swap
 o _bNochKeinIntSwap
 private static boolean _bNochKeinIntSwap
 o _acUmlaut
 private static final char _acUmlaut[]
 o _bDebug
 private static boolean _bDebug
Used to store the debug state. Can be changed during runtime for more flexibility. This is more important to me than speed.

 o O_CONSTANT
 public static final Object O_CONSTANT
This could be also private and instead you would have to use getConstantObject(), but yet you have the choice.

See Also:
getConstantObject

Constructors

 o Util
 private Util()
This is an utility class, there is (should be) no need for an instance of this class.

Methods

 o setDebug
 public static void setDebug(boolean bDebug_)
Sets the debug mode for the running application. When true, all following debug statements are equal to println statements, otherwise they are ignored.

See Also:
debug
 o setDebug
 public static void setDebug(String sDebug_)
Sets the debug mode for the running application. When true, all following debug statements are equal to printlnErr statements, otherwise they are ignored.

See Also:
debug
 o debug
 public static void debug(Object oMessage_)
If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.

See Also:
setDebug
 o debug
 public static void debug(int i)
If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.

See Also:
setDebug
 o debug
 public static void debug(Object oOriginator_,
                          Object oMessage_)
If the debug mode was set with the setDebug function to true, this debug statements is equal to a printlnErr statement, otherwise it will be ignored.

See Also:
setDebug, printlnErr
 o panicIf
 public static void panicIf(boolean bPanic_)
panicIf <=> not assert. Throws ApplicationException if true. It's not necessary to catch this exception.

See Also:
ApplicationException
 o panicIf
 public static void panicIf(boolean bPanic_,
                            String sMessage_)
panicIf <=> not assert. Throws ApplicationException if true. It's not necessary to catch this exception.

Parameters:
sMessage_ - The error message for the Exception.
See Also:
ApplicationException
 o assert
 public static void assert(boolean bAssert_)
Most people are used to assertions. But I once came up with panicIf(boolean) and that's what I still prefer to use.

 o assert
 public static void assert(Object pObject_)
Assert pObject is not null.

 o print
 public static void print(char c_)
Prints out a char to System.out.

 o print
 public static void print(String pString_)
Prints out a String to System.out.

 o print
 public static void print(Object pObject_)
Prints out the object to System.out.

 o println
 public static void println(String pString_)
Prints out a String to System.out together with a new line.

 o println
 public static void println(Exception e)
Prints out the exception, its stack trace, and the current thread.

 o println
 public static void println(Object pObject_)
Prints out the object to System.out together with a new line.

 o println
 public static void println()
Same as print('\n').

 o printErr
 public static void printErr(char c_)
Prints out a char to System.err.

 o printErr
 public static void printErr(String pString_)
Prints out a String to System.err.

 o printErr
 public static void printErr(Object pObject_)
Prints out the object to System.err.

 o printlnErr
 public static void printlnErr()
The same as println, except output goes to std err.

 o printlnErr
 public static void printlnErr(String sMessage_)
The same as println, except output goes to std err.

 o printlnErr
 public static void printlnErr(Object pObject_)
Prints out the object to System.err.

 o printlnErr
 public static void printlnErr(Object oClass_,
                               Object oMessage_)
Prints out a String with a prefix of the oClass_ class name to System.err.

 o showLiveSignal
 public static void showLiveSignal()
For batch applications to indicate progess to the user.

 o showLiveSignal
 public static void showLiveSignal(char c_)
For batch applications to indicate progess to the user.

Parameters:
c_ - The char that should be printed to stdout.
 o atoi
 public static int atoi(String pString_)
String to int converter.

 o itoa
 public static String itoa(int i_)
Converts an int to a String.

 o ltoa
 public static String ltoa(long l_)
Converts an long to a String.

 o atof
 public static float atof(String pString_)
String to float converter. An empty string gets converted to 0.0, while a string that is not adequately formatted results in NaN (not a number).

 o intToBytes
 public static byte[] intToBytes(int i_)
Converts an int into a byte array. First byte has the highest value.

See Also:
bytesToInt
 o bytesToInt
 public static int bytesToInt(byte abInt[])
Converts a byte array into an int. First byte has the highest value.

See Also:
intToBytes
 o byteToChar
 public static char byteToChar(byte b_)
Converts a byte to a char.

 o btoi
 public static int btoi(byte b_)
Note: btoi() is deprecated. Use byteToInt(byte) instead.

Converts a byte to an int.

 o byteToInt
 public static int byteToInt(byte b_)
Converts a byte to an int.

 o byteToString
 public static String byteToString(byte b_)
Converts a byte to a String.

 o cToS
 public static String cToS(char c_)
A character to String converter.

 o toUpperCase
 public static int toUpperCase(int character_)
Works with ints instead of chars.

 o toLowerCase
 public static int toLowerCase(int character_)
Works with ints instead of chars.

 o atob
 public static boolean atob(String pString_)
Converts a String to a boolean. It's true if the string consists of the word "true" ignoring case, otherwise it returns false.

Returns:
((pString_ != null) && pString_.toLowerCase().equals("true"));
 o isTrue
 public static boolean isTrue(Boolean pBoolean_)
Boolean to boolean converter.

Returns:
true if input is true, false otherwise or if input is null.
 o isEmpty
 public static boolean isEmpty(String sTest_)
Tests, if a given String equals null or "".

 o getOccurances
 public static int getOccurances(String source,
                                 int zeichen)
Count how often a string contains a special char.

 o multiplyChar
 public static String multiplyChar(char c,
                                   int anzahl)
Create a string by concatenating one char several times.

 o multiplyChar
 public static String multiplyChar(String sFill,
                                   int anzahl)
Create a string by concatenating one string several times. The method name should maybe renamed to multiplyString or something else.

 o getSpaces
 public static String getSpaces(int length_)
Returns a String which consists only of spaces and has the lenght 'length_' or which is empty if length_ equals zero.

 o paddWith
 public static String paddWith(int number_,
                               int stellen_,
                               char cPadd_)
Fill a string with a given char for alignment purposes.

 o paddWith
 public static String paddWith(String pString_,
                               int stellen_,
                               char cPadd_)
Fill a string with a given char for alignment purposes.

 o paddWithSpace
 public static String paddWithSpace(int number,
                                    int stellen)
Fill a string with space chars for alignment purposes.

 o paddWithSpace
 public static String paddWithSpace(long number,
                                    int stellen)
Fill a string with space chars for alignment purposes.

 o paddWithSpace
 public static String paddWithSpace(double dNumber_,
                                    int stellen)
Fill a string with space chars for alignment purposes.

 o paddWithSpace
 public static String paddWithSpace(String pString_,
                                    int stellen)
Fill a string with space chars for alignment purposes.

 o paddWithZero
 public static String paddWithZero(int number,
                                   int stellen)
Fill a string with zero chars for alignment purposes.

 o paddWithZero
 public static String paddWithZero(long number,
                                   int stellen)
Fill a string with zero chars for alignment purposes.

 o paddWithZero
 public static String paddWithZero(String sNumber_,
                                   int stellen_)
Fill a string with zero chars for alignment purposes.

 o removeMultipleSpaces
 public static String removeMultipleSpaces(String pString_)
What the method name says.

 o rtrim
 public static String rtrim(String s)
Removes space, carriage, linefeed, and tab chars at the right side of a string.

 o ltrim
 public static String ltrim(String s)
Removes space, carriage, linefeed, and tab chars at the right side of a string.

 o unifySpaces
 public static String unifySpaces(String s)
Seems to do the same as 'removeMultipleSpaces(String)'. One should become deprecated.

 o equalsCaseless
 public static boolean equalsCaseless(String sA_,
                                      String sB_)
Compares two strings. Upper or lower case characters are not considered differently.

 o firstCharToUpperCase
 public static String firstCharToUpperCase(String pString_)
Returns the given string with the first char converted to upper case.

 o firstCharToLowerCase
 public static String firstCharToLowerCase(String pString_)
Returns the given string with the first char converted to lower case.

 o endsWith
 public static boolean endsWith(String sThis_,
                                char cOther_)
Tests if this string ends with the specified character.

 o endsWith
 public static boolean endsWith(String pString_,
                                String sEnd_)
Tests if this string ends with the second string.

 o replace
 public static String replace(String pString_,
                              char cOld_,
                              char cNew_)
Replaces all occurences of cOld_ in pString with cNew_.

See Also:
replace
 o replace
 public static String replace(String pString_,
                              char cOld_,
                              char cNew_,
                              int startIndex_)
Replaces all occurences of cOld_ in pString with cNew_.

 o replace
 public static String replace(String pString_,
                              String sOld_,
                              String sNew_)
Replaces all occurences of sOld_ in pString with sNew_.

 o replace
 public static String replace(String pString_,
                              String sOld_,
                              String sNew_,
                              int startIndex_)
Replaces all occurences of sOld_ in pString with sNew_.

Parameters:
startIndex_ - The startindex_ gives the position in pString_ where the replace procedure should start.
 o isSpaceLine
 public static boolean isSpaceLine(String sLine_)
Tests if a string contains only space, tab, and linefeed characters.

 o denullify
 public static String denullify(String pString_)
Note: denullify() is deprecated. Use toString(Object) instead.

 o toString
 public static String toString(Object pObject_)
Before returning pObject_.toString() it checks if pObject_ is null. If so, "null" is returned.

 o contains
 public static int contains(String sToLookIn_,
                            String sThis_)
Note: contains() is deprecated. Well, String.indexOf(String) should be just fine!?

Returns:
-1 if sToLookIn_ does not contain sThis_. Otherwise the position is returned.
 o compare
 public static int compare(String firstString,
                           String anotherString)
Note: compare() is deprecated. Use String.compare instead.

If you believe it or not, in a very old jdk version there was a bug in String.compareTo(String) and I did need this as a workaround. This method should be of no use anymore [1999-07-15].

 o indexOfNot
 public static int indexOfNot(String pString_,
                              char cNot_,
                              int startIndex_)
Returns:
-1 means the string is either "" or contains just the char cNot_.
 o indexOfNot
 public static int indexOfNot(String pString_,
                              char cNot_)
Returns:
-1 means the string is either "" or contains just the char cNot_.
 o count
 public static int count(String pString_,
                         char c_)
How many chars c_ contains the String pString_.

 o isDigit
 public static boolean isDigit(char c_)
Return true for digit characters.

 o concat
 public static String concat(Vector pVector_)
This function concatenates different Strings into one String.

Parameters:
pVector_ - Contains the Strings that will be concatenated.
Returns:
There is no 'glue' between the Strings.
See Also:
stringToLines
 o concat
 public static String concat(Vector pVector_,
                             String sWith_)
This function concatenates different Strings into one String.

Parameters:
pVector_ - Contains the Strings that will be concatenated.
sWidth_ - The 'glue' for the other Strings.
Returns:
sWith_ is not appended at the end.
See Also:
stringToLines
 o concat
 public static String concat(Vector pVector_,
                             char cWith_)
This function concatenates different Strings into one String.

Parameters:
pVector_ - Contains the Strings that will be concatenated.
cWidth_ - The 'glue' for the other Strings.
Returns:
cWith_ is not appended at the end.
See Also:
stringToLines
 o concat
 public static String concat(String pString_,
                             char cWidth_)
This function concatenates a String with a char.

 o stringToLines
 public static Vector stringToLines(int lines_,
                                    String pString_,
                                    char cCutter_)
This function takes a String and separates it into different lines. The last line does not need to have a separator character.

Parameters:
lines_ - The number of lines that should be extracted. Zero if maximum number of lines is requested.
cCutter_ - The character that separates pString_ into different lines
Returns:
The single lines do not contain the cCutter_ character at the end.
 o stringToLines
 public static Vector stringToLines(String pString_,
                                    char cCutter_)
This function takes a String and separates it into different lines. The last line does not need to have a separator character.

Parameters:
cCutter_ - The character that separates pString_ into different lines
Returns:
The single lines do not contain the cCutter_ character at the end.
See Also:
concat
 o stringToLines
 public static Vector stringToLines(String pString_)
This function takes a String and separates it into different lines. The last line does not need to have a '\n'. The function can't handle dos carriage returns.

Returns:
The single lines do not contain the '\n' character at the end.
 o stringToLines
 public static Vector stringToLines(int lines_,
                                    String pString_)
This function takes a String and separates it into different lines. The last line does not need to have a '\n'. The function can't handle dos carriage returns.

Parameters:
lines_ - The number of lines that should be extracted. Zero if maximum number of lines is requested.
cCutter_ - The character that separates pString_ into different lines
Returns:
The single lines do not contain the cCutter_ character at the end.
See Also:
concat
 o stringToLines
 public static Vector stringToLines(String sLines_,
                                    String sCutter_)
This function takes a String and separates it into different lines. The last line does not need to have a separator string.

Returns:
Note that the sCutter_ string will be removed from each line.
See Also:
concat
 o stringToLines
 public static Vector stringToLines(String sLines_,
                                    String sTokenizerString_,
                                    boolean bUseTokenizer_)
This function takes a String and separates it into different lines. The last line does not need to have a separator string.

See Also:
concat
 o isEmpty
 public static boolean isEmpty(Vector vTest_)
Tests, if a given Vector is null or has size 0.

 o toVector
 public static Vector toVector(Enumeration pEnumeration_)
Enumeration to Vector converter.

Returns:
null in empty vector out
 o objectsToVector
 public static Vector objectsToVector(Object apObjects[])
Convert an array of objects to a vector.

 o vectorToObjects
 public static Object[] vectorToObjects(Vector pVector_)
Convenience class for java.util.Vector.copyInto(..).

Parameters:
pVector_ - the vector to convert into an array.
Returns:
Never returns null, returns at least an array of length 0.
 o filter
 public static Vector filter(Vector pVector_,
                             Object oBadElement_)
All object in this vector which equal the bad element are not copied over to the resulting vector.

 o filter
 public static Vector filter(Vector pVector_,
                             Vector vBadElements_)
All object in this vector which equal an object in the bad vector are not copied over to the resulting vector.

 o filter
 public static Vector filter(Vector pVector_,
                             Testable pFilter_)
Create a new vector and copy all elements of the pVector_ paramter over which are accepted by the test filter.

 o map
 public static Vector map(Vector pVector_,
                          Transformable pTransformable_)
Convert each element of the vector by a transformation object.

 o contains
 public static boolean contains(Vector pVector_,
                                String sFind_)
Test if a vector contains a given string.

 o contains
 public static boolean contains(Vector pVector_,
                                Testable pFilter_)
Test if a vector contains an element which succeeds a given test filter.

 o enumerationToVector
 public static Vector enumerationToVector(Enumeration pEnumeration_)
Convert an enumeration to a vector. Sometimes you have an enumeration at hand, which you want to use more than once.

 o concat
 public static Vector concat(Vector vFirst_,
                             Vector vSecond_)
Create a new vector which consists of both given vectors.

 o subtract
 public static Vector subtract(Vector vSource_,
                               Vector vToDelete_)
Create a new vector through extracting all elements of the second vector from the first vector.

 o insert
 public static Vector insert(Vector vDestination_,
                             Vector vOther_,
                             int destination)
Insert at a special offset all elements of the second vector into the first vector. The input vectors are not changed but a new result vector gets created.

 o equals
 public static boolean equals(Vector vFirst_,
                              Vector vSecond_)
Do the elements of two vectors at the same position equal each other?

 o invert
 public static Vector invert(Vector vSource_)
Create a new vector and invert the order of the elements.

 o quickSort
 public static void quickSort(Object s[],
                              int lo,
                              int hi,
                              Comparable cmp)
An implementation of Quicksort using medians of 3 for partitions. Used internally by sort. It is public and static so it can be used to sort plain arrays as well. Originally written by Doug Lea and released into the public domain. Thanks for the assistance and support of Sun Microsystems Labs, Agorics Inc, Loral, and everyone contributing, testing, and using this code. History: Date Who What 2Oct95 dl@cs.oswego.edu refactored from DASeq.java 13Oct95 dl Changed protection statuses

Parameters:
s, - the array to sort
lo, - the least index to sort from
hi, - the greatest index
cmp, - the comparator to use for comparing elements
 o quickSort
 public static void quickSort(Vector v,
                              int lo,
                              int hi,
                              Comparable cmp)
An implementation of Quicksort using medians of 3 for partitions. Used internally by sort. It is public and static so it can be used to sort plain arrays as well. Originally written by Doug Lea and released into the public domain. Thanks for the assistance and support of Sun Microsystems Labs, Agorics Inc, Loral, and everyone contributing, testing, and using this code. History: Date Who What 2Oct95 dl@cs.oswego.edu refactored from DASeq.java 13Oct95 dl Changed protection statuses 30Apr97 Clemens.Lahme@gmd.de For use with Vector

Parameters:
v, - the vector to sort
lo, - the least index to sort from
hi, - the greatest index
cmp, - the comparator to use for comparing elements
 o sort
 public static Vector sort(Vector vInput_,
                           Comparable pComparable_)
Uses Quicksort using medians of 3 for partitions and the

 o sortFast
 public static void sortFast(Vector vInput_,
                             Comparable pComparable_)
Like sort but works directly on the input vector.

 o sort
 public static Vector sort(Vector pVector_)
Uses Quicksort using medians of 3 for partitions.

 o sortFast
 public static void sortFast(Vector pVector_)
Uses Quicksort using medians of 3 for partitions.

 o sort
 public static Vector sort(Enumeration pEnumeration_)
Quicksort for Enumeration.

Returns:
null in empty vector out
 o sort
 public static Vector sort(Enumeration pEnumeration_,
                           Comparable pComparable_)
Quicksort for Enumeration.

Returns:
null in empty vector out
 o sortCaseSensitive
 public static Vector sortCaseSensitive(Vector pVector_)
Uses Quicksort using medians of 3 for partitions

 o insert
 public static int insert(Vector pVector_,
                          int lowestOffset_,
                          int highestOffset_,
                          Object pObject_,
                          Comparable pComparable_)
Inert a new object into a vector and keep the vector sorted.

 o insert
 public static int insert(Vector pVector_,
                          Object pObject_,
                          Comparable pComparable_)
Inert a new object into a vector and keep the vector sorted.

 o system
 public static Process system(String sCommand_) throws IOException
This method does return immediately. If you want the output of the process use either systemAndWait() or systemAndGetError().

Throws: IOException
Whatever can go wrong.
See Also:
systemAndWait, systemAndGetError
 o system
 public static Process system(String asCommand_[]) throws IOException
Execute an external command.

Throws: IOException
Whatever Runtime.exec(..) throws.
 o system
 public static Process system(Vector vArgs_) throws IOException
Execute an external command. Provide arguments inside a vector.

Throws: IOException
Whatever Runtime.exec(..) throws.
 o systemAndWait
 public static String systemAndWait(Vector vArgs_) throws IOException
Does a system exec and returns the stdout.

Parameters:
vArgs_ - the arguments to system.exec(). Should not be null or empty.
Returns:
The standard output.
Throws: IOException
Whatever might go wrong.
 o systemAndGetError
 public static String systemAndGetError(Vector vArgs_) throws IOException
Does a system exec and returns the stderr output.

Parameters:
vArgs_ - the arguments to system.exec(). Should not be null or empty.
Returns:
The standard output.
Throws: IOException
Whatever might go wrong.
 o isOSWindows
 public static boolean isOSWindows()
Returns true if the current operating system is Microsoft Windows.

 o isOSLinux
 public static boolean isOSLinux()
Returns true if the current operating system is Linux.

 o isOSSolaris
 public static boolean isOSSolaris()
Returns true if the current operating system is Sun Microsystem's Solaris.

 o isOSUnix
 public static boolean isOSUnix()
Returns true if the current operating system is either Linux or Solaris.

 o gc
 public static void gc()
System.gc() does not always garanty immediate execution. This method does also a yield for a bigger chance that gc really does happen.

 o getLocalHostName
 public static String getLocalHostName()
Get the name of the localhost.

 o isSwingPackage
 public static boolean isSwingPackage(String sFullPackageName_)
Returns true if sFullPackageName_ is a swing package, either old com.sun.java.swing or new javax.swing convention. Accessibilitiy is also considered to be a swing package.

 o rnd
 public static boolean rnd()
Returns:
50% chance of either true or false.
 o rnd
 public static int rnd(int end_)
Random number in the range [0, end_] (both inclusive).

 o rnd
 public static int rnd(int start_,
                       int end_)
Random number in the range [start_, end_] (both inclusive).

 o rnd
 public static float rnd(float f)
Returns the a pseudorandom float number between 0.0 and excluding the provided float value.

 o rnd
 public static double rnd(double df)
Returns the a pseudorandom double number between 0.0 and excluding the provided double value.

 o getStandardDate
 public static String getStandardDate(Date pDate_)
Returns:
1998-12-06 for example.
 o getDate
 public static String getDate(Calendar pCalendar_)
Returns:
1998-12-06 for example.
 o getTime
 public static String getTime(Date pDate_)
Returns:
hh:mm:ss
 o getTime
 public static String getTime(Calendar pCalendar_)
Returns:
hh:mm:ss
 o stringToDate
 public static Date stringToDate(String sDate_)
For example: 1999-11-26. Time is undefined and can have every value.

Returns:
null on parse error.
 o getDate
 public static Calendar getDate(String sDate_)
For example: 1999-11-26. Time is undefined and can have every value.

Returns:
null on parse error.
 o getCalendar
 public static Calendar getCalendar(String sTimeZoneID_)
This is a replacement of the SimpleTimeZone.getTimeZone(String) function that additionally creates a GregorianCalendar of the given timezone. There is a new timezone 'CET' (Central European Time. It has the official daylight saving time settings (ranging from the last Sunday in March at 2:00 am to the last Sunday in October at 2:00 am) and should be preferred over 'ECT'.

Parameters:
sTokenizerString_ - If it is null or "" then "GMT" is used.
 o getCalendar
 public static Calendar getCalendar()
Returns:
Calendar with local timezone
 o setTime
 public static void setTime(Calendar pCalendar_,
                            String sTime_)
Parameters:
sTime_ - e.g. 23:59:59
 o setDate
 public static void setDate(Calendar pCalendar_,
                            String sDate_)
Parameters:
sDate_ - e.g. 2000-01-26
 o isDateValid
 public static boolean isDateValid(String sDate_)
 o getHeuteSortable
 public static String getHeuteSortable()
Note: getHeuteSortable() is deprecated.

See Also:
getTodaySortable
 o getTodaySortable
 public static String getTodaySortable()
 o getConstantObject
 public static Object getConstantObject()
Sometimes you need a dummy object just to have any value for a hashtable or so and it doesn't matter at all if we always use the same object, so here is one you can use without wasting extra memory.

 o sleep
 public static void sleep(int seconds_)
Current thread sleeps in seconds.

 o isAlpha
 public static boolean isAlpha(char c_)
 o max
 public static long max(long a_,
                        long b_)
 o max
 public static int max(int a_,
                       int b_)
 o min
 public static int min(int a_,
                       int b_)
 o swap
 public static Object swap(Object objFirst,
                           Object objSecond)
 o swap
 public static Object swap()
 o swapInt
 public static int swapInt(int first,
                           int second)
 o swapInt
 public static int swapInt()
 o getObjectName
 public static String getObjectName(Object pObject_)
pObject_.getClass().getName() returns the name including its package. This method returns just the name without its package.


All Packages  Class Hierarchy  This Package  Previous  Next  Index