public class CommandHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
boolean |
EchoCommands
Whether to echo commands to screen
|
protected java.util.Set<java.lang.String> |
ElementalProperties
Which elemental properties to use when calculating features
|
protected java.lang.String |
ElementalPropertyDirectory
Directory that contain elemental property lookup files
|
long |
StartTime
Holds start time of default timer
|
protected Workspace |
Workspace
Keep track of which variables have been created
|
Constructor and Description |
---|
CommandHandler() |
Modifier and Type | Method and Description |
---|---|
protected void |
assignment(java.util.List<java.lang.String> Command)
Handle variable assignment
|
static java.lang.String[] |
convertCommandToString(java.util.List<java.lang.Object> Command)
Convert a command (List<Object>) to string.
|
protected java.util.List<java.lang.Object> |
expandTextCommand(java.util.List<java.lang.String> TextCommand)
Given a text command, change any word marked with a "$" in the front
to the corresponding variable.
|
java.util.List<java.lang.String> |
getCitationDescriptions(java.lang.String variableName)
Print out citation information associated with a single variable
|
protected void |
handlePrinting(java.util.List<java.lang.String> Command)
Run commands that require printing something to screen.
|
protected void |
handleSaving(java.util.List<java.lang.String> Command)
Save objects to disk as various formats.
|
protected void |
handleSettings(java.util.List<java.lang.String> Command)
Handles commands that change global settings
|
static java.lang.Object |
instantiateClass(java.lang.String ClassType,
java.util.List<java.lang.Object> Options)
Create new instance of a class given type and options.
|
void |
printCitations(java.util.List<java.lang.String> command)
Run command to print out citations.
|
void |
readFile(java.lang.String Filename)
Reads commands from a text file
|
void |
runCommand(java.util.List<java.lang.String> TextCommand)
Given a command, run some actions
|
protected java.lang.Object |
runCommandOnVariable(java.lang.String variableName,
java.util.List<java.lang.Object> Command)
Pass commands to variables.
|
protected static java.lang.String |
runEvaluationCommand(java.util.List<java.lang.Object> Command)
Run an evaluation command.
|
protected java.lang.String |
runTimerCommand(java.util.List<java.lang.String> Command)
Run a certain time command.
|
protected final Workspace Workspace
protected final java.util.Set<java.lang.String> ElementalProperties
public boolean EchoCommands
public long StartTime
protected java.lang.String ElementalPropertyDirectory
protected static java.lang.String runEvaluationCommand(java.util.List<java.lang.Object> Command) throws java.lang.Exception
Usage: $<model> $<dataset> <entries...>
model: Model used to make predictions
dataset: Dataset template used to generate attributes
entries...: Strings representing entries to evaluate
Command
- Command to evaluatejava.lang.Exception
public static java.lang.Object instantiateClass(java.lang.String ClassType, java.util.List<java.lang.Object> Options) throws java.lang.Exception
ClassType
- Full name of class to create minus "magpie"Options
- Array specifying option commands (can be empty/null)java.lang.Exception
- For various reasonspublic static java.lang.String[] convertCommandToString(java.util.List<java.lang.Object> Command)
Object.toString()
Command
- Command to be convertedpublic void runCommand(java.util.List<java.lang.String> TextCommand)
TextCommand
- List of words that comprise a commandprotected java.util.List<java.lang.Object> expandTextCommand(java.util.List<java.lang.String> TextCommand) throws java.lang.Exception
TextCommand
- Command as a list of text wordsjava.lang.Exception
protected void assignment(java.util.List<java.lang.String> Command) throws java.lang.Exception
Command
- Command to be parsedjava.lang.Exception
- If something goes wrongprotected void handleSettings(java.util.List<java.lang.String> Command) throws java.lang.Exception
Command
- Command to be parsedjava.lang.Exception
- For various reasonsprotected java.lang.Object runCommandOnVariable(java.lang.String variableName, java.util.List<java.lang.Object> Command) throws java.lang.Exception
variableName
- Name of variable to act onCommand
- Command to be executedjava.lang.Exception
- If execution failspublic void readFile(java.lang.String Filename)
Filename
- Path of file to readprotected void handlePrinting(java.util.List<java.lang.String> Command) throws java.lang.Exception
Expects commands to be of the form: print <variable name> <command> [<options>]
Command
- Print commands to be parsedjava.lang.Exception
- For various reasonsprotected java.lang.String runTimerCommand(java.util.List<java.lang.String> Command) throws java.lang.Exception
Command
- Timer command to be parsedjava.lang.Exception
protected void handleSaving(java.util.List<java.lang.String> Command) throws java.lang.Exception
Command
- Command to be parsedjava.lang.Exception
public void printCitations(java.util.List<java.lang.String> command) throws java.lang.Exception
Usage: citations [<variable names...>]
command
- Command to be runjava.lang.Exception
- If variables are not found in workspacepublic java.util.List<java.lang.String> getCitationDescriptions(java.lang.String variableName) throws java.lang.Exception
variableName
- Variable to be assessedjava.lang.Exception
- If variable not found