coser.common
类 SimpleTool

java.lang.Object
  继承者 coser.common.SimpleTool
直接已知子类:
SimpleTool_GuiyingPan

public class SimpleTool
extends java.lang.Object

Frequently used methods to convert strings, integers, codings, etc.

Author: Fan Min minfanphd@163.com
Copyright: The source code and all documents are open and free. PLEASE keep this header while revising the program.
Organization: Lab of Granular Computing, Zhangzhou Normal University, Fujian 363000, China.
Project: The cost-sensitive rough sets project.

Progress: OK. Copied from Hydrosimu.
Written time: March 09, 2011.
Last modify time: March 09, 2011.


字段摘要
修饰符 和 类型 字段 和 描述
static int MAX_PARSE_ARRAY_LENGTH
          Maximal length of the parsed array (for int and double).
static java.util.Random random
          A global random object.
 
构造方法摘要
构造函数 和 描述
SimpleTool()
           
 
方法摘要
修饰符 和 类型 方法 和 描述
static java.lang.String addSingleQuotes(java.lang.String prmStringArray)
          Add single quotes for a string (may be an array, elements are separated by commas).
static long[] adjustLongArrayLength(long[] paraLongArray, int length)
          Adjust a long array length.
static int attributeSubsetSize(boolean[] paraBooleanArray)
          Compute the attribute subset size.
static int attributeSubsetSize(long paraLong, int paraLength)
          Compute the attribute subset size.
static java.lang.String booleanArrayToAttributeSetString(boolean[] paraArray)
          Conver a boolean array into a string.
static int booleanArrayToInt(boolean[] paraBooleanArray)
          Convert a boolean array to an int value.
static long booleanArrayToLong(boolean[] paraBooleanArray)
          Convert a boolean array to a long value.
static java.lang.String booleanArrayToString(boolean[] paraArray, char paraSeparator)
          Convert a boolean array into a string.
static java.lang.String booleanMatrixToString(boolean[][] tempMatrix)
          Convert a boolean matrix to string
static boolean[][] children(int paraBits)
          Who is who's child.
static int[] compressAndSortIntArray(int[] paraIntArray, int paraLength)
          Compress an int array so that no duplicate elements, no redundant elemnts exist, and it is in an ascendent order.
static long[] compressAndSortLongArray(long[] paraLongArray, int paraLength)
          Compress a long array so that no duplicate elements, no redundant elemnts exist, and it is in an ascendent order.
static boolean[] copyBooleanArray(boolean[] paramBooleanArray)
          Copy boolean array
static java.lang.String doubleArrayToString(double[] paraArray)
          Conver a double array into a string.
static java.lang.String doubleArrayToString(double[] paraArray, char paraSeparator)
          Conver a double array into a string.
static int exponential(int paraExponential)
          The exponential of an int.
static long exponentialLong(int paraExponential)
          The exponential of an int.
static java.lang.String GB2312ToUNICODE(java.lang.String paraString)
          GB2312 to UNICODE.
static boolean[] generateBooleanArrayForDivision(int paraDatasetSize, double paraPercentage)
          Generate a boolean array to divide a dataset in two
static java.lang.String generateString(java.lang.String[] prmString, int index)
          Remove string from a string array, and return a string.
static int getSubsetSize(boolean[] paraSubset)
          Return the size of the subset.
static int getSubsetSize(long paraSubset)
          Return the size of the subset.
static java.lang.String intArrayToAttributeSetString(int[] paraIntArray, int paraLength)
          An int array to an attribute subset.
static int intArrayToInt(int[] paraIntArray)
          An int array to an int value.
static long intArrayToLong(int[] paraIntArray)
          An int array to an long value.
static java.lang.String intArrayToString(int[] paraArray, char paraSeparator)
          Convert an integer array into a string.
static java.lang.String intToAttributeSetString(int paraInt)
          An int to an attribute subset.
static boolean[] intToBooleanArray(int paraInt, int paraLength)
          Convert an integer value to a boolean array.
static boolean isAscendingOrder(int[] paraArray)
          Is the given array in an ascending order?
static boolean isEmptyStr(java.lang.String paraString)
          Judge whether or not the given string is null/empty.
static boolean isSubset(boolean[] paraFirstSet, boolean[] paraSecondSet)
          Is the first set a subset of the second one.
static boolean isSubset(int[] paraFirstSet, int[] paraSecondSet)
          Is the first set a subset of the second one.
static boolean isSubset(long paraFirstSet, long paraSecondSet, int paraAttributes)
          Is the first set a subset of the second one.
static boolean isUnspecifiedStr(java.lang.String paraString)
          Judge whether or not the given string is specified.
static boolean isUpperTriangleBooleanMatrix(boolean[][] paraMatrix)
          Judge whether or not the given boolean matrix is upper triangle one.
static java.lang.String joinString(java.lang.String prmFirstString, java.lang.String prmSecondString)
          Join two attribute strings, separated by a comma.
static boolean[][] longArrayToBooleanMatrix(long[] paraLongArray, int paraLength)
          Long array to boolean matrix.
static java.lang.String longToAttributeSetString(long paraLong)
          A long to an attribute subset.
static java.lang.String longToBitString(long paraLong)
          Convert a long value to a bit string.
static boolean[] longToBooleanArray(long paraLong, int paraLength)
          Convert a long value to a boolean array.
static int[] longToIntArray(long paraLong, int paraLength)
          Convert a long value to a integer array.
static void main(java.lang.String[] args)
          Testing method.
static void measureBasedQuickSort(long[] paraData, int[] paraMeasuredValues, int paraLeft, int paraRight)
          Subreduct sort according to respective measure.
static double[] parseDoubleArray(java.lang.String paraString)
          Read a double array from a given string.
static double[] parseDoubleArray(java.lang.String paraString, int paraNumberOfDoubles, char paraSeparator)
          Read a double array from a given string.
static double parseDoubleValueAfterColon(java.lang.String paraString)
          Read a double value from a given string after the colon.
static int[] parseIntArray(java.lang.String paraString)
          Read a int array from a given string.
static int[] parseIntArray(java.lang.String paraString, int paraNumberOfInts, char paraSeparator)
          Read an integer array from a given string.
static int parseIntValueAfterColon(java.lang.String paraString)
          Read an int value from a given string after the colon.
static java.lang.String[] parseString(java.lang.String prmString, java.lang.String prmDelimiter, boolean prmReturnTokens)
          Convert a string with delimiters (such as commas or semi-commas) into a string array.
static void printAllReducts(boolean[][] paraAllReducts)
          Print all reducts.
static void printBooleanArray(boolean[] paraBooleanArray)
          Print a boolean array.
static void printBooleanMatrix(boolean[][] paraBooleanMatrix)
          Print a boolean matrix.
static void printDoubleArray(double[] paraDoubleArray)
          Print a double array.
static void printIntArray(int[] paraIntArray)
          Print an int array, simply for test.
static void printLongArray(long[] paraLongArray)
          Print a long array, simply for test.
static void printLongArrayNoZero(long[] paraLongArray)
          Print a long array, zero is not printed.
static long[] removeSupersets(long[] paraSets, int paraNumberOfConditions)
          Remove supersets, used to obtain reducts.
static boolean[] revertBooleanArray(boolean[] paraArray)
          Revert a boolean array.
static int[] setIntersection(int[] paraFirstSet, int[] paraSecondSet)
          Set intersection.
static java.lang.String shorterDouble(double paraDouble)
          Convert a double value into a shorter string.
static java.lang.String shorterDouble(double paraDouble, int paraLength)
          Convert a double value into a shorter string.
static boolean stringArrayContainsString(java.lang.String prmStringArray, java.lang.String prmString)
          If the string quisi-array (elements are separated by commas) contains respective attribute.
static java.lang.String stringArrayToString(java.lang.String[] prmStringArray)
          Convert a string array into a string, elements are separated by commas.
static java.lang.String stringMinusString(java.lang.String prmFirstString, java.lang.String prmSecondString)
          One string minus another, essentially corresponding string arrays.
static boolean[] stringToBooleanArray(java.lang.String paraString, char paraSeparator)
          Convert a string array into a boolean array.
static java.lang.String[] stringToStringArray(java.lang.String prmString)
          Convert a string with commas into a string array, blanks adjacent with commas are deleted.
static java.lang.String stringUnionString(java.lang.String prmFirstString, java.lang.String prmSecondString)
          One string union another, essentially corresponding string sets.
static char subSetCheck(long paraFirstSet, long paraSecondSet, int paraNumberOfConditions)
          Check Who is who's subset.
