|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.rapidminer.tools.Tools
public class Tools
Tools for RapidMiner.
| Field Summary | |
|---|---|
static java.lang.String[] |
availableTimeZoneNames
|
static java.lang.String[] |
FALSE_STRINGS
|
static java.lang.String |
RESOURCE_PREFIX
|
static int |
SYSTEM_TIME_ZONE
|
static java.lang.String[] |
TRUE_STRINGS
|
| Constructor Summary | |
|---|---|
Tools()
|
|
| Method Summary | |
|---|---|
static void |
addResourceSource(ResourceSource source)
Adds a new resource source. |
static boolean |
booleanValue(java.lang.String string,
boolean deflt)
|
static java.lang.Class |
classForName(java.lang.String className)
|
static java.lang.String |
classNameWOPackage(java.lang.Class c)
Returns the class name of the given class without the package information. |
static void |
copy(java.io.File srcPath,
java.io.File dstPath)
|
static void |
delete(java.io.File file)
|
static java.lang.String |
escapeXML(java.lang.String string)
Replaces angle brackets by html entities. |
static void |
findImplementationsInJar(java.lang.ClassLoader loader,
java.util.jar.JarFile jar,
java.lang.Class<?> superClass,
java.util.List<java.lang.String> implementations)
|
static void |
findImplementationsInJar(java.util.jar.JarFile jar,
java.lang.Class superClass,
java.util.List<java.lang.String> implementations)
|
static java.io.File |
findSourceFile(java.lang.StackTraceElement e)
|
static java.lang.String |
formatDate(java.util.Date date)
Format date as a short time string. |
static java.lang.String |
formatDateTime(java.util.Date date)
Format date as a short time string. |
static java.lang.String |
formatDuation(long milliseconds)
Format the given amount of milliseconds as a human readable string. |
static java.lang.String |
formatIntegerIfPossible(double value)
Returns a number string with no fraction digits if possible. |
static java.lang.String |
formatIntegerIfPossible(double value,
int numberOfDigits)
Returns a number string with no fraction digits if possible. |
static java.lang.String |
formatNumber(double value)
Returns a formatted string of the given number (number format with usually three fraction digits). |
static java.lang.String |
formatNumber(double value,
int numberOfDigits)
Returns a formatted string of the given number (uses the property rapidminer.gui.fractiondigits.numbers if the given number of digits is smaller than 0 (usually 3)). |
static java.lang.String |
formatPercent(double value)
Returns a formatted string of the given number (percent format with two fraction digits). |
static java.lang.String |
formatTime(java.util.Date date)
Format date as a short time string. |
static java.lang.String[] |
getAllTimeZones()
|
static java.nio.charset.Charset |
getDefaultEncoding()
This method tries to identify the encoding if a GUI is running and a process is defined. |
static java.io.File |
getFile(java.io.File parent,
java.lang.String name)
Creates a file relative to the given parent if name is not an absolute file name. |
static void |
getFirstToken(java.io.StreamTokenizer tokenizer)
Delivers the next token and skip empty lines. |
static void |
getLastToken(java.io.StreamTokenizer tokenizer,
boolean endOfFileOk)
Delivers the next token and checks if its the end of line. |
static java.lang.String |
getLineSeparator()
Returns the correct line separator for the current operating system. |
static java.lang.String |
getLineSeparators(int number)
Returns the correct line separator for the current operating system concatenated for the given number of times. |
static void |
getNextToken(java.io.StreamTokenizer tokenizer)
Delivers the next token and checks for an unexpected end of line or file. |
static java.util.Calendar |
getPreferredCalendar()
|
static java.util.TimeZone |
getPreferredTimeZone()
|
static int |
getPreferredTimeZoneIndex()
|
static java.io.BufferedReader |
getReader(java.io.File file,
java.nio.charset.Charset encoding)
This method checks if the given file is a Zip file containing one entry (in case of file extension .zip). |
static java.lang.String |
getRelativePath(java.io.File firstFile,
java.io.File secondFile)
Returns the relative path of the first file resolved against the second. |
static java.net.URL |
getResource(java.lang.ClassLoader loader,
java.lang.String name)
|
static java.net.URL |
getResource(java.lang.ClassLoader loader,
java.lang.String prefix,
java.lang.String name)
|
static java.net.URL |
getResource(java.lang.String name)
Returns the desired resource. |
static java.util.TimeZone |
getTimeZone(int index)
|
static boolean |
isEqual(double d1,
double d2)
Returns true if the difference between both numbers is smaller than IS_ZERO. |
static boolean |
isGreater(double d1,
double d2)
Returns true if the d1 is greater than d2 and they are not equal. |
static boolean |
isGreaterEqual(double d1,
double d2)
Returns true if the d1 is greater than d1 or both are equal, or if one of the values is NaN |
static boolean |
isLess(double d1,
double d2)
Returns true if the d1 is less than d2 and they are not equal. |
static boolean |
isLessEqual(double d1,
double d2)
Returns true if the d1 is less than d1 or both are equal. |
static boolean |
isNotEqual(double d1,
double d2)
Returns no isEqual(double, double). |
static boolean |
isZero(double d)
Returns isEqual(double, double) for d and 0. |
static java.lang.Process |
launchFileEditor(java.io.File file,
int line)
|
static java.lang.String[] |
mergeQuotedSplits(java.lang.String line,
java.lang.String[] splittedTokens,
java.lang.String quoteString)
Deprecated. Please use quotedSplit(String, Pattern, char, char) or quotedSplit(String, Pattern) instead |
static java.lang.String |
ordinalNumber(int n)
Returns the name for an ordinal number. |
static void |
prependResourceSource(ResourceSource source)
Adds a new resource source before the others. |
static java.lang.String[] |
quotedSplit(java.lang.String line,
java.util.regex.Pattern separatorPattern)
Splits the given line according to the given separator pattern while only those separators will be regarded not lying inside of a quoting string. |
static java.lang.String[] |
quotedSplit(java.lang.String line,
java.util.regex.Pattern separatorPattern,
char quotingChar,
char escapeChar)
Splits the given line according to the given separator pattern while only those separators will be regarded not lying inside of a quoting string. |
static java.lang.String |
readOutput(java.io.BufferedReader in)
Reads the output of the reader and delivers it as string. |
static java.lang.String |
readTextFile(java.io.File file)
|
static java.lang.String |
readTextFile(java.io.Reader r)
|
static java.lang.String |
removeAllLineSeparators(java.lang.String text)
Removes all possible line feed character combinations. |
static void |
sendEmail(java.lang.String address,
java.lang.String subject,
java.lang.String content)
Sends a mail to the given address, using the specified subject and contents. |
static void |
setFormatLocale(java.util.Locale locale)
|
static java.lang.String |
transformAllLineSeparators(java.lang.String text)
Replaces all possible line feed character combinations by "\n". |
static void |
waitForEOL(java.io.StreamTokenizer tokenizer)
Skips all tokens before next end of line (EOL). |
static void |
waitForProcess(Operator operator,
java.lang.Process process,
java.lang.String name)
Waits for process to die and writes log messages. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String RESOURCE_PREFIX
public static java.lang.String[] availableTimeZoneNames
public static final int SYSTEM_TIME_ZONE
public static final java.lang.String[] TRUE_STRINGS
public static final java.lang.String[] FALSE_STRINGS
| Constructor Detail |
|---|
public Tools()
| Method Detail |
|---|
public static void setFormatLocale(java.util.Locale locale)
public static java.lang.String[] getAllTimeZones()
public static java.util.TimeZone getTimeZone(int index)
public static java.util.TimeZone getPreferredTimeZone()
public static int getPreferredTimeZoneIndex()
public static java.util.Calendar getPreferredCalendar()
public static java.lang.String formatPercent(double value)
public static java.lang.String formatNumber(double value)
public static java.lang.String formatNumber(double value,
int numberOfDigits)
public static java.lang.String formatIntegerIfPossible(double value)
public static java.lang.String formatIntegerIfPossible(double value,
int numberOfDigits)
public static java.lang.String formatTime(java.util.Date date)
public static java.lang.String formatDate(java.util.Date date)
public static java.lang.String formatDateTime(java.util.Date date)
public static java.lang.String formatDuation(long milliseconds)
public static java.lang.String ordinalNumber(int n)
public static boolean isEqual(double d1,
double d2)
public static boolean isZero(double d)
isEqual(double, double) for d and 0.
public static boolean isNotEqual(double d1,
double d2)
isEqual(double, double).
public static boolean isGreater(double d1,
double d2)
public static boolean isGreaterEqual(double d1,
double d2)
public static boolean isLess(double d1,
double d2)
public static boolean isLessEqual(double d1,
double d2)
public static java.lang.String getLineSeparator()
public static java.lang.String getLineSeparators(int number)
public static java.lang.String transformAllLineSeparators(java.lang.String text)
public static java.lang.String removeAllLineSeparators(java.lang.String text)
public static java.lang.String classNameWOPackage(java.lang.Class c)
public static java.lang.String readOutput(java.io.BufferedReader in)
throws java.io.IOException
java.io.IOException
public static java.io.File getFile(java.io.File parent,
java.lang.String name)
public static java.io.BufferedReader getReader(java.io.File file,
java.nio.charset.Charset encoding)
throws java.io.IOException
java.io.IOExceptionpublic static java.nio.charset.Charset getDefaultEncoding()
RapidMiner.PROPERTY_RAPIDMINER_GENERAL_DEFAULT_ENCODING. If this is not
possible, this method just returns the default system encoding.
public static java.lang.String getRelativePath(java.io.File firstFile,
java.io.File secondFile)
throws java.io.IOException
java.io.IOException
public static void waitForProcess(Operator operator,
java.lang.Process process,
java.lang.String name)
throws OperatorException
OperatorException
public static void sendEmail(java.lang.String address,
java.lang.String subject,
java.lang.String content)
public static void addResourceSource(ResourceSource source)
public static void prependResourceSource(ResourceSource source)
public static java.net.URL getResource(java.lang.ClassLoader loader,
java.lang.String name)
public static java.net.URL getResource(java.lang.ClassLoader loader,
java.lang.String prefix,
java.lang.String name)
public static java.net.URL getResource(java.lang.String name)
public static java.lang.String readTextFile(java.io.File file)
throws java.io.IOException
java.io.IOException
public static java.lang.String readTextFile(java.io.Reader r)
throws java.io.IOException
java.io.IOException
public static boolean booleanValue(java.lang.String string,
boolean deflt)
public static java.io.File findSourceFile(java.lang.StackTraceElement e)
public static java.lang.Process launchFileEditor(java.io.File file,
int line)
throws java.io.IOException
java.io.IOExceptionpublic static java.lang.String escapeXML(java.lang.String string)
public static void findImplementationsInJar(java.util.jar.JarFile jar,
java.lang.Class superClass,
java.util.List<java.lang.String> implementations)
public static void findImplementationsInJar(java.lang.ClassLoader loader,
java.util.jar.JarFile jar,
java.lang.Class<?> superClass,
java.util.List<java.lang.String> implementations)
public static java.lang.Class classForName(java.lang.String className)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
public static java.lang.String[] quotedSplit(java.lang.String line,
java.util.regex.Pattern separatorPattern)
public static java.lang.String[] quotedSplit(java.lang.String line,
java.util.regex.Pattern separatorPattern,
char quotingChar,
char escapeChar)
@Deprecated
public static java.lang.String[] mergeQuotedSplits(java.lang.String line,
java.lang.String[] splittedTokens,
java.lang.String quoteString)
throws java.io.IOException
quotedSplit(String, Pattern, char, char) or quotedSplit(String, Pattern) instead
line - the original linesplittedTokens - the tokens as they were originally splittedquoteString - the string which should be used as quote indicator, e.g. " or '
java.io.IOException - if an open quote was not ended
public static void getFirstToken(java.io.StreamTokenizer tokenizer)
throws java.io.IOException
java.io.IOException
public static void getLastToken(java.io.StreamTokenizer tokenizer,
boolean endOfFileOk)
throws java.io.IOException
java.io.IOException
public static void getNextToken(java.io.StreamTokenizer tokenizer)
throws java.io.IOException
java.io.IOException
public static void waitForEOL(java.io.StreamTokenizer tokenizer)
throws java.io.IOException
java.io.IOExceptionpublic static void delete(java.io.File file)
public static void copy(java.io.File srcPath,
java.io.File dstPath)
throws java.io.IOException
java.io.IOException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||