edu.cmu.sphinx.util
Class SocketCommandInterpreter

java.lang.Object
  extended byjava.lang.Thread
      extended byedu.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

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, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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()

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.