package edit; import gradebook.*; import items.*; import people.*; import java.util.Collection; /** * The Find class is responsible for managing the Find operation. */ public abstract class Find { /** * The currently open Gradebook. */ Gradebook gradebook; /** * Finds the Student associated with the given name and course. * If courseName is null, the search is performed on all courses. * @param name student name * @param courseName name of course to search in * @return collection of students fitting criteria * *
    pre:
      //
      // The selected Course must either be null or exist in the gradebook.
      //
      courseName == null ||
      exists (Course course; gradebook.courses.contains(course);
              course.name == courseName);

    post:
      //
      // Any students in the returned collection must fit the criteria.
      // Their name must contain the search patterns, and they must be
      // contained in a section within the selected course.
      //
      forall (Student student; return.contains(student);
              exists (Course course; gradebook.courses.contains(course) &&
                            if (courseName != null) course.name == courseName;
                      exists (Section section; course.sections.contains(section);
                              exists (Student student; section.students.contains(student);
                                      student.name.contains(name)))))
    */
   abstract Collection findStudents(String name, String courseName);

   /**
    * Finds the Assignment associated with the given name and course.
    * If courseName is null, the search is performed on all courses.
    * @param name assignment name
    * @param courseName name of course to search in
    * @return collection of assignments matching the criteria
    *
    *                                                             
    pre:
      //
      // The selected Course must either be null or exist in the gradebook.
      //
      courseName == null ||
      exists (Course course; gradebook.courses.contains(course);
              course.name == courseName);

    post:
      //
      // Any Assignments in the returned collection must fit the criteria.
      // Their name must contain the search patterns, and they must be
      // contained in a section within the selected course.
      //
      forall (Assignment assignment; return.contains(assignment);
              exists (Course course; gradebook.courses.contains(course) &&
                            if (courseName != null) course.name == courseName;
                      exists (Assignment assignment; course.assignments.contains(assignment);
                              assignment.name.contains(name))));
    */
   abstract Collection findAssignments(String name, String courseName);
}
/* SPEST PROBLEMS:
   I believe this file has the same kind of problems as in other specs, and I
   expect they'll go away when with the same solution that fixes the other
   specs.  Here are the checker messages:


   Invalid invocation: contains(antlr.TestGenerator$arguments_return@3474ba7c) at line: 30  at character: 47
   Invalid id: name at line: 31  at character: 21
   Expected type: null, but found: null at line: 31 character: 27
   Invalid invocation: contains(antlr.TestGenerator$arguments_return@6f909e7) at line: 40  at character: 55
   Invalid id: name at line: 41  at character: 59
   Expected type: null, but found: null at line: 41 character: 65
   Expected type: null, but found: boolean at line: 40 character: 73
   Invalid id: sections at line: 42  at character: 54
   found: .  expecting:  at line: 42 at character: 63
   found: ;  expecting:  at line: 42 at character: 81
   found: ;  expecting:  at line: 43 at character: 90

*/