Class CampList

All Implemented Interfaces:
IFilterableByAttendee<Camp>, IFilterableByCampCommittee<Camp>, IFilterableByDateRange<Camp>, IFilterableByID<Camp>, IFilterableBySchool<Camp>, IFilterableByStudent<Camp>, IFilterableByVisibility<Camp>, ISerializable, ISortableByEndDate<Camp>, ISortableByID<Camp>, ISortableByLocation<Camp>, ISortableByName<Camp>, ISortableByRegistrationCloseDate<Camp>, ISortableByStartingDate<Camp>, Iterable<Camp>
Direct Known Subclasses:
CampDetails

Represents a list of camps, providing functionality for filtering and sorting camps based on various criteria. This class extends RepositoryList and implements several interfaces for filtering and sorting.
  • Constructor Details

    • CampList

      public CampList(List<Camp> all)
      Constructs a new CampList with the specified list of camps.
      Parameters:
      all - A list of Camp objects to be managed.
    • CampList

      public CampList()
      Constructs an empty CampList.
  • Method Details

    • filterByID

      public CampList filterByID(String id)
      Filters the list of camps by the specified ID.
      Specified by:
      filterByID in interface IFilterableByID<Camp>
      Parameters:
      id - The ID to filter by.
      Returns:
      A new CampList containing camps that match the given ID.
    • filterBySchool

      public CampList filterBySchool(String school)
      Filters the list of camps by the specified school.
      Specified by:
      filterBySchool in interface IFilterableBySchool<Camp>
      Parameters:
      school - The school to filter by.
      Returns:
      A new CampList containing camps associated with the given school.
    • filterByVisibility

      public CampList filterByVisibility(boolean visible)
      Filters the list of camps by their visibility status.
      Specified by:
      filterByVisibility in interface IFilterableByVisibility<Camp>
      Parameters:
      visible - The visibility status to filter by.
      Returns:
      A new CampList containing camps with the specified visibility status.
    • filterByDateRange

      public CampList filterByDateRange(Date startDate, Date endDate)
      Filters the list of camps within a specific date range.
      Specified by:
      filterByDateRange in interface IFilterableByDateRange<Camp>
      Parameters:
      startDate - The start date of the range.
      endDate - The end date of the range.
      Returns:
      A new CampList containing camps within the specified date range.
    • filterByRegistrationDate

      public CampList filterByRegistrationDate(Date currentDate)
      Filters the list of camps by registration date.
      Parameters:
      currentDate - The date to compare registration dates against.
      Returns:
      A new CampList containing camps whose registration date is on or after the specified date.
    • filterByStudent

      public CampList filterByStudent(Student student)
      Filters the list of camps by a specific student attendee.
      Specified by:
      filterByStudent in interface IFilterableByStudent<Camp>
      Parameters:
      student - The student to filter by.
      Returns:
      A new CampList containing camps that the given student is attending.
    • filterByStaff

      public CampList filterByStaff(Staff staff)
      Filters the list of camps by a specific staff member in charge.
      Parameters:
      staff - The staff member to filter by.ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffsssssssssssssssssssssssssssssssssssssssssssss
      Returns:
      A new CampList containing camps managed by the given staff member.
    • filterByCampCommittee

      public CampList filterByCampCommittee(Student student)
      Description copied from interface: IFilterableByCampCommittee
      Filters items based on the specified camp committee member (e.g., student).
      Specified by:
      filterByCampCommittee in interface IFilterableByCampCommittee<Camp>
      Parameters:
      student - The student representing a camp committee member whose membership is used as a filter criterion.
      Returns:
      A RepositoryList containing items filtered by the specified camp committee member.
    • filterByAttendee

      public CampList filterByAttendee(Student attendee)
      Description copied from interface: IFilterableByAttendee
      Filters items based on the specified attendee (e.g., student).
      Specified by:
      filterByAttendee in interface IFilterableByAttendee<Camp>
      Parameters:
      attendee - The student whose attendance is used as a filter criterion.
      Returns:
      A RepositoryList containing items filtered by the specified attendee.
    • sortByName

      public CampList sortByName()
      Sorts the list of camps by their names.
      Specified by:
      sortByName in interface ISortableByName<Camp>
      Returns:
      A new CampList sorted by camp names.
    • sortByRegistrationCloseDate

      public CampList sortByRegistrationCloseDate()
      Sorts the list of camps by their registration close dates.
      Specified by:
      sortByRegistrationCloseDate in interface ISortableByRegistrationCloseDate<Camp>
      Returns:
      A new CampList sorted by camp registration close dates.
    • sortByStartingDate

      public CampList sortByStartingDate()
      Sorts the list of camps by their starting dates.
      Specified by:
      sortByStartingDate in interface ISortableByStartingDate<Camp>
      Returns:
      A new CampList sorted by camp starting dates.
    • sortByEndDate

      public CampList sortByEndDate()
      Sorts the list of camps by their end dates.
      Specified by:
      sortByEndDate in interface ISortableByEndDate<Camp>
      Returns:
      A new CampList sorted by camp end dates.
    • sortByLocation

      public CampList sortByLocation()
      Sorts the list of camps by their locations.
      Specified by:
      sortByLocation in interface ISortableByLocation<Camp>
      Returns:
      A new CampList sorted by camp locations.
    • sortByID

      public CampList sortByID()
      Sorts the list of camps by their IDs.
      Specified by:
      sortByID in interface ISortableByID<Camp>
      Returns:
      A new CampList sorted by camp IDs.
    • getAll

      public CampList getAll()
      Returns all camps in the list.
      Returns:
      This CampList.
    • toArray

      public Camp[] toArray()
      Converts the CampList to an array of Camp objects.
      Overrides:
      toArray in class RepositoryList<Camp>
      Returns:
      An array of Camp objects.
    • serialize

      public ArrayList<ArrayList<String>> serialize()
      Description copied from interface: ISerializable
      Serializes the object into a list of lists of strings.
      Specified by:
      serialize in interface ISerializable
      Returns:
      An ArrayList containing lists of strings representing the serialized data.