|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object finiteAutomata.Util
public class Util
Library of public static utility methods to support the classes in the finiteAutomata package.
Field Summary | |
---|---|
protected static java.util.Scanner |
scanner
Scanner for reading keyboard input |
Constructor Summary | |
---|---|
Util()
|
Method Summary | |
---|---|
static boolean |
answerIsYes()
Reads the next String from keyboard input and decides if it is a "yes" answer. |
static boolean |
hasRepeat(java.lang.String inString)
Returns true if the given string contains at least one repeated character. |
static boolean |
hasWhiteSpace(java.lang.String inString)
Returns true if the given string contains at least one whitespace character. |
static int |
intLogTwo(int n)
Returns the nearest integer to log-base-2 of the given integer. |
static double |
logTwo(int n)
Returns log-base-two of the given integer. |
static void |
main(java.lang.String[] args)
|
static void |
printString(java.lang.String inString)
Prints "epsilon" if the given String is empty; otherwise, prints the given String. |
static boolean |
readBoolean()
Repeatedly prompts user to enter TRUE or FALSE. |
static int |
readNum()
Reads the next String from keyboard input and parses it as a non-negative integer. |
static java.lang.String |
readString()
Returns the next String read from keyboard input. |
protected static int |
stringToInt(java.lang.String s)
Returns the integer value of the given (short) string of digits. |
static int |
twoPower(int n)
Returns the given power of 2. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static java.util.Scanner scanner
Constructor Detail |
---|
public Util()
Method Detail |
---|
public static int twoPower(int n)
n
- integer power of 2 to be calculated
public static double logTwo(int n)
n
- integer value whose log is to be calculated
public static int intLogTwo(int n)
n
- integer value whose log is to be calculated
public static void printString(java.lang.String inString)
inString
- String to be printedpublic static java.lang.String readString()
public static boolean readBoolean()
public static boolean answerIsYes()
public static int readNum()
protected static int stringToInt(java.lang.String s)
s
- the String of digits to be converted
public static boolean hasWhiteSpace(java.lang.String inString)
inString
- the string to be examined
public static boolean hasRepeat(java.lang.String inString)
inString
- the string to be examined
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |