internal static InputCommand FactoryMethod(string[] input, InputCommandInvoker invoker) { InputCommand newCommand = null; // check the lengh if (input == null) throw new InvalidInputException(); // // check if parameters is valid // // check setup command switch (input[0]) { // pattern: -st [--setup] “pathXmi” “pathTemplates” “LanguageResult” case "-st": case "--setup": newCommand = new SetupCommand(invoker); break; // pattern: -qt [--queryType] “nameQueryType” -p [--params] “entityA” “entityB” case "-qt": case "--queryType": newCommand = new QueryTypeCommand(invoker); break; // pattern: -lq [--getTypeofQueries] case "-lq": case "--getTypeofQueries": newCommand = new ListTypeofQueriesCommand(invoker); break; // pattern -cst [--currentSetup] case "-cst": case "--currentSetup": newCommand = new CurrentSetupCommand(invoker); break; // pattern -h [--help] case "-h": case "--help": newCommand = new HelpCommand(invoker); break; // When the input is not valid. default: throw new InvalidCommandInputException( string.Concat("'", input[0], "' is not recognized as an command") ); } // check paramter order. if (newCommand != null) newCommand.Input = input; return newCommand; }
public SetupCommand(InputCommandInvoker invoker) : base(invoker) { }
/// <summary> /// Default constructor for InputCommand. /// </summary> /// <param name="invoker"> /// Reference invoker handler. /// </param> public InputCommand(InputCommandInvoker invoker) { this.MyInvoker = invoker; }
public CurrentSetupCommand(InputCommandInvoker invoker) : base(invoker) { }
public HelpCommand(InputCommandInvoker invoker) : base(invoker) { }
public QueryTypeCommand(InputCommandInvoker invoker) : base(invoker) { }
public ListTypeofQueriesCommand(InputCommandInvoker invoker) : base(invoker) { }