public override void RunApp() { _output = new ConsoleWritter(); var task1 = new Task(true, "first task", DateTime.Now, DateTime.MaxValue); var task2 = new Task(false, "Second task", DateTime.Now, DateTime.Now.Add(new TimeSpan(0, 15, 0))); var list = new ListTask(new List<Task>()); list.AddTask(task1); list.AddTask(task2); _output.WriteLine("List task///"); var iteratorlist = list.GetIterator(); while (iteratorlist.HasNext()) { _output.WriteLine(iteratorlist.Next().ToString()); } _output.WriteLine("Array task///"); var task = new ArrayTask(new[]{task1,task2}, 0); iteratorlist = task.ArrayIterator(); while (iteratorlist.HasNext()) { _output.WriteLine(iteratorlist.Next().ToString()); } }
public ArrayIterator(Task[] task) { _task = task; _count = 0; }
public void AddTask(Task task) { _count++; _tasks[_count]= task; }
public ArrayTask(Task[] tasks, int startcount) { _tasks = tasks; _count = startcount; }