gov.sandia.ccaffeine.cmd
Class CmdContext

java.lang.Object
  extended by gov.sandia.ccaffeine.cmd.CmdContext
Direct Known Subclasses:
CmdContextCCA, CmdContextCcaOneCommand, CmdContextGUI

public abstract class CmdContext
extends java.lang.Object

The actions for any useful command-line interface ultimately depend on some context information; each specific interpreter will subclass CmdContext differently, and write CmdActions that use interpreter specific data or methods.


Constructor Summary
CmdContext()
           
 
Method Summary
 boolean debug()
          Get the debug switch value.
abstract  java.lang.String getClass(java.lang.String className)
          Interpreter can define a restricted set of classes as qualified for command-line use.
abstract  java.lang.String getInstance(java.lang.String instanceName)
          Interpreter can define a restricted set of instances as qualified for command-line use.
abstract  void p(java.lang.String s)
          Interpreter has a function for writing from a String.
abstract  void pn(java.lang.String s)
          Interpreter has a function for writing line from a String.
abstract  java.lang.String prompt()
          prompt string
abstract  java.lang.String readLine()
          Interpreter has to get input from somewhere, line at a time.
 boolean setDebug(boolean d)
          Set the debug switch value.
 boolean setVerbose(boolean v)
          Set the verbose switch value.
 boolean verbose()
          Get the verbose switch value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmdContext

public CmdContext()
Method Detail

setDebug

public boolean setDebug(boolean d)
Set the debug switch value.


debug

public boolean debug()
Get the debug switch value.


setVerbose

public boolean setVerbose(boolean v)
Set the verbose switch value.


verbose

public boolean verbose()
Get the verbose switch value.


pn

public abstract void pn(java.lang.String s)
Interpreter has a function for writing line from a String.


p

public abstract void p(java.lang.String s)
Interpreter has a function for writing from a String.


prompt

public abstract java.lang.String prompt()
prompt string


readLine

public abstract java.lang.String readLine()
                                   throws java.io.IOException
Interpreter has to get input from somewhere, line at a time. Dearly wish this could support command and name completions.

Throws:
java.io.IOException

getClass

public abstract java.lang.String getClass(java.lang.String className)
Interpreter can define a restricted set of classes as qualified for command-line use. May return null. This takes care of changing approximate class names to exact. If a string is returned, it will be exactly defined in the CmdContext, but the partial-matching is not guaranteed unique.


getInstance

public abstract java.lang.String getInstance(java.lang.String instanceName)
Interpreter can define a restricted set of instances as qualified for command-line use. May return null. This takes care of changing approximate instance names to exact. If a string is returned, it will be exactly defined in the CmdContext, but the partial-matching is not guaranteed unique.