Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ProposedSchedule

Hierarchy

Index

Constructors

constructor

Properties

All

colorSlots

colorSlots: Set<string>[] = Array.from({ length: Schedule.colors.length }, () => new Set<string>())

keep track of used colors to avoid color collision

dateSelector

dateSelector: number = -1

the index of the currently selected separator (in dateSeparators)

dateSeparators

dateSeparators: number[] = []

The separator of sections in different time periods, representing different end times of sections. Elements are dates in milliseconds Example:

[1567457860885, 1567458860885]

days

days: ScheduleDays = [[], [], [], [], [], [], []]

computed based on this.All by computeSchedule

events

events: Event[]

totalCredit

totalCredit: number = 0

total credits stored in this schedule, computed based on this.All

Static colors

colors: readonly string[] = colorSchemes[0].colors

Static combineSections

combineSections: boolean = true

Static multiSelect

multiSelect: boolean = true

Static savedColors

savedColors: {}

Type declaration

  • [key: string]: string

Methods

Protected _copy

Private addAllClasses

  • addAllClasses(): void

addEvent

  • addEvent(days: string, display: boolean, title?: undefined | string, room?: undefined | string, description?: undefined | string): Event
  • add an event to this schedule

    throws

    error if an existing event conflicts with this event

    Parameters

    • days: string
    • display: boolean
    • Optional title: undefined | string
    • Optional room: undefined | string
    • Optional description: undefined | string

    Returns Event

allEquals

cancelCompute

  • cancelCompute(): void

checkDate

clean

  • clean(): void

cleanSchedule

  • cleanSchedule(cleanDays?: boolean): void

computeSchedule

  • computeSchedule(sync?: boolean, time?: number): void
  • Compute the schedule view based on this.All and this.preview. If there is a pending compute task, remove that pending task.

    remarks

    this method has a very high time complexity. However, because we're running on small input sets (usually contain no more than 20 sections), it usually completes within 50ms.

    note

    it is the caller's responsibility to call constructDateSeparators, which is necessary if new classes are added

    Parameters

    • Default value sync: boolean = true

      if true, synchronously execute this function, otherwise use setTimeout

    • Default value time: number = 100

      the delay of setTimeout, in milliseconds

    Returns void

constructDateSeparator

  • constructDateSeparator(): void

constructDateSeparatorFromDateList

  • constructDateSeparatorFromDateList(dates: MeetingDate[]): void

copy

deleteEvent

  • deleteEvent(days: string): void

empty

  • empty(): boolean

equals

getSectionGroup

  • getSectionGroup(key: string, section: number): number

has

  • has(key: string, rendered?: boolean): boolean
  • Check whether the given key exists in the Schedule.

    Parameters

    • key: string
    • Default value rendered: boolean = true

      (default to true) if true, only returns true if the course/event with the given key is rendered

    Returns boolean

hasSection

  • hasSection(key: string, section: number): boolean

hover

  • hover(key: string, strong?: boolean): void

isAnySection

  • isAnySection(key: string): boolean

isCourseEmpty

  • isCourseEmpty(key: string): boolean

isGroup

  • isGroup(key: string): boolean

isSomeTBD

  • isSomeTBD(key: string): boolean

preview

Private randEvents

  • randEvents(num?: number, maxDuration?: number, minDuration?: number): void
  • add some random event to the schedule. For testing purposes only

    Parameters

    • Default value num: number = 20
    • Default value maxDuration: number = 240
    • Default value minDuration: number = 20

    Returns void

remove

  • remove(key: string): void

removePreview

  • removePreview(): void

toJSON

ungroup

  • ungroup(key: string): void

unhover

  • unhover(key: string): void

update

  • update(key: string, section: number, groupIdx?: number, remove?: boolean, update?: boolean): void
  • Update a section in the schedule

    • If the section is already in the schedule, delete it from the schedule
    • If the section is not in the schedule, add it to the schedule

    Parameters

    • key: string
    • section: number
    • Default value groupIdx: number = 0
    • Default value remove: boolean = true

      whether to remove the key if the set of sections is empty

    • Default value update: boolean = true

      whether to recompute the schedule after update

    Returns void

Static compressJSON

Static decompressJSON

Static fromJSON

  • instantiate a Schedule object from its JSON representation. the computeSchedule method will not be invoked after instantiation

    Parameters

    Returns NotiMsg<ProposedSchedule>

    NotiMsg, whose level might be one of the following

    1. success: a schedule is successfully parsed from the JSON object
    2. warn: a schedule is successfully parsed, but some of the courses/sections recorded no longer exist in the catalog
    3. error: the object passed in is falsy

Object literals

current

current: object

a computed object that's updated by the computeSchedule method, used by ClassList for rendering purposes

  • courses contain all sections (not just those selected by user)
  • ids are the list of ids selected for a given course

courses

courses: never[] = []

ids

ids: never[] = []

Generated using TypeDoc