|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbin.Parser
public class Parser
Parser Class
This class is used to parse any external files that are loaded into AI Builder.
NB: As most of the code adheres to a particular format, the documentation that accompanies theparseIndividualInstinct()
method is written out only once, in the first instinct
("BlindFire")
code block.
Constructor Summary | |
---|---|
Parser()
Default Constructor for class with no parameters. |
|
Parser(java.lang.String instinct)
Default Constructor for class with 1 parameter. |
|
Parser(java.lang.String instinct,
int numParams)
Default Constructor for class with 2 parameters. |
Method Summary | |
---|---|
void |
parseDocument(javax.swing.JTextArea textArea)
This method begins to parse an entire AI file document, (as represented by the contents of the JTextArea "preview" pane. |
void |
parseIndividualInstinct(java.lang.String individualInstinct,
int lineNumber)
This method parses an individual line of code, attempting to locate a specific instinct within the line, as well as checking parameter count information as applicable to the instinct being parsed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Parser()
public Parser(java.lang.String instinct)
instinct
- The current instinct being parsed.public Parser(java.lang.String instinct, int numParams)
instinct
- The current instinct being parsed.numParams
- How many parameters the current instinct has.Method Detail |
---|
public void parseDocument(javax.swing.JTextArea textArea) throws java.io.FileNotFoundException, java.io.IOException, InstinctException
textArea
- The graphical component that contains the text
that comprises the AI file's contents.
java.io.FileNotFoundException
java.io.IOException
InstinctException
public void parseIndividualInstinct(java.lang.String individualInstinct, int lineNumber) throws java.io.FileNotFoundException, java.io.IOException, InstinctException
This method parses an individual line of code, attempting to locate a specific instinct within the line, as well as checking parameter count information as applicable to the instinct being parsed.
NB: The "Follow" instinct is separated into three sub-section code blocks to evaluate its valid parameter range (this is because "Follow" has three working implementations with 2, 3 and 4 parameter versions (respectively) being shown to function correctly!
individualInstinct
- The name of the specific instinct
currently being parsed.lineNumber
- The number of the line in the file where
the instinct resides (used primarily to obtain a handle on
line-parsing errors, so the user knows exactly where
to look for the error).
java.io.FileNotFoundException
- If the "ai.properties"
resource file (that acts as the program "database") cannot be
located.
java.io.IOException
- If any other possible I/O exception occurs
whilst attempting to find/read a (core resource) file.
InstinctException
- If an error parsing the currnet instinct
occurs, prepare a handle to retrieve all related information
(ready for a meaningful output display to the user).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |