28 lines
557 B
Go
28 lines
557 B
Go
|
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
|
||
|
}
|