Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This file was automatically generated by genny.
- // Any changes will be lost if this file is regenerated.
- // see https://github.com/cheekybits/genny
- package example
- // StringQueue represents a queue of string types.
- type StringQueue struct {
- items []string
- }
- // NewStringQueue makes a new empty string queue.
- func NewStringQueue() *StringQueue {
- return &StringQueue{items: make([]string, 0)}
- }
- // Enq adds an item to the queue.
- func (q *StringQueue) Enq(obj string) *StringQueue {
- q.items = append(q.items, obj)
- return q
- }
- // Deq removes and returns the next item in the queue.
- func (q *StringQueue) Deq() string {
- obj := q.items[0]
- q.items = q.items[1:]
- return obj
- }
- // Len gets the current number of string items in the queue.
- func (q *StringQueue) Len() int {
- return len(q.items)
- }
- // IntQueue represents a queue of int types.
- type IntQueue struct {
- items []int
- }
- // NewIntQueue makes a new empty int queue.
- func NewIntQueue() *IntQueue {
- return &IntQueue{items: make([]int, 0)}
- }
- // Enq adds an item to the queue.
- func (q *IntQueue) Enq(obj int) *IntQueue {
- q.items = append(q.items, obj)
- return q
- }
- // Deq removes and returns the next item in the queue.
- func (q *IntQueue) Deq() int {
- obj := q.items[0]
- q.items = q.items[1:]
- return obj
- }
- // Len gets the current number of int items in the queue.
- func (q *IntQueue) Len() int {
- return len(q.items)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement