publictransport: bitbucket.org/jamespole/publictransport/busnetwork Index | Files

package busnetwork

import "bitbucket.org/jamespole/publictransport/busnetwork"

Package busnetwork contain types that can be used to describe a bus network.

Index

Package Files

data.go route.go service.go stop.go stopRoute.go

type Data Uses

type Data struct {
    Routes Routes
    Stops  Stops
}

Data is a container for data about a bus network.

type Route Uses

type Route struct {
    ID         int
    LongName   string
    ShortName  string
    StopRoutes StopRoutes
}

Route describes a route.

type Routes Uses

type Routes []*Route

Routes is a collection of pointers to Route(s).

func (Routes) GetByID Uses

func (routes Routes) GetByID(id int) *Route

GetByID returns the route with the given id within routes.

type Service Uses

type Service struct {
    Delay     int
    StopRoute *StopRoute
    Time      time.Time
    Operated  bool
}

Service describes a service.

type Services Uses

type Services []*Service

Services is a collection of pointers to Service(s).

type Stop Uses

type Stop struct {
    ID         int
    Name       string
    Services   Services
    StopRoutes StopRoutes
}

Stop describes a stop.

type StopRoute Uses

type StopRoute struct {
    Stop     *Stop
    Route    *Route
    Services Services
}

StopRoute describes a route passing through a stop. Services are associated with a stop and a route through this type. This allows direct retrieval of services along a specific route stopping at a specific stop.

type StopRoutes Uses

type StopRoutes []*StopRoute

StopRoutes is a collection of pointers to StopRoute(s).

func (StopRoutes) GetByRouteID Uses

func (stopRoutes StopRoutes) GetByRouteID(routeID int) *StopRoute

GetByRouteID returns the stopRoute with the given routeID within stopRoutes.

type Stops Uses

type Stops []*Stop

Stops is a collection of pointers to Stop(s).

func (Stops) GetByID Uses

func (stops Stops) GetByID(id int) *Stop

GetByID returns the stop with the given id within stops. Returns nil if the stop was not found.

Package busnetwork imports 1 packages (graph) and is imported by 4 packages. Updated 2019-04-24. Refresh now. Tools for package owners.