Package edu.ucsb.cs156.courses.documents
Class CoursePage
java.lang.Object
edu.ucsb.cs156.courses.documents.CoursePage
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a List of ConvertedSections from json representationstatic CoursePage
Create a CoursePage object from json representationgetListOfPrimaries
(Course course) Given a Course, return a list of Primary objects.Get a list of Primary objects from the CoursePagestatic Section
nextSection
(List<Section> sections, int sectionIndex) Look ahead to the next section if there is one
-
Constructor Details
-
CoursePage
public CoursePage()
-
-
Method Details
-
fromJSON
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
Create a List of ConvertedSections from json representation- Returns:
- a list of converted sections
-
nextSection
Look ahead to the next section if there is one- Parameters:
sections
- List of sectionssectionIndex
- the index of the current section- Returns:
- the next section if it exists, otherwise null
-
getListOfPrimaries
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
Get a list of Primary objects from the CoursePage
-