sdr 0.7

net.cscott.sdr
Class CommandInput

java.lang.Object
  extended by net.cscott.sdr.CommandInput

public class CommandInput
extends Object

CommandInput implements the communication between some mechanism for inputting commands (voice recognition, keyboard input, file on disk, etc) and the rest of the SDR system. In particular, we give the CommandInput to the input mechanisms, and our App class will deal with polling it for commands and feeding them to the choreography engine and then to the animation system.

Note that a command is actually a lazy list of possible commands, ordered from most-likely to least-likely. We'll try each possibility and take the first one that works.

Version:
$Id: CommandInput.java,v 1.4 2006-11-10 15:24:20 cananian Exp $
Author:
C. Scott Ananian

Nested Class Summary
static class CommandInput.InputMode
          Representation of different input modes.
static class CommandInput.PossibleCommand
          A CommandInput.PossibleCommand is an Apply corresponding to the most likely interpretation of the user's input.
 
Constructor Summary
CommandInput()
          Create a CommandInput object to synchronize communication between input routines and the choreography engine.
 
Method Summary
 void addCommand(CommandInput.PossibleCommand c)
          Called by input methods (voice recognition, keyboard input, filer readers, etc) when they have another (set of) CommandInput.PossibleCommand(s) to issue.
 CommandInput.PossibleCommand getNextCommand()
          Called by the main code to get the next command from the input method.
 void switchMode(CommandInput.InputMode mode)
          Tell the input method that a new set of calls is valid.
 CommandInput.InputMode waitForMode()
          Get a new input mode, waiting if necessary.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandInput

public CommandInput()
Create a CommandInput object to synchronize communication between input routines and the choreography engine.

Method Detail

addCommand

public void addCommand(CommandInput.PossibleCommand c)
Called by input methods (voice recognition, keyboard input, filer readers, etc) when they have another (set of) CommandInput.PossibleCommand(s) to issue.


getNextCommand

public CommandInput.PossibleCommand getNextCommand()
                                            throws InterruptedException
Called by the main code to get the next command from the input method. Blocks until a possible command is available.

Returns:
the next possible command.
Throws:
InterruptedException

switchMode

public void switchMode(CommandInput.InputMode mode)
Tell the input method that a new set of calls is valid. If the dp parameter is null, then we are at the main menu, waiting for a "square up" command.


waitForMode

public CommandInput.InputMode waitForMode()
Get a new input mode, waiting if necessary.


sdr 0.7

Copyright © 2006-2009 C. Scott Ananian