sdr 0.21

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.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 commandFromUnparsed(DanceState ds, String userInput, long startTime, long endTime, CommandInput.PossibleCommand next)
          Create a PossibleCommand from an unparsed user input, along with the 'next worst' PossibleCommand.
 CommandInput.PossibleCommand getNextCommand()
          Called by the main code to get the next command from the input method.
 
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

commandFromUnparsed

public CommandInput.PossibleCommand commandFromUnparsed(DanceState ds,
                                                        String userInput,
                                                        long startTime,
                                                        long endTime,
                                                        CommandInput.PossibleCommand next)
Create a PossibleCommand from an unparsed user input, along with the 'next worst' PossibleCommand. Does the parsing lazily, so that we don't parse unless the "better" PossibleCommands don't work out.


sdr 0.21

Copyright (c) 2006 C. Scott Ananian