|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--TEDParser
| Constructor Summary | |
TEDParser()
|
|
| Method Summary | |
char |
consumeChar(java.lang.StringBuffer currentString)
consumeChar This method returns the first character of the current string. |
java.lang.String |
getState(java.lang.StringBuffer inputLine)
getState This method gets a state out of the input line. |
static void |
main(java.lang.String[] args)
|
boolean |
parseAlphabet(java.lang.StringBuffer workingAlphabet)
parseAlphabet Parser for the alphabet Makes sure the alphabet is properly formated (x,x,x,x,x,x,x) If it is not properly formatted an exception is thrown Makes sure there are no doubles and none of TED's special chars On either occurence an exception will be thrown |
void |
parseError(java.lang.String reason,
java.lang.String fault,
java.lang.String location,
int errorCode)
parseError This method prints a message to the system console when an error is encountered during the parsing of the input. |
void |
parseRuleError(java.lang.String reason,
java.lang.String fault,
int rule,
java.lang.String location,
int errorCode)
parseRuleError This method prints a message to the system console when an error is encountered during the parsing of the rules. |
boolean |
parseRules(java.lang.StringBuffer workingRules)
parseRules Parser for rule set Makes sure the rule set is properly formated {(a,b,c,d,e),(a,b,c,d,e)} and that the first char of a rule is "(" If it is not properly formatted an exception is thrown. |
boolean |
parseTapeInput(java.lang.StringBuffer workingTapeInput)
parseTapeInput Makes sure the tape is properly formatted "@abbba" or "abbba" if it is not properly formatted an exception is thrown Makes sure all the characters being put on the tape are members of the alphabet set. |
boolean |
validate(java.lang.StringBuffer alphabet,
java.lang.StringBuffer tapeInput,
java.lang.StringBuffer rules,
TEDController controller)
Constructor |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public TEDParser()
| Method Detail |
public boolean validate(java.lang.StringBuffer alphabet,
java.lang.StringBuffer tapeInput,
java.lang.StringBuffer rules,
TEDController controller)
alphabet: - this is the alphabet of the Turing MachinetapeInput: - this is the tape of the Turing Machinerules: - this is the rules of the Turing Machinecontroller: - this is the controller class of TEDpublic java.lang.String getState(java.lang.StringBuffer inputLine)
inputLine: - the current working string
public void parseError(java.lang.String reason,
java.lang.String fault,
java.lang.String location,
int errorCode)
reason: - the reason TED experienced an error.fault: - the character which raised the exception.location: - the part of the program in which the error was encounterederrorCode: - the constant value in the error message array for the appropriate error message
public void parseRuleError(java.lang.String reason,
java.lang.String fault,
int rule,
java.lang.String location,
int errorCode)
reason: - the reason TED experienced an error.fault: - the character which raised the exception.rule: - number of the rule in which TED encountered the errorlocation: - the part of the program in which the error was encounterederrorCode: - the constant value in the error message array for the appropriate error messagepublic char consumeChar(java.lang.StringBuffer currentString)
currentString: - this is the string we want to take a character from.public boolean parseAlphabet(java.lang.StringBuffer workingAlphabet)
workingAlphabet: - the current string from which we are parsing the alphabetpublic boolean parseTapeInput(java.lang.StringBuffer workingTapeInput)
workingTapeInput: - the input from the textFieldpublic boolean parseRules(java.lang.StringBuffer workingRules)
rules: - the text input from the textfield.finalAlphabet: - the read/write characters can only come from the
Alphabet so we must check each read/write character.public static void main(java.lang.String[] args)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||