private static void project(Vector<String> vec) { if (vec.size() != 1) { System.out.println("USAGE: 'project' takes exactly 1 argument. " + vec.size() + " given."); } else { if (!Repl.projects.containsKey(vec.elementAt(0))) { System.out.println(vec.elementAt(0) + " is not a valid project!"); } else { ProjectImpl project = Repl.projects.get(vec.elementAt(0)); List<Task> completed = project.getCompletedTasks(); System.out.println( "Current Task: " + project.getNextTask().getName() + "\nCompleted Tasks:"); for (Task t : completed) { System.out.print(t.getName() + ": "); System.out.println("\tpublisher: " + t.getManagerName()); System.out.print("\tworkers: "); for (Worker w : t.getWorkers()) { System.out.print(w.getName() + " "); } System.out.println("\n\tresources used: "); for (Resource r : t.getNeededResources()) { System.out.print(r.getName() + " "); } System.out.println("\n\twork needed: " + t.getSize() + " hours."); } } } Repl.nextCommand(Repl.commands, Repl.SC); }
private static void departmentManager(Vector<String> vec) { if (vec.size() != 1) { System.out.println( "USAGE: 'departmentManager' takes exactly 1 argument. " + vec.size() + " given."); } else { if (!Repl.managers.containsKey(vec.elementAt(0))) { System.out.println(vec.elementAt(0) + " is not a valid manager!"); } else { Manager manager = Repl.managers.get(vec.elementAt(0)); Project currentProject = manager.getCurrentProject(); String projectName; if (currentProject == null) { System.out.println("Current Project: None."); Repl.nextCommand(Repl.commands, Repl.SC); return; } projectName = currentProject.getName(); System.out.println("Current Project: " + projectName + "."); Task curTask = currentProject.getNextTask(); System.out.println("Current Task Info: "); System.out.print("\tworkers: "); for (Worker w : curTask.getWorkers()) { System.out.print(w.getName() + " "); } System.out.println( "\n\tAmount of work still needed: " + curTask.getHoursStillNeeded() + " hours."); System.out.println("\tTotal Work for this Task: " + curTask.getSize() + " hours."); } } Repl.nextCommand(Repl.commands, Repl.SC); }