Esempio n. 1
0
 private static void abortProject(Vector<String> vec) {
   if (vec.size() != 1) {
     System.out.println(
         "USAGE: 'abortProject' 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));
       Repl.logger.finer(
           "trying to abort project " + project.getName() + " at " + Helpers.staticTimeNow());
       if (!Repl.completedProjectsSet.contains(project)) {
         // the project hasn't been completed yet.
         if (Repl.executingProjects.containsKey(project)) {
           // someone is working on this project
           Task task = project.getNextTask();
           project.abortProject();
           task.abortTask();
         } else { // the project is pending
           Repl.managerBoard
               .getProjectBox(project.getNextManagerSpecializtion())
               .getProject(project);
         }
       } else {
       }
     }
   }
   Repl.nextCommand(Repl.commands, Repl.SC);
 }
Esempio n. 2
0
 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);
 }