edu.cmu.sphinx.util
Class SocketCommandInterpreter

java.lang.Object
  extended by java.lang.Thread
      extended by edu.cmu.sphinx.util.SocketCommandInterpreter
All Implemented Interfaces:
java.lang.Runnable

public class SocketCommandInterpreter
extends java.lang.Thread

This class is a command interpreter. It reads strings from an input stream, parses them into commands and executes them, results are sent back on the output stream.

See Also:
CommandInterpreter

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SocketCommandInterpreter(int port)
          Creates a command interpreter at the given port.
 
Method Summary
 void add(java.lang.String name, CommandInterface command)
          Adds the given command to the command list.
static void main(java.lang.String[] args)
          manual tester for the command interpreter.
 void run()
           
 void setStopAcceptConnections()
          Stops this SocketCommandInterpreter from accepting connections.
 void setTrace(boolean trace)
          Sets the trace mode of the command interpreter.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SocketCommandInterpreter

public SocketCommandInterpreter(int port)
Creates a command interpreter at the given port.

Parameters:
port - the port to create the command interpreter
Method Detail

add

public void add(java.lang.String name,
                CommandInterface command)
Adds the given command to the command list.

Parameters:
name - the name of the command.
command - the command to be executed.

run

public final void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

setStopAcceptConnections

public void setStopAcceptConnections()
Stops this SocketCommandInterpreter from accepting connections. Effectively stops this thread.


setTrace

public void setTrace(boolean trace)
Sets the trace mode of the command interpreter.

Parameters:
trace - true if tracing.

main

public static void main(java.lang.String[] args)
manual tester for the command interpreter.