org.jagatoo.commands
Class CommandsRegistry<C extends Command>

java.lang.Object
  extended by org.jagatoo.commands.CommandsRegistry<C>

public abstract class CommandsRegistry<C extends Command>
extends java.lang.Object

This is a base class for a registry of available Commands.


Field Summary
protected  java.util.HashMap<java.lang.String,C> commandsMap
           
 
Constructor Summary
CommandsRegistry()
           
 
Method Summary
protected  void addCommand(C command)
           
 Command getCommandByID(int commandID)
           
 int getCommandID(Command command)
           
 C parseCommand(java.lang.String str)
           
 C valueOf(java.lang.String key)
           
 java.lang.Object[] values()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandsMap

protected final java.util.HashMap<java.lang.String,C extends Command> commandsMap
Constructor Detail

CommandsRegistry

public CommandsRegistry()
Method Detail

addCommand

protected void addCommand(C command)

getCommandID

public final int getCommandID(Command command)
Parameters:
command -
Returns:
the ID assotiated with the given Command.

getCommandByID

public final Command getCommandByID(int commandID)
Parameters:
commandID -
Returns:
the Command assotiated with the given commandID.

values

public final java.lang.Object[] values()

valueOf

public final C valueOf(java.lang.String key)

parseCommand

public final C parseCommand(java.lang.String str)