elevator

package
v0.0.0-...-651443f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Elevator

type Elevator struct {
	Id         int        `json:"id"`
	Floor      int        `json:"floor"`
	Passengers mydb.Calls `json:"passengers"`
	Status     string     `json:"status"`

	MaxFloor      int `json:"-"`
	MaxPassengers int `json:"-"`
}

func NewElevator

func NewElevator(n, maxFloor, maxPassengers int) Elevator

func (*Elevator) Close

func (e *Elevator) Close() error

func (*Elevator) Down

func (e *Elevator) Down() error

func (*Elevator) Enter

func (e *Elevator) Enter(call mydb.Call) error

func (*Elevator) Exit

func (e *Elevator) Exit(id int) (*mydb.Call, error)

func (*Elevator) IsFull

func (e *Elevator) IsFull() bool

func (*Elevator) Open

func (e *Elevator) Open() error

func (*Elevator) Stop

func (e *Elevator) Stop() error

func (*Elevator) Up

func (e *Elevator) Up() error

type Elevators

type Elevators struct {
	Token     string `json:"token"`
	Timestamp int    `json:"timestamp"`

	Cars []Elevator `json:"cars"`

	Problem    int        `json:"-"`
	Calls      mydb.Calls `json:"-"`
	LastCallTs int        `json:"-"`

	Inputs  mydb.Calls   `json:"-"`
	Outputs mydb.Outputs `json:"-"`
	Logs    []string     `json:"-"`
	// contains filtered or unexported fields
}

func NewElevators

func NewElevators(problem, carCount int) (*Elevators, error)

func (*Elevators) Close

func (e *Elevators) Close(car int) error

func (*Elevators) Count

func (e *Elevators) Count() int

func (*Elevators) Done

func (e *Elevators) Done()

func (*Elevators) Down

func (e *Elevators) Down(car int) error

func (*Elevators) Enter

func (e *Elevators) Enter(car int, users []int) error

func (*Elevators) Evaluate

func (e *Elevators) Evaluate() (float64, float64, float64, int, error)

func (*Elevators) Exit

func (e *Elevators) Exit(car int, users []int) error

func (*Elevators) GetOnCalls

func (e *Elevators) GetOnCalls() (mydb.Calls, int)

func (*Elevators) IsEnd

func (e *Elevators) IsEnd() bool

func (*Elevators) Logging

func (e *Elevators) Logging(action string, car int)

func (*Elevators) Open

func (e *Elevators) Open(car int) error

func (*Elevators) Stop

func (e *Elevators) Stop(car int) error

func (*Elevators) Tick

func (e *Elevators) Tick()

func (*Elevators) Up

func (e *Elevators) Up(car int) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL