net.sourceforge.cobertura.javancss.ccl
Class Util

java.lang.Object
  extended by net.sourceforge.cobertura.javancss.ccl.Util

public class Util
extends java.lang.Object

A general purpose class with a variety of support and convenience methods.

There are different groups of methods in this class:

print methods - convenience methods for System.out.print etc. that additionally make sure output is gets flushed immediately.
string methods
string/vector converter methods
miscellaneous methods

Some basic but none the less the most used methods by myself are:
- isEmpty
- stringToLines
- sleep

Author:
Chr. Clemens Lee < clemens@kclee.com >

Field Summary
private static boolean _bDebug
           
static java.lang.Object CONSTANT_OBJECT
           
 
Constructor Summary
private Util()
          This is an utility class, there is (should be) no need for an instance of this class.
 
Method Summary
static java.util.Vector concat(java.util.Vector vFirst_, java.util.Vector vSecond_)
           
static void debug(java.lang.Object oMessage_)
           
static java.lang.Object getConstantObject()
           
static boolean isDebug()
           
static boolean isEmpty(java.lang.String sTest_)
          Tests, if a given String equals null or "".
static void panicIf(boolean bPanic_)
          panicIf <=> not assert.
static void panicIf(boolean bPanic_, java.lang.String sMessage_)
          panicIf <=> not assert.
static void printErr(char c_)
           
static void printErr(java.lang.String pString_)
           
static void println(java.lang.String pString_)
           
static void printlnErr()
           
static void printlnErr(java.lang.String sMessage_)
           
static void setDebug(boolean bDebug_)
           
private static void sleep(int seconds_)
          Current thread sleeps in seconds.
static java.util.Vector<java.lang.Object> sort(java.util.Vector<java.lang.Object> input)
           
private static java.util.Vector stringToLines(int lines_, java.lang.String pString_, char cCutter_)
          This function takes a String and separates it into different lines.
static java.util.Vector stringToLines(java.lang.String pString_)
          This function takes a String and separates it into different lines.
static java.util.Vector stringToLines(java.lang.String pString_, char cCutter_)
          This function takes a String and separates it into different lines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSTANT_OBJECT

public static final java.lang.Object CONSTANT_OBJECT

_bDebug

private static boolean _bDebug
Constructor Detail

Util

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

Method Detail

panicIf

public static void panicIf(boolean bPanic_)
panicIf <=> not assert. Throws ApplicationException if true. It's not necessary to catch this exception.


panicIf

public static void panicIf(boolean bPanic_,
                           java.lang.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.

isEmpty

public static boolean isEmpty(java.lang.String sTest_)
Tests, if a given String equals null or "".


stringToLines

private static java.util.Vector stringToLines(int lines_,
                                              java.lang.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.

stringToLines

public static java.util.Vector stringToLines(java.lang.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.

stringToLines

public static java.util.Vector stringToLines(java.lang.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.

sleep

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


concat

public static java.util.Vector concat(java.util.Vector vFirst_,
                                      java.util.Vector vSecond_)

sort

public static java.util.Vector<java.lang.Object> sort(java.util.Vector<java.lang.Object> input)

debug

public static void debug(java.lang.Object oMessage_)

getConstantObject

public static java.lang.Object getConstantObject()

setDebug

public static void setDebug(boolean bDebug_)

isDebug

public static boolean isDebug()

println

public static void println(java.lang.String pString_)

printErr

public static void printErr(char c_)

printErr

public static void printErr(java.lang.String pString_)

printlnErr

public static void printlnErr()

printlnErr

public static void printlnErr(java.lang.String sMessage_)