📄 utils.html
字号:
<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 flag,
java.lang.String[] 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 flag,
java.lang.String[] 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="getOptionPos(char, java.lang.String[])"><!-- --></A><H3>
getOptionPos</H3>
<PRE>
public static int <B>getOptionPos</B>(char flag,
java.lang.String[] options)</PRE>
<DL>
<DD>Gets the index of an option or flag indicated by a flag "-Char" from the given array of strings. Stops searching at the first marker "--".
<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 position if found, or -1 otherwise</DL>
</DD>
</DL>
<HR>
<A NAME="getOptionPos(java.lang.String, java.lang.String[])"><!-- --></A><H3>
getOptionPos</H3>
<PRE>
public static int <B>getOptionPos</B>(java.lang.String flag,
java.lang.String[] options)</PRE>
<DL>
<DD>Gets the index of an option or flag indicated by a flag "-String" from the given array of strings. Stops searching at the first marker "--".
<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 position if found, or -1 otherwise</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 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 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 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[] 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 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="info(int[])"><!-- --></A><H3>
info</H3>
<PRE>
public static double <B>info</B>(int[] 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 a,
double 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 a,
double 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 a,
double 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 a,
double b)</PRE>
<DL>
<DD>Tests if a is greater 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="kthSmallestValue(int[], int)"><!-- --></A><H3>
kthSmallestValue</H3>
<PRE>
public static double <B>kthSmallestValue</B>(int[] array,
int k)</PRE>
<DL>
<DD>Returns the kth-smallest value in the array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - the array of integers<DD><CODE>k</CODE> - the value of k
<DT><B>Returns:</B><DD>the kth-smallest value</DL>
</DD>
</DL>
<HR>
<A NAME="kthSmallestValue(double[], int)"><!-- --></A><H3>
kthSmallestValue</H3>
<PRE>
public static double <B>kthSmallestValue</B>(double[] array,
int k)</PRE>
<DL>
<DD>Returns the kth-smallest value in the array
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - the array of double<DD><CODE>k</CODE> - the value of k
<DT><B>Returns:</B><DD>the kth-smallest value</DL>
</DD>
</DL>
<HR>
<A NAME="log2(double)"><!-- --></A><H3>
log2</H3>
<PRE>
public static double <B>log2</B>(double a)</PRE>
<DL>
<DD>Returns the logarithm of a for base 2.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>a</CODE> - a double
<DT><B>Returns:</B><DD>the logarithm for base 2</DL>
</DD>
</DL>
<HR>
<A NAME="maxIndex(double[])"><!-- --></A><H3>
maxIndex</H3>
<PRE>
public static int <B>maxIndex</B>(double[] doubles)</PRE>
<DL>
<DD>Returns index of maximum element in a given array of doubles. First maximum is returned.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>doubles</CODE> - the array of doubles
<DT><B>Returns:</B><DD>the index of the maximum element</DL>
</DD>
</DL>
<HR>
<A NAME="maxIndex(int[])"><!-- --></A><H3>
maxIndex</H3>
<PRE>
public static int <B>maxIndex</B>(int[] ints)</PRE>
<DL>
<DD>Returns index of maximum element in a given array of integers. First maximum is returned.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ints</CODE> - the array of integers
<DT><B>Returns:</B><DD>the index of the maximum element</DL>
</DD>
</DL>
<HR>
<A NAME="mean(double[])"><!-- --></A><H3>
mean</H3>
<PRE>
public static double <B>mean</B>(double[] vector)</PRE>
<DL>
<DD>Computes the mean for an array of doubles.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>vector</CODE> - the array
<DT><B>Returns:</B><DD>the mean</DL>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -