public class ShellImpl
extends java.lang.Object
Constructor and Description |
---|
ShellImpl()
To create a ShellImpl object.
|
ShellImpl(Jaskell runtime,
java.lang.String greeting)
To create a ShellImpl object.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getGreeting()
Get the greeting text.
|
Jaskell |
getRuntime()
Get the Jaskell runtime used to evaluate expressions.
|
protected java.lang.Object |
getUserVariable(java.lang.String name)
Get the value of a user defined variable.
|
protected int |
getUserVariableCount()
To get the number of variables defined by user.
|
protected java.lang.String[] |
getUserVariableNames()
Get the user variable names.
|
protected boolean |
hasUserVariable(java.lang.String name)
To determine if a certain variable is defined by user.
|
void |
interaction()
Interpret commands and expressions interactively.
|
protected void |
onExit()
called when the shell exits.
|
protected void |
onStartup()
Called when the shell starts up.
|
void |
runShell(java.lang.String[] args)
Run the shell using an array of command line arguments.
|
void |
setGreeting(java.lang.String greeting)
To set the greeting message.
|
void |
setRuntime(Jaskell runtime)
To set the Jaskell runtime used by the shell.
|
public ShellImpl(Jaskell runtime, java.lang.String greeting)
runtime
- the Jaskell runtime object.greeting
- the greeting message when shell starts up.public ShellImpl()
setRuntime(Jaskell)
will need to be called before the shell is started up.
public void runShell(java.lang.String[] args)
If one argument is provided, it is treated as a file name and the file is interpreted, otherwise, commands are interpreted interactively/
args
- the command line arguments.protected java.lang.Object getUserVariable(java.lang.String name)
name
- the variable name.protected boolean hasUserVariable(java.lang.String name)
name
- the variable name.protected int getUserVariableCount()
protected java.lang.String[] getUserVariableNames()
public void interaction()
public java.lang.String getGreeting()
public Jaskell getRuntime()
public void setRuntime(Jaskell runtime)
runtime
- the jaskell runtime to use.public void setGreeting(java.lang.String greeting)
greeting
- the greeting message.protected void onExit()
protected void onStartup()