static void swap(double[] paraDoubleArray, int src, int dest)
          Swap two value in a double array.
static void swap(int[] paraLongArray, int src, int dest)
          Swap two value in a long array.
static void swap(long[] paraLongArray, int src, int dest)
          Swap two value in a long array.
static java.lang.String UNICODEToGB2312(java.lang.String paraString)
          UNICODE to GB2312.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

MAX_PARSE_ARRAY_LENGTH

public static final int MAX_PARSE_ARRAY_LENGTH
Maximal length of the parsed array (for int and double).

另请参见:
常量字段值

random

public static final java.util.Random random
A global random object.

构造方法详细信息

SimpleTool

public SimpleTool()
方法详细信息

shorterDouble

public static java.lang.String shorterDouble(double paraDouble)
Convert a double value into a shorter string.

参数:
paraDouble - the double value to be converted.

shorterDouble

public static java.lang.String shorterDouble(double paraDouble,
                                             int paraLength)
Convert a double value into a shorter string.

参数:
paraDouble - the double value to be converted.
paraLength - the length of reserved double.

stringToStringArray

public static java.lang.String[] stringToStringArray(java.lang.String prmString)
                                              throws java.lang.Exception
Convert a string with commas into a string array, blanks adjacent with commas are deleted. If the string bewteen two adjacent commas are blank or contains only space char ' ', then an exception will be thrown.
For example, "a, bc, def, g" will be converted into a string array with 4 elements "a", "bc", "def" and "g".

参数:
prmString - The source string
返回:
A string array.
抛出:
java.lang.Exception - Exception for illegal data.
另请参见:
stringArrayToString(java.lang.String[])

stringArrayToString

public static java.lang.String stringArrayToString(java.lang.String[] prmStringArray)
Convert a string array into a string, elements are separated by commas.

参数:
prmStringArray - The source string array
返回:
converted string.
另请参见:
stringToStringArray(java.lang.String)

addSingleQuotes

public static java.lang.String addSingleQuotes(java.lang.String prmStringArray)
Add single quotes for a string (may be an array, elements are separated by commas). This is needed in some SQL statements. For example, "ab,c,d" will be converted into "ab','c','d".

参数:
prmStringArray - The source string
返回:
converted string.

stringArrayContainsString

public static boolean stringArrayContainsString(java.lang.String prmStringArray,
                                                java.lang.String prmString)
If the string quisi-array (elements are separated by commas) contains respective attribute.
For exampe "abc, de" contains "de", but it does not contain "d".

参数:
prmStringArray - The string quisi-array (elements are separated by commas).
prmString - Respect string.
返回:
If it is contained.
另请参见:
stringToStringArray(java.lang.String)

joinString

public static java.lang.String joinString(java.lang.String prmFirstString,
                                          java.lang.String prmSecondString)
Join two attribute strings, separated by a comma.

参数:
prmFirstString - The first attribute string
prmSecondString - The second attribute string
返回:
concated string.

parseString

public static java.lang.String[] parseString(java.lang.String prmString,
                                             java.lang.String prmDelimiter,
                                             boolean prmReturnTokens)
Convert a string with delimiters (such as commas or semi-commas) into a string array.
This method is more generalized than stringToStringArray because the latter only permits commas to be delimiters. For more detail please contact Liu Qihe

参数:
prmString - The given string
prmDelimiter - The given delimiter
prmReturnTokens - Is the delimiter permitted after convertion.
返回:
string array separated by commas

generateString

public static java.lang.String generateString(java.lang.String[] prmString,
                                              int index)
Remove string from a string array, and return a string. For more detail please contact Liu Qihe

参数:
prmString - 字符串
index - 去掉串的位?
返回:
字符串,属性值之间用逗号分隔.

GB2312ToUNICODE

public static java.lang.String GB2312ToUNICODE(java.lang.String paraString)
GB2312 to UNICODE. Use this one if Chinese characters is a mess.

参数:
paraString - a GB2312 string
返回:
a UNICODE string.
另请参见:
UNICODEToGB2312(java.lang.String)

UNICODEToGB2312

public static java.lang.String UNICODEToGB2312(java.lang.String paraString)
UNICODE to GB2312. Use this one if Chinese characters is a mess.

参数:
paraString - a UNICODE string.
返回:
a GB2312 string.
另请参见:
GB2312ToUNICODE(java.lang.String)

stringMinusString

public static java.lang.String stringMinusString(java.lang.String prmFirstString,
                                                 java.lang.String prmSecondString)
                                          throws java.lang.Exception
One string minus another, essentially corresponding string arrays.
E.g., "ab,cd,efa" minus "ab,efa" gets "cd"

参数:
prmFirstString - The first string.
prmSecondString - The second string.
返回:
A result string.
抛出:
java.lang.Exception - if the first string does not contain an element of the second string, e.g., "ab, cd" minus "ab, de". #see scheme.SymbolicPartition .computeOptimalPartitionReduct(java.lang.String, java.lang.String, int)

stringUnionString

public static java.lang.String stringUnionString(java.lang.String prmFirstString,
                                                 java.lang.String prmSecondString)
                                          throws java.lang.Exception
One string union another, essentially corresponding string sets.
E.g., "ab,cd,efa" union "ab,ee" gets "ab,cd,efa, ee"

参数:
prmFirstString - The first string.
prmSecondString - The second string.
返回:
A result string. #see scheme.Reduction.computeOptimalMReductByEntropy(java.lang.String, java.lang.String, java.lang.String)
抛出:
java.lang.Exception

isEmptyStr

public static boolean isEmptyStr(java.lang.String paraString)
Judge whether or not the given string is null/empty.


isUnspecifiedStr

public static boolean isUnspecifiedStr(java.lang.String paraString)
Judge whether or not the given string is specified.


parseIntArray

public static int[] parseIntArray(java.lang.String paraString,
                                  int paraNumberOfInts,
                                  char paraSeparator)
                           throws java.lang.Exception
Read an integer array from a given string. Integers are separated by separators. Author Fan Min.

参数:
paraString - The given string.
paraNumberOfInts - The number of integer to read from the string. If there are more integers, just ignore them.
paraSeparator - The separator of data, blank and commas are most commonly uses ones.
返回:
The constructed array.
抛出:
java.lang.Exception

intToAttributeSetString

public static java.lang.String intToAttributeSetString(int paraInt)
An int to an attribute subset. Author Fan Min.

参数:
paraInt - The given integer representing an attribute subset.
返回:
The attribute subset in a string.

intArrayToAttributeSetString

public static java.lang.String intArrayToAttributeSetString(int[] paraIntArray,
                                                            int paraLength)
An int array to an attribute subset. Author Fan Min.

参数:
paraIntArray - The given integer array an attribute subset.
paraLength - The size of the subset.
返回:
The attribute subset in a string.

intArrayToInt

public static int intArrayToInt(int[] paraIntArray)
An int array to an int value. For example, [0, 2] will be binary 101 = 5.

参数:
paraIntArray - The given integer array indicating which positions is 1.
返回:
An int value.

intArrayToLong

public static long intArrayToLong(int[] paraIntArray)
An int array to an long value. For example, [0, 2] will be binary 101 = 5.

参数:
paraIntArray - The given integer representing an attribute subset.
返回:
An int value.
另请参见:
intArrayToInt(int[])

longToAttributeSetString

public static java.lang.String longToAttributeSetString(long paraLong)
A long to an attribute subset.

参数:
paraLong - The given integer representing an attribute subset.
返回:
The attribute subset in a string.

intArrayToString

public static java.lang.String intArrayToString(int[] paraArray,
                                                char paraSeparator)
                                         throws java.lang.Exception
Convert an integer array into a string. Integers are separated by separators. Author Fan Min.

参数:
paraArray - The given array.
paraSeparator - The separator of data, blank and commas are most commonly uses ones.
返回:
The constructed String.
抛出:
java.lang.Exception

parseDoubleArray

public static double[] parseDoubleArray(java.lang.String paraString,
                                        int paraNumberOfDoubles,
                                        char paraSeparator)
                                 throws java.lang.Exception
Read a double array from a given string. Double values are separated by separators.
Author Fan Min.

参数:
paraString - The given string.
paraNumberOfDoubles - The number of integer to read from the string. If there are more integers, just ignore them.
paraSeparator - The separator of data, blank and commas are most commonly uses ones.
返回:
The constructed array.
抛出:
java.lang.Exception

parseDoubleArray

public static double[] parseDoubleArray(java.lang.String paraString)
                                 throws java.lang.Exception
