Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByEndTime ¶
type ByEndTime []ScheduledItem
ByEndTime implements sort.Interface based on the EndTime
type ByEndingTime ¶
type ByEndingTime []ExternalItem
ByEndingTime implements sort.Interface based on the EndingTime
func (ByEndingTime) Len ¶
func (a ByEndingTime) Len() int
func (ByEndingTime) Less ¶
func (a ByEndingTime) Less(i, j int) bool
func (ByEndingTime) Swap ¶
func (a ByEndingTime) Swap(i, j int)
type ExternalItem ¶
type ExternalItem struct { Value string // The value of the item; arbitrary. Duration int // The priority of the item in the Max Heap. EndingTime int // Used for sorting items by lowest ending item }
ExternalItem is sent from the caller for scheduling.
type Item ¶
type Item struct { Value string // The value of the item; arbitrary. Priority int // The priority of the item in the queue. // contains filtered or unexported fields }
Item is something we manage in a priority queue.
type PriorityQueue ¶
type PriorityQueue []*Item
A PriorityQueue implements heap.Interface and holds Items.
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Peek ¶
func (pq *PriorityQueue) Peek() interface{}
Peek returns the top item from priority queue
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
Pop pops an item from priority queue
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
Push pushes an item into priority queue. Items are ordered in a priority queue always.
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)
type ScheduledItem ¶
ScheduledItem is the scheduled item post processing
func ScheduleItems ¶
func ScheduleItems(items []ExternalItem) []ScheduledItem
ScheduleItems provides a schedule of maximum items that can be taken contiguously The "item" can be a course or an event
Click to show internal directories.
Click to hide internal directories.