package worldofzuul;

import java.util.HashMap;

/**
 * @author  Michael Kolling and David J. Barnes
 * @version 2006.03.30
 */

public class CommandWords {
    private HashMap<String, CommandWord> validCommands;

    public CommandWords() {
        validCommands = new HashMap<String, CommandWord>();
        for(CommandWord command : CommandWord.values()) {
            if(command != CommandWord.UNKNOWN) {
                validCommands.put(command.toString(), command);
            }
        }
    }

    public CommandWord getCommandWord(String commandWord) {
        CommandWord command = validCommands.get(commandWord);
        if(command != null) {
            return command;
        } else {
            return CommandWord.UNKNOWN;
        }
    }

    public boolean isCommand(String aString) {
        return validCommands.containsKey(aString);
    }

    public void showAll() {
        for(String command : validCommands.keySet()) {
            System.out.print(command + "  ");
        }
        System.out.println();
    }
}

@@ -122,16 +122,17 @@
 30%0A */%0A%0A
+%0A
 public c
@@ -151,16 +151,64 @@
 Words %7B%0A
+    /**%0A     * A list of valid commands%0A     */%0A
     priv
@@ -255,16 +255,185 @@
 mmands;%0A
+    %0A    /**%0A     * Creating an instance of CommandWords%0A     * Creating an empty list %0A     * Validating if the commandword is known%0A     * Storing if its valid%0A     */
 %0A    pub
@@ -566,24 +566,25 @@
 .values()) %7B
+ 
 %0A           
@@ -620,16 +620,19 @@
 KNOWN) %7B
+   
 %0A       
@@ -710,32 +710,201 @@
         %7D%0A    %7D%0A
+    %0A    /**%0A     * Creating a getter method for CommandWord%0A     * @param commandWord%0A     * @return if command != null return command otherwise return unknown %0A     */
 %0A    public Comm
@@ -1137,24 +1137,168 @@
     %7D%0A    %7D%0A
+    %0A    /**%0A     * Creating a boolean expression %0A     * @param aString%0A     * @return true if valid commands contains the given string%0A     */
 %0A    public 
@@ -1390,16 +1390,75 @@
 ;%0A    %7D%0A
+    %0A    /**%0A     * Printing all available commands%0A     */
 %0A    pub

Add javadoc commandwords (#3)