Read a double array from a given string. The number of doubles are not given, so I will parse as many double values as possible. The seperator is not indicated, so comma is the first candidate, and blank is the second.
Author Fan Min.

参数:
paraString - The given string.
返回:
The constructed array.
抛出:
java.lang.Exception

doubleArrayToString

public static java.lang.String doubleArrayToString(double[] paraArray)
                                            throws java.lang.Exception
Conver a double array into a string. Doubles are separated by blanks. Author Fan Min.

参数:
paraArray - The given array.
返回:
The constructed String.
抛出:
java.lang.Exception

doubleArrayToString

public static java.lang.String doubleArrayToString(double[] paraArray,
                                                   char paraSeparator)
                                            throws java.lang.Exception
Conver a double array into a string. Doubles are separated by separators. Author Fan Min.

参数:
paraArray - The given array.
paraSeparator - The separator of data, blank and commas are most commonly uses ones.
返回:
The constructed String.
抛出:
java.lang.Exception

booleanArrayToString

public static java.lang.String booleanArrayToString(boolean[] paraArray,
                                                    char paraSeparator)
Convert a boolean array into a string. Booleans are separated by separators.

参数:
paraArray - The given array.
paraSeparator - The separator of data, blank and commas are most commonly uses ones.
返回:
The constructed String.

stringToBooleanArray

public static boolean[] stringToBooleanArray(java.lang.String paraString,
                                             char paraSeparator)
                                      throws java.lang.Exception
Convert a string array into a boolean array. Booleans are separated by separators. Only support 0 and 1 in the string. TRUE and FALSE are not supported.

参数:
paraString - The given string.
paraSeparator - The separator of data, blank and commas are most commonly uses ones.
返回:
The constructed String.
抛出:
java.lang.Exception - for wrong format.

booleanArrayToAttributeSetString

public static java.lang.String booleanArrayToAttributeSetString(boolean[] paraArray)
Conver a boolean array into a string. Booleans are separated by commas.

参数:
paraArray - The given array.
返回:
The constructed String.

parseIntArray

public static int[] parseIntArray(java.lang.String paraString)
                           throws java.lang.Exception
Read a int array from a given string. The number of ints are not given, so I will parse as many int values as possible. The seperator is not indicated, so comma is the first candidate, and blank is the second.
Author Fan Min.

参数:
paraString - The given string.
返回:
The constructed array.
抛出:
java.lang.Exception

parseDoubleValueAfterColon

public static double parseDoubleValueAfterColon(java.lang.String paraString)
                                         throws java.lang.Exception
Read a double value from a given string after the colon.

参数:
paraString - The given string.
返回:
A double value.
抛出:
java.lang.Exception

parseIntValueAfterColon

public static int parseIntValueAfterColon(java.lang.String paraString)
                                   throws java.lang.Exception
Read an int value from a given string after the colon.

参数:
paraString - The given string.
返回:
A double value.
抛出:
java.lang.Exception

compressAndSortIntArray

public static int[] compressAndSortIntArray(int[] paraIntArray,
                                            int paraLength)
Compress an int array so that no duplicate elements, no redundant elemnts exist, and it is in an ascendent order.

参数:
paraIntArray - The given int array.
paraLength - The effecitive length of the given int array.
返回:
The constructed array.

compressAndSortLongArray

public static long[] compressAndSortLongArray(long[] paraLongArray,
                                              int paraLength)
Compress a long array so that no duplicate elements, no redundant elemnts exist, and it is in an ascendent order.

参数:
paraLongArray - The given long array.
paraLength - The effecitive length of the given long array.
返回:
The constructed array.

measureBasedQuickSort

public static void measureBasedQuickSort(long[] paraData,
                                         int[] paraMeasuredValues,
                                         int paraLeft,
                                         int paraRight)
                                  throws java.lang.Exception
Subreduct sort according to respective measure.

参数:
paraData - The data, it may represent a subreduct
paraMeasuredValues - The measured values of the data
paraLeft - The left index.
paraRight - The right index.
抛出:
java.lang.Exception

adjustLongArrayLength

public static long[] adjustLongArrayLength(long[] paraLongArray,
                                           int length)
Adjust a long array length.

参数:
paraLongArray - The given long array.
length - The real length of the given long array.
返回:
An identical long array.

copyBooleanArray

