|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.problets.domain.Library
public class Library
Class for methods to be used by multiple classes
Constructor Summary | |
---|---|
Library()
|
Method Summary | |
---|---|
static void |
copyExplanationVector(java.util.Vector fromVector,
java.util.Vector toVector)
|
static void |
copyStringVector(java.util.Vector fromVector,
java.util.Vector toVector)
|
static void |
extractTable(java.util.Vector newTable,
java.lang.String token,
java.util.Vector identifierTable)
|
static java.util.Vector |
flattenVector(java.util.Vector sourceVector)
Flattens a vector of vectors into a single vector, inserting a blank string between elements |
static java.util.Vector |
getAllSelectedOptions(java.io.BufferedReader input,
java.util.Vector options)
Given a vector of options, lets user choose multiple options and returns the chosen options. |
static java.util.Vector |
getAllSelectedOptions(java.util.Vector options)
|
static java.lang.String |
getClassInstanceFieldValue(java.lang.String className,
java.lang.Object classInstance,
java.lang.String fieldName)
Returns the value of any public field of String type of any class |
static java.lang.String |
getComplementString(int currentSize,
int maxSize)
|
static java.util.Vector |
getFileNames(java.lang.String path,
java.lang.String extension)
Returns a list of the names of files with the given extension at the given path |
static java.lang.String |
getLanguageString(int language)
|
static int |
getMaxLength(java.lang.String[] stringArray)
Method returns the length of the longest string in the string array |
static int |
getNumericResponse(java.io.BufferedReader input,
java.lang.String question)
|
static int |
getNumericResponse(java.lang.String question)
Returns the numeric input from the user |
static int |
getNumLinesInString(java.lang.String content)
Returns the number of lines in the string, based on \n, i.e., the number of the line where the cursor will end up after printing the string |
static java.lang.String |
getOrdinalString(int num)
Given a number, returns its ordinality as a string, with a space afterwards |
static java.lang.String |
getResponse(java.io.BufferedReader input,
java.lang.String question)
|
static java.lang.String |
getResponse(java.lang.String question)
Given a question, get an answer to it and return it |
static java.lang.String |
getSelectedOption(java.io.BufferedReader input,
java.lang.String[] options)
|
static java.lang.String |
getSelectedOption(java.io.BufferedReader input,
java.util.Vector options)
Presents the options, validates user choice and returns the choice as the ordinality of the choice |
static java.lang.String |
getSuffixedNumber(int number)
Given a number, returns it with its ordinal suffix |
static boolean |
getYesNo(java.io.BufferedReader input,
java.lang.String question)
|
static boolean |
getYesNo(java.lang.String question)
Given a question, get a yes/no answer to it and return true/false correspondingly |
static boolean |
hasIntersection(boolean[] correctAnswerArray,
boolean[] userAnswerArray)
|
static boolean |
hasIntersection(java.util.Vector firstVector,
java.util.Vector secondVector)
|
static void |
insertTable(java.util.Vector identifierTable,
java.lang.String token,
java.lang.String name)
|
static void |
insertTable(java.util.Vector identifierTable,
java.lang.String token,
java.lang.String name,
int insertionIndex)
|
static boolean |
isAnElementOf(java.lang.String selectedAnswer,
java.lang.String correctAnswer)
|
static boolean |
isEquivalent(java.lang.String selectedAnswer,
java.lang.String correctAnswer)
|
static boolean |
isEquivalentArray(boolean[] correctAnswerArray,
boolean[] userAnswerArray)
|
static boolean |
isSupersetArray(boolean[] correctAnswerArray,
boolean[] userAnswerArray)
|
static boolean |
isSupersetOf(java.lang.String selectedAnswer,
java.lang.String correctAnswer)
|
static void |
main(java.lang.String[] args)
|
static int |
nthIndexOf(java.lang.String string,
java.lang.String key,
int count)
|
static void |
printAnyVector(java.lang.String header,
java.util.Vector text)
|
static void |
printVector(java.lang.String header,
java.util.Vector text)
|
static void |
printVectorIndexed(java.util.Vector text)
|
static java.util.Vector |
readFromFile(java.lang.String path,
java.lang.String fileName,
java.lang.String commentPrefix)
This method returns a vector containing the contents of a resource file included with the Jar file It strips all comments and blank lines from the file It also trims each entry. |
static java.util.Vector |
readFromLocalFile(java.lang.String path,
java.lang.String fileName)
This method returns a vector containing the contents of a file included with Jar file. |
static void |
recursivePrint(java.util.Vector explanation)
|
static void |
saveVectorInFile(java.lang.String path,
java.lang.String fileName,
java.util.Vector data)
Saves the given vector to the given file, one element per line |
static void |
shuffle(java.util.Vector data)
Shuffles the vector of n elements 3n times |
static java.util.Vector |
string2Vector(java.lang.String content,
java.lang.String delimiter)
Given a string, returns a vector of its "elements" as separated by delimiter |
static int |
toInteger(java.lang.String entry)
Given a string, returns the number represented by the string, -1 if it is not a number |
static java.lang.String |
toPrecision(double value,
int precision)
|
static java.lang.String[] |
vector2Array(java.util.Vector content)
For any vector to whose contents toString() can be applied, returns a corresponding array of strings. |
static java.lang.String |
vector2String(java.util.Vector content)
Given a vector of strings, return a single string concatenating all the elements |
static java.lang.String |
vector2String(java.util.Vector content,
int start,
int finish)
|
static java.lang.String |
xmlEnclose(java.lang.String content,
java.lang.String tagSpecifier)
Returns the content enclosed in open and close tag specifier |
static java.lang.String |
xmlEnclose(java.util.Vector contents,
java.lang.String contentTag,
java.lang.String elementTag)
Return all elements of a vector enclosed in XML format |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Library()
Method Detail |
---|
public static boolean isAnElementOf(java.lang.String selectedAnswer, java.lang.String correctAnswer)
public static boolean isSupersetOf(java.lang.String selectedAnswer, java.lang.String correctAnswer)
public static boolean hasIntersection(boolean[] correctAnswerArray, boolean[] userAnswerArray)
public static boolean hasIntersection(java.util.Vector firstVector, java.util.Vector secondVector)
public static boolean isSupersetArray(boolean[] correctAnswerArray, boolean[] userAnswerArray)
public static boolean isEquivalentArray(boolean[] correctAnswerArray, boolean[] userAnswerArray)
public static boolean isEquivalent(java.lang.String selectedAnswer, java.lang.String correctAnswer)
public static java.util.Vector flattenVector(java.util.Vector sourceVector)
public static void saveVectorInFile(java.lang.String path, java.lang.String fileName, java.util.Vector data)
public static java.util.Vector readFromFile(java.lang.String path, java.lang.String fileName, java.lang.String commentPrefix)
public static java.util.Vector readFromLocalFile(java.lang.String path, java.lang.String fileName)
public static java.util.Vector getFileNames(java.lang.String path, java.lang.String extension)
public static java.lang.String getOrdinalString(int num)
public static java.lang.String getSuffixedNumber(int number)
public static void shuffle(java.util.Vector data)
public static java.lang.String toPrecision(double value, int precision)
value
- Real double valueprecision
- int Desired precision for the real number
Returns the value correct to precision digits after the decimal pointpublic static java.lang.String vector2String(java.util.Vector content)
public static java.lang.String vector2String(java.util.Vector content, int start, int finish)
public static java.lang.String[] vector2Array(java.util.Vector content)
public static int getNumLinesInString(java.lang.String content)
public static java.util.Vector string2Vector(java.lang.String content, java.lang.String delimiter)
public static int nthIndexOf(java.lang.String string, java.lang.String key, int count)
string
- The string to be searchedkey
- The key to be located in the stringcount
- The number of occurrences of key to be located in string
public static java.lang.String xmlEnclose(java.lang.String content, java.lang.String tagSpecifier)
public static java.lang.String xmlEnclose(java.util.Vector contents, java.lang.String contentTag, java.lang.String elementTag)
contentTag
- the tag for the whole group of elementselementTag
- the tag for each individual element
public static int toInteger(java.lang.String entry)
public static java.lang.String getLanguageString(int language)
public static java.lang.String getClassInstanceFieldValue(java.lang.String className, java.lang.Object classInstance, java.lang.String fieldName)
className
- String representing the name of the class. The case is important.classInstance
- Object whose field value we want. If the field is static, this will be null.fieldName
- String representing the field name whose value is desired. This must be a String type. The case is not important.
public static void extractTable(java.util.Vector newTable, java.lang.String token, java.util.Vector identifierTable)
public static void insertTable(java.util.Vector identifierTable, java.lang.String token, java.lang.String name)
public static void insertTable(java.util.Vector identifierTable, java.lang.String token, java.lang.String name, int insertionIndex)
public static void copyStringVector(java.util.Vector fromVector, java.util.Vector toVector)
public static void copyExplanationVector(java.util.Vector fromVector, java.util.Vector toVector)
public static int getMaxLength(java.lang.String[] stringArray)
public static java.lang.String getComplementString(int currentSize, int maxSize)
public static boolean getYesNo(java.lang.String question)
public static boolean getYesNo(java.io.BufferedReader input, java.lang.String question)
public static java.lang.String getResponse(java.lang.String question)
public static java.lang.String getResponse(java.io.BufferedReader input, java.lang.String question)
public static int getNumericResponse(java.lang.String question)
public static int getNumericResponse(java.io.BufferedReader input, java.lang.String question)
public static java.lang.String getSelectedOption(java.io.BufferedReader input, java.util.Vector options)
public static java.lang.String getSelectedOption(java.io.BufferedReader input, java.lang.String[] options)
public static java.util.Vector getAllSelectedOptions(java.util.Vector options)
public static java.util.Vector getAllSelectedOptions(java.io.BufferedReader input, java.util.Vector options)
public static void printVectorIndexed(java.util.Vector text)
public static void printVector(java.lang.String header, java.util.Vector text)
public static void printAnyVector(java.lang.String header, java.util.Vector text)
public static void recursivePrint(java.util.Vector explanation)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |