package admin;

import java.util.Collection;
import users.*;
/**
 * The Administration object is derived from Section 2.8, Administration. An
 * administrator can have one or more grader users to help in the grading of
 * tests. The administrator manually manages the collection of graders.
 */
public abstract class Administration {
  /**
   * The graders data field contains all the graders that the administrator has
   * in one or more courses.
   */
  Collection<Grader> graders;

  /**
   * AddGrader adds a grader to one or more courses, and it can be seen in
   * Figures 2.8.1 - 2.8.4.
   *
    pre:
      //
      // The grader object is not empty
      //
      grader != null;

    post:
      //
      // The given grader is in this.graders.
      //
      graders'.contains(grader)

        &&

      //
      // All the other graders in the output collection are those from the
      // input collection, and only those.
      //
      forall (Grader gr;
            graders'.contains(gr) iff
                (gr == grader ||
                 graders.contains(gr)));
   *
   */
  void addGrader(Grader grader) {
    graders.contains(grader);
  }
  /* SPEST PROBLEM:
     The checker outputs what seem to be the following incorrect errors:

   Invalid invocation: contains(antlr.TestGenerator$arguments_return@433c7a9f) at line: 31  at character: 15
   Invalid invocation: contains(antlr.TestGenerator$arguments_return@51f69e3c) at line: 40  at character: 21
   no viable alternative at input 'UP' at line: 41 at character: 24
   Expected type: null, but found: boolean at line: 40 character: 35
   found: graders  expecting: <UP> at line: 42 at character: 18
   Expected type: null, but found: boolean at line: 33 character: 9
Validating: Grade.java

     javac is OK with the code in the addGrader method body.

   */
  /**
   * EditGrader edits the information of a grader that already exists in the
   * colleciton of graders, and it can be seen in Figure 2.8.4.
   *
    pre:
      //
      // The grader object is not empty and it exists in collection of graders.
      //
      (grader != null) && (graders.contains(grader));

    post:
      //
      // The given grader is not removed from this.graders.
      //
      graders'.contains(grader)

        &&

      //
      // All the other graders in the output collection are those from the
      // input collection, and only those.
      //
      forall (Grader gr;
            graders'.contains(gr) iff
                (gr == grader ||
                 graders.contains(gr)));
   *
   */
  abstract void editGrader(Grader grader);

  /**
   * RemoveGrader removes a grader that already exists in the collection of
   * graders, and it can be seen in Figures 2.8.4 and 2.8.5.
   *
    pre:
      //
      // The given grader is in the collection of graders.
      //
      graders.contains(grader);

    post:
      //
      // A grader is in the output collection of graders if and only if it is
      // not the grader to be removed and it is in the input collection of
      // graders.
      //
      forall (Grader gr_other ;
            graders'.contains(gr_other) iff
                !gr_other.equals(grader) && graders.contains(gr_other));
   *
   */
  abstract void removeGrader(Grader grader);
}