public static boolean[] copyBooleanArray(boolean[] paramBooleanArray)
Copy boolean array

参数:
paramBooleanArray - The given boolean array.
返回:
An identical boolean array.

exponential

public static int exponential(int paraExponential)
The exponential of an int.

参数:
paraExponential - the exponential.
返回:
An identical boolean array.

exponentialLong

public static long exponentialLong(int paraExponential)
The exponential of an int.

参数:
paraExponential - the exponential.
返回:
An identical boolean array.

children

public static boolean[][] children(int paraBits)
Who is who's child. Nodes are by integers, and attributes are indicated by bits.

参数:
paraBits - How many bits (attributes).
返回:
An array of children.

longToIntArray

public static int[] longToIntArray(long paraLong,
                                   int paraLength)
Convert a long value to a integer array.

参数:
paraLong - The given long value.
paraLength - The given length of the array.
返回:
An integer array to indicate which positions (bits) are included.

longToBooleanArray

public static boolean[] longToBooleanArray(long paraLong,
                                           int paraLength)
Convert a long value to a boolean array.

参数:
paraLong - The given long value.
paraLength - The given length of the array.
返回:
A boolean array to indicate which positions (bits) are included.

booleanArrayToLong

public static long booleanArrayToLong(boolean[] paraBooleanArray)
                               throws java.lang.Exception
Convert a boolean array to a long value.

参数:
paraBooleanArray - The given boolean array.
返回:
A long to indicate which positions (bits) are included.
抛出:
java.lang.Exception

attributeSubsetSize

public static int attributeSubsetSize(long paraLong,
                                      int paraLength)
Compute the attribute subset size.

参数:
paraLong - The given long value.
paraLength - The size of all attributes.
返回:
the size of the attribute subset.

attributeSubsetSize

public static int attributeSubsetSize(boolean[] paraBooleanArray)
Compute the attribute subset size.

参数:
paraBooleanArray - The given boolean array.
返回:
the size of the attribute subset.

intToBooleanArray

public static boolean[] intToBooleanArray(int paraInt,
                                          int paraLength)
Convert an integer value to a boolean array.

参数:
paraInt - The given long value.
paraLength - The given length of the array.
返回:
A boolean array to indicate which positions (bits) are included.

booleanArrayToInt

public static int booleanArrayToInt(boolean[] paraBooleanArray)
                             throws java.lang.Exception
Convert a boolean array to an int value.

参数:
paraBooleanArray - The given boolean array.
返回:
An integer to indicate which positions (bits) are included.
抛出:
java.lang.Exception

printIntArray

public static void printIntArray(int[] paraIntArray)
Print an int array, simply for test.

参数:
paraIntArray - The given int array.

printLongArray

public static void printLongArray(long[] paraLongArray)
Print a long array, simply for test.

参数:
paraLongArray - The given long array.

printLongArrayNoZero

public static void printLongArrayNoZero(long[] paraLongArray)
Print a long array, zero is not printed. Simply for test.

参数:
paraLongArray - The given long array.

printAllReducts

public static void printAllReducts(boolean[][] paraAllReducts)
Print all reducts.

参数:
paraAllReducts - The given array to print.

printBooleanArray

public static void printBooleanArray(boolean[] paraBooleanArray)
Print a boolean array.


printBooleanMatrix

public static void printBooleanMatrix(boolean[][] paraBooleanMatrix)
Print a boolean matrix.


printDoubleArray

public static void printDoubleArray(double[] paraDoubleArray)
Print a double array.


swap

public static void swap(double[] paraDoubleArray,
                        int src,
                        int dest)
                 throws java.lang.Exception
Swap two value in a double array.

参数:
paraDoubleArray - The given double array.
src - The first index of the double array.
dest - The second index of the double array.
抛出:
java.lang.Exception

swap

public static void swap(long[] paraLongArray,
                        int src,
                        int dest)
                 throws java.lang.Exception
Swap two value in a long array.

参数:
paraLongArray - The given long array.
src - The first index of the long array.
dest - The second index of the long array.
抛出:
java.lang.Exception

swap

public static void swap(int[] paraLongArray,
                        int src,
                        int dest)
                 throws java.lang.Exception
Swap two value in a long array.

参数:
paraLongArray - The given long array.
src - The first index of the long array.
dest - The second index of the long array.
抛出:
java.lang.Exception

