|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsleep.console.ConsoleImplementation
The ConsoleImplementation is the "engine" behind the sleep console. To use the sleep console in your application use
the following steps:
1. Instantiate the console implementation
ConsoleImplementation console;
console = new ConsoleImplementation(environment, variables, loader);
2. Install your implementation of sleep.console.ConsoleProxy into the console
console.setProxy(new MyConsoleProxy());
3. Start the Read, Parse, Print Loop in the console
console.rppl(); // starts the console
ConsoleProxy
,
ScriptLoader
,
Variable
Field Summary | |
protected StringBuffer |
code
current code loaded into the console so far |
static int |
DEFAULT
|
static int |
INPUT_CODE
|
static int |
INTERACT
|
protected int |
lineCount
|
protected int |
mode
the mode the console is currently in, DEFAULT, INPUT_CODE, or QUIT |
protected ConsoleProxy |
myProxy
the user installed console proxy, defining all input/output for the console |
static int |
QUIT
|
protected ScriptInstance |
script
the *active* script... |
protected ScriptLoader |
scriptLoader
the script loader |
protected Hashtable |
sharedEnvironment
the script environment with all of the installed functions, predicates, and environments |
protected Variable |
sharedVariables
the shared variable container for all scripts, assuming variables are being shared |
protected boolean |
showLines
|
Constructor Summary | |
ConsoleImplementation()
Creates an implementation of the sleep console. |
|
ConsoleImplementation(Hashtable _sharedEnvironment,
Variable _sharedVariables,
ScriptLoader _loader)
Creates an implementation of the sleep console that shares what your application is already using. |
Method Summary | |
void |
append(String text)
|
boolean |
canContinue()
|
void |
clear()
|
String |
getCode()
|
int |
getMode()
|
ConsoleProxy |
getProxy()
|
void |
handleCommand(String inputstr)
|
void |
processScriptErrors(YourCodeSucksException ex)
a convienence method that formats and writes each syntax error to the proxy output |
void |
processScriptWarning(ScriptWarning warning)
fired when a runtime warning has occured. |
void |
prompt()
|
void |
quickExecute(String command)
|
void |
rppl()
starts the console |
boolean |
scriptLoaded(ScriptInstance script)
called when a script is loaded |
boolean |
scriptUnloaded(ScriptInstance script)
called when a script is unloaded |
void |
setMode(int m)
|
void |
setProxy(ConsoleProxy p)
Sets up the implementation of the consoles input/output facilities |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DEFAULT
public static final int INPUT_CODE
public static final int QUIT
public static final int INTERACT
protected int mode
protected ScriptInstance script
protected ConsoleProxy myProxy
protected Hashtable sharedEnvironment
protected Variable sharedVariables
protected ScriptLoader scriptLoader
protected StringBuffer code
protected int lineCount
protected boolean showLines
Constructor Detail |
public ConsoleImplementation()
public ConsoleImplementation(Hashtable _sharedEnvironment, Variable _sharedVariables, ScriptLoader _loader)
_sharedEnvironment
- the environment contains all of the bridges (functions, predicates, and environments)_sharedVariables
- the Variable class is a container for Scalar variables with global, local, and script specific scope_loader
- the Script Loader is a container for managing all of the currently loaded scriptsMethod Detail |
public ConsoleProxy getProxy()
public void setProxy(ConsoleProxy p)
public void append(String text)
public String getCode()
public void clear()
public int getMode()
public boolean canContinue()
public void setMode(int m)
public void prompt()
public void quickExecute(String command)
public void handleCommand(String inputstr)
public void rppl() throws IOException
IOException
public void processScriptErrors(YourCodeSucksException ex)
public void processScriptWarning(ScriptWarning warning)
RuntimeWarningWatcher
processScriptWarning
in interface RuntimeWarningWatcher
public boolean scriptLoaded(ScriptInstance script)
Loadable
scriptLoaded
in interface Loadable
public boolean scriptUnloaded(ScriptInstance script)
Loadable
scriptUnloaded
in interface Loadable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |