コード例 #1
0
ファイル: Repl.java プロジェクト: lxmonk/SplAssignment1
 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);
 }
コード例 #2
0
ファイル: Repl.java プロジェクト: lxmonk/SplAssignment1
 private static void addDepartmentManager(Vector<String> vec) {
   if (vec.size() != 2) {
     System.out.println(
         "USAGE: 'addDepartmentManager' takes exactly 2 "
             + "arguments. "
             + vec.size()
             + " given.");
   } else {
     Manager manager =
         new Manager(
             vec.elementAt(0),
             new ManagerSpecialization(vec.elementAt(1)),
             Repl.managerBoard,
             Repl.completedProjectsSet,
             Repl.executingProjects);
     manager.setLogger(Repl.logger);
     manager.setWorkingBoard(Repl.workingBoard);
     Repl.logger.info(manager.getName() + " started working at " + Helpers.staticTimeNow());
     Repl.managers.put(manager.getName(), manager);
     Repl.managersExecutorService.execute(manager);
   }
   Repl.nextCommand(Repl.commands, Repl.SC);
 }