View Javadoc

1   package org.lsst.ccs.command;
2   
3   import java.io.Serializable;
4   
5   /**
6    * A command dictionary contains all the information needed to provide
7    * help and perform tab completion. It does not by itself provide sufficient
8    * functionality to invoke a command, for this a CommandSet which is a combination of a 
9    * command dictionary and a command invoker is required. A CommandDictionary is a collection of
10   * CommandDefinitions, plus a few convenience methods.
11   * @author tonyj
12   */
13  public interface Dictionary extends Iterable<DictionaryCommand>, Serializable {
14  
15      /**
16       * Test if a given command is present in a dictionary.
17       * @param command The command (or alias) to search for
18       * @return <code>true</code>If the command is found
19       */
20      public boolean containsCommand(BasicCommand command);
21      
22      /**
23       * Find a given command in the dictionary
24       * @param command The command (or alias) to search for
25       * @return The DictionaryCommand, or <code>null</code> if 
26       * the command is not found.
27       */
28      public DictionaryCommand findCommand(BasicCommand command);
29  
30      /**
31       * Test if a given command is present in a dictionary
32       * @param command The command (or alias) to search for
33       * @param argumentCount The number of arguments associated with the command
34       * @return <code>true</code>If the command is found
35       */
36      public boolean containsCommand(String command, int argumentCount);
37      
38      /**
39       * Find a given command in the dictionary.
40       * @param command The command (or alias) to search for
41       * @param argumentCount The number of arguments associated with the command
42       * @return The DictionaryCommand, or <code>null</code> if 
43       * the command is not found.
44       */
45      public DictionaryCommand findCommand(String command, int argumentCount);
46  
47      /**
48       * The size of the dictionary.
49       * @return The number of commands in this dictionary.
50       */
51      public int size();  
52  }