Class CourseGetter


  • public class CourseGetter
    extends java.lang.Object
    Class for filtering / searching for courses in an ArrayList by different attributes like name, frequency, or teacher last name

    Allows the use of method chaining

    Version:
    1.0
    • Constructor Detail

      • CourseGetter

        public CourseGetter​(java.util.List<Course> courses)
        Creates the CourseGetter with a preliminary list of Courses
        Parameters:
        courses - ArrayList to search through
    • Method Detail

      • limitByName

        public CourseGetter limitByName​(java.lang.String name)
        Limits remaining courses to have the exact name
        Parameters:
        name - Exact name to find
        Returns:
        this CourseGetter with updated information
      • containsByName

        public CourseGetter containsByName​(java.lang.String name)
        Limits remaining courses to contain the name
        Parameters:
        name - Name to find
        Returns:
        this CourseGetter with updated information
      • limitByFrequency

        public CourseGetter limitByFrequency​(java.lang.String courseFrequency)
        Limits remaining courses to have the exact frequency
        Parameters:
        courseFrequency - Exact frequency to find
        Returns:
        this CourseGetter with updated information
      • containsByFrequency

        public CourseGetter containsByFrequency​(java.lang.String courseFrequency)
        Limits remaining courses to contain the frequency
        Parameters:
        courseFrequency - Frequency to find
        Returns:
        this CourseGetter with updated information
      • limitByTeacherLastName

        public CourseGetter limitByTeacherLastName​(java.lang.String teacherLastName)
        Limits remaining courses to have the exact teacher last name
        Parameters:
        teacherLastName - Exact last name to find
        Returns:
        this CourseGetter with updated information
      • containsByTeacherLastName

        public CourseGetter containsByTeacherLastName​(java.lang.String teacherLastName)
        Limits remaining courses to contain the teacher last name
        Parameters:
        teacherLastName - Last name to find
        Returns:
        this CourseGetter with updated information
      • results

        public java.util.List<Course> results()
        Returns:
        New ArrayList Object with the results of the filtering
      • size

        public int size()
        Returns the number of results.
        Returns:
        the number of results
      • get

        public Course get​(int index)
        Gets the nth result
        Parameters:
        index - Result number to get
        Returns:
        Result at the requested index
      • first

        public Course first()
        Returns:
        First Course in the results