Types

TimetableSolver.DivisionType
Division

Type for representing a division of a timetable.

Constructors

  • Division(grade::Int, section::Int)
  • Division(grade::Int, section::Int, section_str::String)

Fields

  • grade::Int: The grade of the division.
  • section::Int: The section of the division.
  • section_str::String: The section of the division as a string.
  • __str__::String: The precomputed string representation of the division.
source
TimetableSolver.DivisionMethod
Division(grade::Int, section::Int)

Return a division with the given grade and section. section_str is inferred as the nth letter of the alphabet, where n=section.

Call the second constructor with section_str as the third argument.

source
TimetableSolver.DivisionMethod
Division(grade::Int, section::Int, section_str::String)

Return a division with the given grade, section, section string and precomputed string representation.

source
TimetableSolver.TeacherType
Teacher

Type for representing a teacher in the timetable.

Constructors

  • Teacher(name::String, id::String, subjects::Vector{String}, grades::Vector{Int})

Fields

  • name::String: The name of the teacher.
  • id::String: The unique id of the teacher.
  • subjects::Vector{String}: The subjects taught by the teacher.
  • grades::Vector{Int}: The grades taught by the teacher.
  • __str__::String: The precomputed string representation of the teacher.
source
TimetableSolver.TeacherMethod
Teacher(name::String, id::String, subjects::Vector{String}, grades::Vector{Int})

Return a teacher with the given name, id, subjects, grades and precomputed string representation.

source
TimetableSolver.PeriodType
Period

Mutable type for representing a period in the timetable. Empty period is initialized with nothing as both arguments.

Fields

  • subject::Union{String,Nothing}: The subject of the period.
  • teacher::Union{Teacher,Nothing}: The teacher of the period.
source
TimetableSolver.TimetableType
Timetable

Mutable type for representing a timetable.

Constructors

  • Timetable(numperiods::Vector{Int}, subjectcounts::SubjectCounts, teachers::Vector{Teacher}, division::Division)

Fields

  • numperiods::Vector{Int}: The number of periods in each row.
  • subjectcounts::SubjectCounts: The number of times subjects must occur in the timetable, in total.
  • subjects::Vector{String}: The subjects in the timetable.
  • teachers::Vector{Teacher}: The teachers in the timetable.
  • subjectteachers::OrderedDict{String, Vector{Teacher}}: The teachers teaching each subject.
  • teacher_strs::OrderedDict{String, Teacher}: The teachers' string representations mapped to objects.
  • division::Division: The division of the timetable.
  • data::Vector{Vector{Period}}: The timetable data, as a vector of vectors of periods.

Notes

  • Only fields numperiods, subjectcounts, teachers and division are passed. The rest are inferred.
  • See the constructor for the same.
source
TimetableSolver.TimetableMethod
Timetable(numperiods::Vector{Int}, subjectcounts::SubjectCounts, teachers::Vector{Teacher}, division::Division)

Return a timetable with the given number of periods, subject counts, teachers and division.

Notes

  • Fields subjects, subjectteachers, teacher_strs and data are inferred.
  • data stores the actual vector of vectors of periods, initialized with (nothing, nothing) as arguments.
source
TimetableSolver.get_subjectteachersMethod
get_subjectteachers(subjects::Vector{String}, teachers::Vector{Teacher})

Return an OrderedDict mapping subjects to valid teachers, based on subjects and teachers.

source
Base.stringMethod
Base.string(tt::Timetable)::String

Base.string method for type Timetable.

Return a pretty table representation of the timetable.

Notes

  • Use the PrettyTables library to return a table-like string.
  • Rows are numbered from 1 to length(data) and columns are numbered P1, P2 ... to longest row in data (max(length.(data)...)).
  • Column 1 header is the division name.
  • Call division and teacher's Base.string method for string representation.
source
TimetableSolver.ScheduleType
Schedule

Mutable type for representing a schedule, i.e., a collection of timetables.

Constructors

  • Schedule(timetables...)

Fields

  • data::OrderedDict{String,Timetable}: The timetables in the schedule mapped to their division's string representation.
source
TimetableSolver.ScheduleMethod
Schedule(timetables...)

Return a schedule instance using the given timetables.

Notes

data is an OrderedDict mapping division's string representation to the timetable.

source
Base.stringMethod
Base.string(s::Schedule)::String

Base.string method for type Schedule.

Return pretty table representation of the timetables.

Notes

  • Call the Base.string method for each timetable in the schedule and fill newlines in between.
source
TimetableSolver.modify!Method
modify!(s::Schedule, var::String, val::String)

Modify schedule s by replacing the value of the field var with val.

Notes

  • Modify the schedule s in place.
  • Both var and val are strings.
  • Call modify!() on the correct timetable in s with the same arguments.
source
TimetableSolver.modify!Method
modify!(tt::Timetable, var::String, val::String)

Modify timetable tt by replacing the value of the field var with val.

Notes

  • Modify the timetable tt in place.
  • Both var and val are strings.
  • Row, period and type of variable are inferred by splitting var at "_", and taking last 3 elements.
  • If type == "subject" then the subject of the corresponding row and period is set to val.
  • If type == "teacher" then the teacher of the corresponding row and period is set to val (after getting teacher object from teacher string using tt.teacher_strs).
source