Ignore:
Timestamp:
08/30/12 17:04:16 (12 years ago)
Author:
sherbold
Message:
  • added command man that prints manuals of commands to the console
  • added manuals für the commands exec, exit, listCommands, man, and trainMarkovModel
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/java-utils/src/main/java/de/ugoe/cs/util/console/CommandExecuter.java

    r669 r718  
    155155     *         otherwise 
    156156     */ 
    157     private Command loadCMD(String className) { 
     157    public Command loadCMD(String className) { 
    158158        Command cmd = null; 
    159159        try { 
     
    171171        catch (ClassCastException e) { 
    172172            Console.traceln(Level.WARNING, className + "found, but does not implement Command"); 
     173        } 
     174        return cmd; 
     175    } 
     176     
     177    /** 
     178     * <p> 
     179     * Helper method that loads a class and tries to cast it to {@link Command}. 
     180     * </p> 
     181     *  
     182     * @param className 
     183     *            qualified name of the class (including package name) 
     184     * @return if class is available and implement {@link Command} and instance of the class, null 
     185     *         otherwise 
     186     */ 
     187    public Command getCMD(String commandName) { 
     188        Command cmd = null; 
     189        for (int i = 0; cmd == null && i < commandPackageList.size(); i++) { 
     190            cmd = loadCMD(commandPackageList.get(i) + "." + cmdPrefix + commandName); 
     191        } 
     192        if (cmd == null) { // check if command is available as default command 
     193            cmd = loadCMD(defaultPackage + "." + cmdPrefix + commandName); 
    173194        } 
    174195        return cmd; 
Note: See TracChangeset for help on using the changeset viewer.