longArrayToBooleanMatrix

public static boolean[][] longArrayToBooleanMatrix(long[] paraLongArray,
                                                   int paraLength)
Long array to boolean matrix.

参数:
paraLongArray - The given long array.
paraLength - The length of each long.
返回:
the boolean matrix

isSubset

public static boolean isSubset(long paraFirstSet,
                               long paraSecondSet,
                               int paraAttributes)
                        throws java.lang.Exception
Is the first set a subset of the second one.

参数:
paraFirstSet - The first set in long.
paraSecondSet - The second set in long.
paraAttributes - Number of attributes.
返回:
is the first set a subset of the second one?
抛出:
java.lang.Exception

isSubset

public static boolean isSubset(int[] paraFirstSet,
                               int[] paraSecondSet)
                        throws java.lang.Exception
Is the first set a subset of the second one.

参数:
paraFirstSet - The first set in int array.
paraSecondSet - The second set in int array.
返回:
is the first set a subset of the second one?
抛出:
java.lang.Exception

isSubset

public static boolean isSubset(boolean[] paraFirstSet,
                               boolean[] paraSecondSet)
                        throws java.lang.Exception
Is the first set a subset of the second one.

参数:
paraFirstSet - The first set in boolean array.
paraSecondSet - The second set in boolean array.
返回:
is the first set a subset of the second one?
抛出:
java.lang.Exception

longToBitString

public static java.lang.String longToBitString(long paraLong)
Convert a long value to a bit string.

参数:
paraLong - The given long value.
返回:
the bit string.

getSubsetSize

public static int getSubsetSize(boolean[] paraSubset)
Return the size of the subset. It is the true values in the array.

参数:
paraSubset - A subset with the form of a boolean array.
返回:
The size.

getSubsetSize

public static int getSubsetSize(long paraSubset)
Return the size of the subset. It is the true values in the array.

参数:
paraSubset - A subset with the form of a long.
返回:
The size.

subSetCheck

public static char subSetCheck(long paraFirstSet,
                               long paraSecondSet,
                               int paraNumberOfConditions)
Check Who is who's subset.

参数:
paraFirstSet - the first set in long.
paraSecondSet - the second set in long.
paraNumberOfConditions - the number of conditions.
返回:
'0' means no relationship, '1' means the second is the subset, '2' means the first is the subset, '3' means equal.

booleanMatrixToString

public static java.lang.String booleanMatrixToString(boolean[][] tempMatrix)
Convert a boolean matrix to string


generateBooleanArrayForDivision

public static boolean[] generateBooleanArrayForDivision(int paraDatasetSize,
                                                        double paraPercentage)
                                                 throws java.lang.Exception
Generate a boolean array to divide a dataset in two

参数:
paraDatasetSize - the dataset size
paraPercentage - the percentage of the first subset
抛出:
java.lang.Exception

revertBooleanArray

public static boolean[] revertBooleanArray(boolean[] paraArray)
Revert a boolean array.

参数:
paraArray - the given array
返回:
reverted array.

removeSupersets

public static long[] removeSupersets(long[] paraSets,
                                     int paraNumberOfConditions)
                              throws java.lang.Exception
Remove supersets, used to obtain reducts.

参数:
paraSets - the subsets with each one represented by a long value.
paraNumberOfConditions - the number of condition of the dataset
返回:
a set of reducts without superflous attributes.
抛出:
java.lang.Exception

setIntersection

public static int[] setIntersection(int[] paraFirstSet,
                                    int[] paraSecondSet)
                             throws java.lang.Exception
Set intersection. The sets should be sorted.

参数:
paraFirstSet - The first set indicated by numbers for indices.
paraSecondSet - The second set indicated by numbers for indices.
返回:
a set for the intersection.
抛出:
java.lang.Exception

isAscendingOrder

public static boolean isAscendingOrder(int[] paraArray)
Is the given array in an ascending order?

参数:
paraArray - The int array.
返回:
true if it is ascending (equal values permitted).

isUpperTriangleBooleanMatrix

public static boolean isUpperTriangleBooleanMatrix(boolean[][] paraMatrix)
Judge whether or not the given boolean matrix is upper triangle one.

参数:
paraMatrix - The given boolean matrix.
返回:
The constructed String.

main

public static void main(java.lang.String[] args)
Testing method.

参数:
args -