Class CoursePage

java.lang.Object
edu.ucsb.cs156.courses.documents.CoursePage

public class CoursePage extends Object
  • Constructor Details

    • CoursePage

      public CoursePage()
  • Method Details

    • fromJSON

      public static CoursePage fromJSON(String json)
      Create a CoursePage object from json representation
      Parameters:
      json - String of json returned by API endpoint /classes/search
      Returns:
      a new CoursePage object
      See Also:
    • convertedSections

      public List<ConvertedSection> convertedSections()
      Create a List of ConvertedSections from json representation
      Returns:
      a list of converted sections
    • nextSection

      public static Section nextSection(List<Section> sections, int sectionIndex)
      Look ahead to the next section if there is one
      Parameters:
      sections - List of sections
      sectionIndex - the index of the current section
      Returns:
      the next section if it exists, otherwise null
    • getListOfPrimaries

      public static List<Primary> getListOfPrimaries(Course course)
      Given a Course, return a list of Primary objects.

      The reason this is necessary is that the UCSB API returns a course with a list of sections. However, that list of sections may contain multiple primary sections, each with its own set of secondary sections.

      This method processes the sections of a course to create a list of Primary objects, each representing a primary section and its associated secondary sections.

      Returns:
      a list of Primary objects
    • getPrimaries

      public List<Primary> getPrimaries()
      Get a list of Primary objects from the CoursePage