public PredecessorCommand(WiredTree <T> tree) : base(tree, "predecessor",
                                                      "Get the predecessor of a student (according to his id)",
                                                      new List <Parameter> {
     new Parameter("0", "Student's id")
 })
 {
 }
 public PrintRelatedNodesCommand(WiredTree <T> tree) :
     base(tree, "printRelatedNodes", "Print the sons of a node, including a symbol for wires.",
          new List <Parameter> {
     new Parameter("0", "id")
 })
 {
 }
Beispiel #3
0
 protected Command(WiredTree <T> tree, string commandName, string description, List <Parameter> parameters)
 {
     Tree        = tree;
     CommandName = commandName;
     Description = description;
     Parameters  = parameters;
 }
Beispiel #4
0
 public SearchCommand(WiredTree <T> tree) : base(tree, "search",
                                                 "Searching a student according to his id",
                                                 new List <Parameter> {
     new Parameter("0", "Student's id")
 })
 {
 }
Beispiel #5
0
 public DeleteCommand(WiredTree <T> tree) :
     base(tree, "remove",
          "Removing a student from the wired tree according to it's id.",
          new List <Parameter> {
     new Parameter("0", "Student's id")
 })
 {
 }
Beispiel #6
0
 public RunCommandsFromAFileCommand(WiredTree <T> tree) :
     base(tree, "runCommandsFromFile", "Read commands from a file and execute them" +
          " according to their order.",
          new List <Parameter> {
     new Parameter("0", "path")
 })
 {
 }
Beispiel #7
0
 public InsertCommand(WiredTree <T> tree) :
     base(tree, "insert", "Insert a new student to the wired tree.",
          new List <Parameter> {
     new Parameter("0", "Student's id"),
     new Parameter("1 - 50", "Student's full name")
 })
 {
 }
Beispiel #8
0
 public LoadStudentsFromXmlCommand(WiredTree <T> tree) :
     base(tree, "loadStudentsFromXml", "Replace all the tree data" +
          " with students from XML file. It will be inserted according" +
          " to the order in the XML file.",
          new List <Parameter> {
     new Parameter("0", "path of the xml file.")
 })
 {
 }
        private CommandsRunner()
        {
            var tree = new WiredTree <Student>();

            CommandsDictionary = new Dictionary <string, Command <Student> >
            {
                { "help", new HelpCommand <Student>(tree) },
                { "insert", new InsertCommand <Student>(tree) },
                { "remove", new DeleteCommand <Student>(tree) },
                { "search", new SearchCommand <Student>(tree) },
                { "preorderWalk", new PreorderTreeWalkCommand <Student>(tree) },
                { "inorderWalk", new InorderTreeWalkCommand <Student>(tree) },
                { "postorderWalk", new PostorderTreeWalkCommand <Student>(tree) },
                { "successor", new SuccessorCommand <Student>(tree) },
                { "predecessor", new PredecessorCommand <Student>(tree) },
                { "median", new MedianCommand <Student>(tree) },
                { "max", new MaxCommand <Student>(tree) },
                { "min", new MinCommand <Student>(tree) },
                { "printRelatedNodes", new PrintRelatedNodesCommand <Student>(tree) },
                { "loadStudentsFromXml", new LoadStudentsFromXmlCommand <Student>(tree) },
                { "runCommandsFromFile", new RunCommandsFromAFileCommand <Student>(tree) }
            };
        }
Beispiel #10
0
 public PostorderTreeWalkCommand(WiredTree <T> tree) : base(tree,
                                                            "postorderWalk", "Print the postorder walk of the tree.",
                                                            new List <Parameter>())
 {
 }
 public HelpCommand(WiredTree <T> tree) : base(tree, "help", "Get all the supported commands with a description",
                                               new List <Parameter>())
 {
 }
Beispiel #12
0
 public MinCommand(WiredTree <T> tree) : base(tree, "min",
                                              "Get the minimum of the wired tree.", new List <Parameter>())
 {
 }
Beispiel #13
0
 public MedianCommand(WiredTree <T> tree) :
     base(tree, "median", "Get the median of the tree.", new List <Parameter>())
 {
 }
Beispiel #14
0
 public MaxCommand(WiredTree <T> tree) : base(tree, "max",
                                              "Get the maximum of the wired tree.", new List <Parameter>())
 {
 }