|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.statcato.utils.HelperFunctions
public class HelperFunctions
Miscellaneous utilities functions.
Constructor Summary | |
---|---|
HelperFunctions()
|
Method Summary | |
---|---|
static java.util.Vector<java.lang.Double> |
addConstantVector(java.util.Vector<java.lang.Double> numbers,
double c)
Returns a copy of a vector of double values in which a constant is added to each element. |
static java.lang.Object[] |
ComputeCategoryFrequency(java.util.Vector<Cell> vec)
Given a vector of cells, computes the frequency of each category present in the vector. |
static java.util.Vector<java.lang.Double> |
ComputeClassFrequency(java.util.Vector<java.lang.Double> column,
java.util.Vector<java.lang.Double> limits)
Return a vector containing the frequency of each class delimited by the given vector of upper class limits. |
static java.util.Vector<java.lang.Double> |
ComputeDiffVector(java.util.Vector<java.lang.Double> vector1,
java.util.Vector<java.lang.Double> vector2)
Computes the pairwise differences between elements in two vector of numbers and returns a vector of the pairwise differences. |
static java.util.TreeMap |
ComputeFrequency(java.util.Vector<java.lang.Double> vec)
Given a vector of double values, computes the frequency of each value present in the vector. |
static java.util.Vector<java.lang.String> |
ConvertCellVectorToStringVector(java.util.Vector<Cell> vector)
|
static double[] |
ConvertDoubleVectorToArray(java.util.Vector<java.lang.Double> vector)
Converts a vector of Double values to an array of double values. |
static java.util.Vector<java.lang.String> |
ConvertDoubleVectorToString(java.util.Vector<java.lang.Double> vector)
Convert a vector of Double to a vector of String. |
static java.util.Vector<java.lang.Double> |
ConvertInputVectorToDoubles(java.util.Vector<Cell> vector)
Converts a vector of Cell to a vector of Double. |
static java.lang.Object[] |
ConvertInputVectorToNumbers(java.util.Vector<Cell> vector)
Converts a vector of Cell to a vector of numbers. |
static java.lang.Object[] |
ConvertInputVectorToNumbers2(java.util.Vector<Cell> vector)
Converts a vector of Cell to a vector of numbers. |
static int[] |
ConvertIntegerVectorToArray(java.util.Vector<java.lang.Integer> vector)
Converts a vector of Integer values to an array of integervalues. |
static java.lang.String |
convertVectorToString(java.util.Vector vec)
Converts the contents of a vector to a string, each item separated by a space. |
static java.lang.String |
formatFloat(double num)
Returns a string format of a double. |
static java.lang.String |
formatFloat(java.lang.Double num)
Returns a string format of a Double using formatFloat(double) . |
static java.lang.String |
formatFloat(double num,
int places)
Returns a string format of a double with a specified number of decimal places. |
static java.lang.String |
formatFloat2(double num)
Returns a string format of a double. |
static java.lang.String |
getCellValue(org.apache.poi.hssf.usermodel.HSSFCell cell)
Returns the value of a HSSFCell as a string. |
static java.lang.String |
getCurrentTimeString()
Returns a string representing the current date and time (mmddyyyyhhss). |
static java.lang.String |
getDateTime()
Returns a string of formatted date and time. |
static java.lang.String |
getFileContents(java.io.File file)
Returns a string of textual data stored in the given file. |
static int |
getNumDecimalPlaces(java.lang.String s)
|
static java.lang.String |
getVersionNumberFromWeb()
Returns the current version number from the Statcato web site. |
static boolean |
isEmptyVector(java.util.Vector vec)
Returns true iff the given vector is empty (i.e. |
static java.util.Vector<java.lang.Double> |
logVector(java.util.Vector<java.lang.Double> numbers)
Returns a copy of a vector of Double in which each element is replaced by its natural logarithm. |
static java.lang.String |
parseCSV(java.lang.String str)
Parses a string of comma-separated values and converts it into a string of tab-delimited values. |
static java.util.Vector<java.lang.String> |
parseString(java.lang.String str)
Returns a vector of substrings in the given input string. |
static java.util.Vector<java.lang.Double> |
powerVector(java.util.Vector<java.lang.Double> numbers,
double power)
Returns a copy of a vector of Double in which each element is raised to a given power. |
static java.util.Vector<java.lang.Double> |
powerVector(java.util.Vector<java.lang.Double> numbers,
int power)
Returns a copy of a vector of Double in which each element is raised to a given power. |
static java.lang.String |
printDoubleVectorToString(java.util.Vector<java.lang.Double> vec)
|
static void |
printVector(java.util.Vector vec)
Displays to standard output the contents of a vector. |
static void |
printVectors(java.util.Vector<java.util.Vector<Cell>> vec)
Prints the contents of a vector of vectors to the standard output. |
static java.lang.String |
printVectorToString(java.util.Vector vec)
|
static java.util.Vector<java.lang.String> |
readExcelFile(java.io.File file)
Reads an Excel file and returns its contents as a vector of strings of tab-delimited values. |
static java.util.Vector<Cell> |
removeEndingEmptyCells(java.util.Vector<Cell> vector)
Returns a copy of a vector of Double in which all the null elements at the end are removed. |
static java.util.Vector<java.lang.Double> |
removeEndingNullValues(java.util.Vector<java.lang.Double> numbers)
Returns a copy of a vector of Double in which all the null elements at the end are removed. |
static java.util.Vector<Cell> |
removeNullCells(java.util.Vector<Cell> numbers)
Returns a copy of a vector of Cell in which all the null elements are moved. |
static java.util.Vector<java.lang.Double> |
removeNullValues(java.util.Vector<java.lang.Double> numbers)
Returns a copy of a vector of Double in which all the null elements are removed. |
static void |
showErrorDialog(javax.swing.JFrame frame,
java.lang.String message)
Displays an error dialog with the given message. |
static java.lang.Object[] |
splitValuesVector(java.util.Vector<Cell> Values)
Given a vector of two possible values, separate the vector of values corresponding to the labels into two vectors. |
static java.lang.Object[] |
splitValuesVectorByLabels(java.util.Vector<Cell> Labels,
java.util.Vector<Cell> Values)
Given a vector of two possible population labels and a vector of values, separate the vector of values corresponding to the labels into two vectors. |
static void |
writeFile(javax.swing.JFrame frame,
java.lang.String extensionDescription,
java.lang.String extension,
java.lang.String contents)
Opens a file chooser and saves specified contents to a file with a specified extension. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HelperFunctions()
Method Detail |
---|
public static boolean isEmptyVector(java.util.Vector vec)
vec
- Vector object
public static double[] ConvertDoubleVectorToArray(java.util.Vector<java.lang.Double> vector)
vector
- vector of Double
public static int[] ConvertIntegerVectorToArray(java.util.Vector<java.lang.Integer> vector)
vector
- vector of Integer
public static java.util.Vector<java.lang.Double> ConvertInputVectorToDoubles(java.util.Vector<Cell> vector)
vector
- vector of Cell
public static java.util.Vector<java.lang.Double> ComputeDiffVector(java.util.Vector<java.lang.Double> vector1, java.util.Vector<java.lang.Double> vector2)
vector1
- vector of Doublevector2
- vector of Double, assumed to have the same size as vector1
public static void printVector(java.util.Vector vec)
vec
- a vector to be displayedpublic static java.lang.String printVectorToString(java.util.Vector vec)
public static java.lang.String printDoubleVectorToString(java.util.Vector<java.lang.Double> vec)
public static void printVectors(java.util.Vector<java.util.Vector<Cell>> vec)
vec
- vector of vectors of Cellpublic static java.lang.String convertVectorToString(java.util.Vector vec)
vec
- vector
public static java.lang.Object[] ConvertInputVectorToNumbers(java.util.Vector<Cell> vector)
vector
- vector of Cell
public static java.util.Vector<java.lang.String> ConvertCellVectorToStringVector(java.util.Vector<Cell> vector)
public static java.lang.Object[] ConvertInputVectorToNumbers2(java.util.Vector<Cell> vector)
ConvertInputVectorToNumbers(Vector)
, but
count all elements in the vector in the total count.
vector
- vector of Cell
ConvertInputVectorToNumbers(Vector)
public static java.util.Vector<java.lang.String> ConvertDoubleVectorToString(java.util.Vector<java.lang.Double> vector)
vector
- vector of Double
public static java.util.Vector<java.lang.Double> removeNullValues(java.util.Vector<java.lang.Double> numbers)
numbers
- vector of Double
public static java.util.Vector<java.lang.Double> removeEndingNullValues(java.util.Vector<java.lang.Double> numbers)
numbers
- vector of Double
public static java.util.Vector<Cell> removeEndingEmptyCells(java.util.Vector<Cell> vector)
vector
- vector of Double
public static java.util.Vector<Cell> removeNullCells(java.util.Vector<Cell> numbers)
numbers
- vector of Cell
public static java.util.Vector<java.lang.Double> powerVector(java.util.Vector<java.lang.Double> numbers, int power)
numbers
- vector of Doublepower
- integer to which each element in the vector is raised
public static java.util.Vector<java.lang.Double> powerVector(java.util.Vector<java.lang.Double> numbers, double power)
numbers
- vector of Doublepower
- to which each element in the vector is raised
public static java.util.Vector<java.lang.Double> logVector(java.util.Vector<java.lang.Double> numbers)
numbers
- vector of Double
public static java.util.Vector<java.lang.Double> addConstantVector(java.util.Vector<java.lang.Double> numbers, double c)
numbers
- vector of Doublec
- constant to be added
public static void writeFile(javax.swing.JFrame frame, java.lang.String extensionDescription, java.lang.String extension, java.lang.String contents)
frame
- parent frameextensionDescription
- string description of the file extensionextension
- file extensioncontents
- string contents to be savedpublic static java.lang.String getFileContents(java.io.File file)
file
- file containing data
public static java.lang.String parseCSV(java.lang.String str)
str
- string of comma-separated values
public static java.util.Vector<java.lang.String> readExcelFile(java.io.File file)
file
- Excel file
public static java.lang.String getCellValue(org.apache.poi.hssf.usermodel.HSSFCell cell)
cell
- HSSFCell
public static void showErrorDialog(javax.swing.JFrame frame, java.lang.String message)
frame
- frame of the dialogmessage
- message to be displayed in the dialogpublic static java.lang.String getDateTime()
public static java.lang.String formatFloat2(double num)
num
- double value to be formatted
public static java.lang.String formatFloat(double num)
num
- double value to be formatted
public static java.lang.String formatFloat(java.lang.Double num)
formatFloat(double)
.
num
- Double to be formatted into a string
formatFloat(double)
public static java.lang.String formatFloat(double num, int places)
num
- double value to be formatted into a stringplaces
- decimal places
formatDecimal(double, int)
public static java.lang.Object[] splitValuesVectorByLabels(java.util.Vector<Cell> Labels, java.util.Vector<Cell> Values) throws java.lang.Exception
Labels
- Values
-
java.lang.Exception
public static java.lang.Object[] splitValuesVector(java.util.Vector<Cell> Values) throws java.lang.Exception
Values
-
java.lang.Exception
public static java.lang.Object[] ComputeCategoryFrequency(java.util.Vector<Cell> vec)
vec
- a vector of Cell
public static java.util.TreeMap ComputeFrequency(java.util.Vector<java.lang.Double> vec)
vec
- a vector of Cell
public static java.util.Vector<java.lang.Double> ComputeClassFrequency(java.util.Vector<java.lang.Double> column, java.util.Vector<java.lang.Double> limits)
column
- a vector of numbers to be separated into classeslimits
- a vector of numbers representing the upper class limits
public static java.util.Vector<java.lang.String> parseString(java.lang.String str)
str
- string to be parsed
public static int getNumDecimalPlaces(java.lang.String s)
public static java.lang.String getVersionNumberFromWeb()
public static java.lang.String getCurrentTimeString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |