datasources/mtr/bus/BusStop.go
raw ยท 786 bytes
package bus
type BusStop struct {
RouteId string
Direction string
StationSeq int
StationId string
Latitude float64
Longtitude float64
Name *map[string] string
RouteStops *map[int] *BusStop
}
func ( busStop BusStop ) PrevStop() *BusStop {
if v, hasKey := (*busStop.RouteStops)[ busStop.StationSeq - 1 ]; hasKey {
return v
}
return nil
}
func ( busStop BusStop ) NextStop() *BusStop {
if v, hasKey := (*busStop.RouteStops)[ busStop.StationSeq + 1 ]; hasKey {
return v
}
return nil
}
type ByRouteId []BusStop
func (a ByRouteId) Len() int { return len(a) }
func (a ByRouteId) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByRouteId) Less(i, j int) bool { return a[i].RouteId < a[j].RouteId }