Last update April 29 at 2:57 a.m.
This object was designed by Dave Sager
Object Overview:
This object is used to take the data entered by the user and send it
to the parser and the command log file (string buffer Executed).
This object takes the information that is typed by the user, whether it
be in the "Command to be executed" field or the Loop window.
After it gets the text from either of these two places it puts the text
into the StringBuffer InProgress so that the command still may be
undone. If there is currently a command stored in the StringBuffer InProgress
then that command is added onto the StringBuffer Executed and the
command typed by the user is put into the StringBuffer InProgress.
The information is then passed to the parser. The parser handles the rest
of the calls needed for execution of the statement.
Private Data:
The string command is used to store the code that is entered
in the command line by the user prior to entry into the the StringBuffer
InProgress. The StringBuffer InProgess holds the most recently
enterd command and only undoable command. The StringBuffer Executed
holds the log of all of the executed and undoable commands.
Methods:
| public void AddText(string command) |
| Overview: Adds the new command to the session text log. |
| Parameters: The command string entered by the user. |
| Pre-conditions: Must be passed a string |
| Post-conditions: The session text log must be updated. |
| Algorithm: Adds text to the StringBuffer Executed. Calls
the method GetTextInProgress() and takes what is returned by the
method and adds it onto the StringBuffer Executed. And then calls
the method SetTextInProgress(string command). Then calls the method
runCommand(string command). |
| Interaction with other objects: None |
| Error Conditions: None |
| Return Value: None |
| public void DisplayText(string command) |
| Overview: Used to display a command in the Command to be executed
field. |
| Parameters: The command string entered by the user. |
| Pre-conditions: Must be passed a string |
| Post-conditions: The string is displayed in the Command to be Executed
field. |
| Algorithm: Calls the java specific command to add text to a field. |
| Interaction with other objects: None |
| Error Conditions: None |
| Return Value: None |
| public void RunCommand(string command) |
| Overview: Parses the input string so that it can be used by our
program. By sending the string command to the Parser Object. |
| Parameters: The command string entered by the user. |
| Pre-conditions: None. |
| Post-conditions: Performs a series of method calls corresponding
to executing the command entered. |
| Algorithm: Calls the command void parse(string command) from
the Parser Object. |
| Interaction with other objects: Interacts with the Parser Object. |
| Error Conditions: None |
| Return Value:None |
| public StringBuffer GetTextExecuted() |
| Overview: Gets the commands that are currently stored in the StringBuffer
Executed. |
| Parameters: None |
| Pre-conditions: None |
| Post-conditions: Must return what is stored in the StringBuffer
Executed. |
| Algorithm: Manipulation of internal data. |
| Interaction with other objects: None |
| Error Conditions: None |
| Return Value: None |
| public StringBuffer GetTextInProgress() |
| Overview: Gets the command that is currently stored in the StringBuffer
InProgress. |
| Parameters: None |
| Pre-conditions: None |
| Post-conditions: Must return what is stored in the StringBuffer
InProgress. |
| Algorithm: Manipulation of internal data. |
| Interaction with other objects: None |
| Error Conditions: None |
| Return Value: None |
| public void SetTextInProgress(string command) |
| Overview: Clears the StringBuffer InProgress. Then takes
the string command and puts it into the StringBuffer InProgress. |
| Parameters: None |
| Pre-conditions: None |
| Post-conditions: Must set what is stored in the StringBuffer
InProgress. |
| Algorithm: Manipulation of internal data. |
| Interaction with other objects: None |
| Error Conditions: None |
| Return Value: None |
| public void SetTextExecuted(string command) |
| Overview: Puts the string command into StringBuffer Executed. |
| Parameters: string command |
| Pre-conditions: None |
| Post-conditions: Must set what is stored in the StringBuffer
Executed. |
| Algorithm: Adds the string command onto the end of StringBuffer
Executed. |
| Interaction with other objects: None |
| Error Conditions: None |
| Return Value: None |
| public void DrawTextWindow() |
| Overview: Opens a pop-up window with a list of all the commands
stored in the StringBuffer Executed. |
| Parameters: None. |
| Pre-conditions: None |
| Post-conditions: Opens a pop-up window with a list of all the commands
stored in the StringBuffer Executed. |
| Algorithm: Manipulation of internal data. |
| Interaction with other objects: None. |
| Error Conditions: None |
| Return Value: None |
| public void EnableLine() |
| Overview: Enables the command line so commands can be entered by
the user. |
| Parameters: None. |
| Pre-conditions: None. |
| Post-conditions: Enables the command line entry field. |
| Algorithm: Calls the checkState(int item) command and then
if the line is disabled calls the void swapState(int item) command
these commands are both located in the Menu Object. |
| Interaction with other objects: Menu Object. |
| Error Conditions: None |
| Return Value: None |
| public void DisableLine() |
| Overview: Disables the command line so commands can not be entered
by the user. |
| Parameters: None. |
| Pre-conditions: A user has chosen to enter text in the loop dialog.
At this point they will not be allowed to enter text
in the command line field and thus we need to disable it. |
| Post-conditions: Disables the command line entry field. |
| Algorithm: Calls the checkState(int item) command and then
if the line is enabled calls the void swapState(int item) command
these commands are both located in the Menu Object. |
| Interaction with other objects: Menu Object. |
| Error Conditions: None |
| Return Value: None |
| public void ClearLog() |
| Overview: Clears the StringBuffers InProgress and Executed. |
| Parameters: None. |
| Pre-conditions: There is a need to clear the log files. |
| Post-conditions: Both the StringBuffers InProgres and Executed
are empty. |
| Algorithm: Take the StringBuffer InProgress and put any empty
string into it. Follow the same procedure for the StringBuffer Executed. |
| Interaction with other objects: None. |
| Error Conditions: None |
| Return Value: None |
