⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utils.html

📁 由java开发的软件包
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<DD>Pads a string to a specified length, inserting spaces on the right as required. If the string is too long, characters are removed (from the right).<P><DD><DL><DT><B>Parameters:</B><DD><CODE>inString</CODE> - the input string<DD><CODE>length</CODE> - the desired length of the output string<DT><B>Returns:</B><DD>the output string</DL></DD></DL><HR><A NAME="doubleToString(double, int)"><!-- --></A><H3>doubleToString</H3><PRE>public static java.lang.String <B>doubleToString</B>(double&nbsp;value,                                              int&nbsp;afterDecimalPoint)</PRE><DL><DD>Rounds a double and converts it into String.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - the double value<DD><CODE>afterDecimalPoint</CODE> - the (maximum) number of digits permitted after the decimal point<DT><B>Returns:</B><DD>the double as a formatted string</DL></DD></DL><HR><A NAME="doubleToString(double, int, int)"><!-- --></A><H3>doubleToString</H3><PRE>public static java.lang.String <B>doubleToString</B>(double&nbsp;value,                                              int&nbsp;width,                                              int&nbsp;afterDecimalPoint)</PRE><DL><DD>Rounds a double and converts it into a formatted decimal-justified String. Trailing 0's are replaced with spaces.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - the double value<DD><CODE>width</CODE> - the width of the string<DD><CODE>afterDecimalPoint</CODE> - the number of digits after the decimal point<DT><B>Returns:</B><DD>the double as a formatted string</DL></DD></DL><HR><A NAME="eq(double, double)"><!-- --></A><H3>eq</H3><PRE>public static boolean <B>eq</B>(double&nbsp;a,                         double&nbsp;b)</PRE><DL><DD>Tests if a is equal to b.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a double<DD><CODE>b</CODE> - a double</DL></DD></DL><HR><A NAME="checkForRemainingOptions(java.lang.String[])"><!-- --></A><H3>checkForRemainingOptions</H3><PRE>public static void <B>checkForRemainingOptions</B>(java.lang.String[]&nbsp;options)                                     throws java.lang.Exception</PRE><DL><DD>Checks if the given array contains any non-empty options.<P><DD><DL><DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if there are any non-empty options</DL></DD></DL><HR><A NAME="getFlag(char, java.lang.String[])"><!-- --></A><H3>getFlag</H3><PRE>public static boolean <B>getFlag</B>(char&nbsp;flag,                              java.lang.String[]&nbsp;options)                       throws java.lang.Exception</PRE><DL><DD>Checks if the given array contains the flag "-Char". Stops searching at the first marker "--". If the flag is found, it is replaced with the empty string.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>flag</CODE> - the character indicating the flag.<DT><B>Returns:</B><DD>true if the flag was found<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if an illegal option was found</DL></DD></DL><HR><A NAME="getFlag(java.lang.String, java.lang.String[])"><!-- --></A><H3>getFlag</H3><PRE>public static boolean <B>getFlag</B>(java.lang.String&nbsp;flag,                              java.lang.String[]&nbsp;options)                       throws java.lang.Exception</PRE><DL><DD>Checks if the given array contains the flag "-String". Stops searching at the first marker "--". If the flag is found, it is replaced with the empty string.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>flag</CODE> - the String indicating the flag.<DT><B>Returns:</B><DD>true if the flag was found<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if an illegal option was found</DL></DD></DL><HR><A NAME="getOption(char, java.lang.String[])"><!-- --></A><H3>getOption</H3><PRE>public static java.lang.String <B>getOption</B>(char&nbsp;flag,                                         java.lang.String[]&nbsp;options)                                  throws java.lang.Exception</PRE><DL><DD>Gets an option indicated by a flag "-Char" from the given array of strings. Stops searching at the first marker "--". Replaces  flag and option with empty strings.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>flag</CODE> - the character indicating the option.<DD><CODE>options</CODE> - the array of strings containing all the options.<DT><B>Returns:</B><DD>the indicated option or an empty string<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the option indicated by the flag can't be found</DL></DD></DL><HR><A NAME="getOption(java.lang.String, java.lang.String[])"><!-- --></A><H3>getOption</H3><PRE>public static java.lang.String <B>getOption</B>(java.lang.String&nbsp;flag,                                         java.lang.String[]&nbsp;options)                                  throws java.lang.Exception</PRE><DL><DD>Gets an option indicated by a flag "-String" from the given array of strings. Stops searching at the first marker "--". Replaces  flag and option with empty strings.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>flag</CODE> - the String indicating the option.<DD><CODE>options</CODE> - the array of strings containing all the options.<DT><B>Returns:</B><DD>the indicated option or an empty string<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the option indicated by the flag can't be found</DL></DD></DL><HR><A NAME="quote(java.lang.String)"><!-- --></A><H3>quote</H3><PRE>public static java.lang.String <B>quote</B>(java.lang.String&nbsp;string)</PRE><DL><DD>Quotes a string if it contains special characters.  The following rules are applied: A character is backquoted version of it is one  of <tt>" ' % \ \n \r \t</tt>. A string is enclosed within single quotes if a character has been backquoted using the previous rule above or contains  <tt>{ }</tt> or is exactly equal to the strings  <tt>, ? space or ""</tt> (empty string). A quoted question mark distinguishes it from the missing value which is represented as an unquoted question mark in arff files.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>string</CODE> - the string to be quoted<DT><B>Returns:</B><DD>the string (possibly quoted)</DL></DD></DL><HR><A NAME="backQuoteChars(java.lang.String)"><!-- --></A><H3>backQuoteChars</H3><PRE>public static java.lang.String <B>backQuoteChars</B>(java.lang.String&nbsp;string)</PRE><DL><DD>Converts carriage returns and new lines in a string into \r and \n. Backquotes the following characters: ` " \ \t and %<P><DD><DL><DT><B>Parameters:</B><DD><CODE>string</CODE> - the string<DT><B>Returns:</B><DD>the converted string</DL></DD></DL><HR><A NAME="convertNewLines(java.lang.String)"><!-- --></A><H3>convertNewLines</H3><PRE>public static java.lang.String <B>convertNewLines</B>(java.lang.String&nbsp;string)</PRE><DL><DD>Converts carriage returns and new lines in a string into \r and \n.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>string</CODE> - the string<DT><B>Returns:</B><DD>the converted string</DL></DD></DL><HR><A NAME="partitionOptions(java.lang.String[])"><!-- --></A><H3>partitionOptions</H3><PRE>public static java.lang.String[] <B>partitionOptions</B>(java.lang.String[]&nbsp;options)</PRE><DL><DD>Returns the secondary set of options (if any) contained in the supplied options array. The secondary set is defined to be any options after the first "--". These options are removed from the original options array.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>options</CODE> - the input array of options<DT><B>Returns:</B><DD>the array of secondary options</DL></DD></DL><HR><A NAME="unbackQuoteChars(java.lang.String)"><!-- --></A><H3>unbackQuoteChars</H3><PRE>public static java.lang.String <B>unbackQuoteChars</B>(java.lang.String&nbsp;string)</PRE><DL><DD>The inverse operation of backQuoteChars(). Converts back-quoted carriage returns and new lines in a string  to the corresponding character ('\r' and '\n'). Also "un"-back-quotes the following characters: ` " \ \t and %<P><DD><DL><DT><B>Parameters:</B><DD><CODE>string</CODE> - the string<DT><B>Returns:</B><DD>the converted string</DL></DD></DL><HR><A NAME="splitOptions(java.lang.String)"><!-- --></A><H3>splitOptions</H3><PRE>public static java.lang.String[] <B>splitOptions</B>(java.lang.String&nbsp;quotedOptionString)                                       throws java.lang.Exception</PRE><DL><DD>Split up a string containing options into an array of strings, one for each option.<P><DD><DL><DT><B>Returns:</B><DD>the array of options<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE></DL></DD></DL><HR><A NAME="joinOptions(java.lang.String[])"><!-- --></A><H3>joinOptions</H3><PRE>public static java.lang.String <B>joinOptions</B>(java.lang.String[]&nbsp;optionArray)</PRE><DL><DD>Joins all the options in an option array into a single string, as might be used on the command line.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>optionArray</CODE> - the array of options<DT><B>Returns:</B><DD>the string containing all options.</DL></DD></DL><HR><A NAME="forName(java.lang.Class, java.lang.String, java.lang.String[])"><!-- --></A><H3>forName</H3><PRE>public static java.lang.Object <B>forName</B>(java.lang.Class&nbsp;classType,                                       java.lang.String&nbsp;className,                                       java.lang.String[]&nbsp;options)                                throws java.lang.Exception</PRE><DL><DD>Creates a new instance of an object given it's class name and (optional) arguments to pass to it's setOptions method. If the object implements OptionHandler and the options parameter is non-null, the object will have it's options set. Example use:<p> <code> <pre> String classifierName = Utils.getOption('W', options); Classifier c = (Classifier)Utils.forName(Classifier.class,                                          classifierName,                                          options); setClassifier(c); </pre></code><P><DD><DL><DT><B>Parameters:</B><DD><CODE>classType</CODE> - the class that the instantiated object should be assignable to -- an exception is thrown if this is not the case<DD><CODE>className</CODE> - the fully qualified class name of the object<DD><CODE>options</CODE> - an array of options suitable for passing to setOptions. May be null. Any options accepted by the object will be removed from the array.<DT><B>Returns:</B><DD>the newly created object, ready for use.<DT><B>Throws:</B><DD><CODE>java.lang.Exception</CODE> - if the class name is invalid, or if the class is not assignable to the desired class type, or the options supplied are not acceptable to the object</DL></DD></DL><HR><A NAME="info(int[])"><!-- --></A><H3>info</H3><PRE>public static double <B>info</B>(int[]&nbsp;counts)</PRE><DL><DD>Computes entropy for an array of integers.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>counts</CODE> - array of counts<DT><B>Returns:</B><DD>- a log2 a - b log2 b - c log2 c + (a+b+c) log2 (a+b+c) when given array [a b c]</DL></DD></DL><HR><A NAME="smOrEq(double, double)"><!-- --></A><H3>smOrEq</H3><PRE>public static boolean <B>smOrEq</B>(double&nbsp;a,                             double&nbsp;b)</PRE><DL><DD>Tests if a is smaller or equal to b.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a double<DD><CODE>b</CODE> - a double</DL></DD></DL><HR><A NAME="grOrEq(double, double)"><!-- --></A><H3>grOrEq</H3><PRE>public static boolean <B>grOrEq</B>(double&nbsp;a,                             double&nbsp;b)</PRE><DL><DD>Tests if a is greater or equal to b.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a double<DD><CODE>b</CODE> - a double</DL></DD></DL><HR><A NAME="sm(double, double)"><!-- --></A><H3>sm</H3><PRE>public static boolean <B>sm</B>(double&nbsp;a,                         double&nbsp;b)</PRE><DL><DD>Tests if a is smaller than b.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - a double<DD><CODE>b</CODE> - a double</DL></DD></DL><HR><A NAME="gr(double, double)"><!-- --></A><H3>gr</H3><PRE>public static boolean <B>gr</B>(double&nbsp;a,                         double&nbsp;b)</PRE><DL><DD>Tests if a is smaller than b.<P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -