forked from npaton/gogtfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfarerule.go
51 lines (45 loc) · 3.02 KB
/
farerule.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package gtfs
// fare_rules.txt
// This file is optional. The fare_rules table allows you to specify how fares in fare_attributes.txt apply to an itinerary.
// Most fare structures use some combination of the following rules:
// - Fare depends on origin or destination stations.
// - Fare depends on which zones the itinerary passes through.
// - Fare depends on which route the itinerary uses.
// For examples that demonstrate how to specify a fare structure with fare_rules.txt and fare_attributes.txt,
// see FareExamples in the GoogleTransitDataFeed open source project wiki: http://code.google.com/p/googletransitdatafeed/wiki/FareExamples
type FareRule struct {
// fare_id - Required. The fare_id field contains an ID that uniquely identifies a fare class. This value is referenced from the fare_attributes.txt file.
Id string
// route_id - Optional. The route_id field associates the fare ID with a route. Route IDs are referenced from the
// routes.txt file. If you have several routes with the same fare attributes, create a row in fare_rules.txt for each route.
// For example, if fare class "b" is valid on route "TSW" and "TSE", the fare_rules.txt file would contain these rows for the fare class:
// b,TSW
// b,TSE
RouteId string
// origin_id - Optional. The origin_id field associates the fare ID with an origin zone ID. Zone IDs are referenced from
// the stops.txt file. If you have several origin IDs with the same fare attributes, create a row in fare_rules.txt for each origin ID.
// For example, if fare class "b" is valid for all travel originating from either zone "2" or zone "8", the fare_rules.txt file would
// contain these rows for the fare class:
// b, , 2
// b, , 8
OriginId string // Zone
// destination_id - Optional. The destination_id field associates the fare ID with a destination zone ID. Zone IDs are referenced
// from the stops.txt file. If you have several destination IDs with the same fare attributes, create a row in fare_rules.txt for
// each destination ID.
// For example, you could use the origin_ID and destination_ID fields together to specify that fare class "b" is valid for travel
// between zones 3 and 4, and for travel between zones 3 and 5, the fare_rules.txt file would contain these rows for the fare class:
// b, , 3,4
// b, , 3,5
DestinationId string // Zone
// contains_id - Optional. The contains_id field associates the fare ID with a zone ID, referenced from the stops.txt file.
// The fare ID is then associated with itineraries that pass through every contains_id zone.
// For example, if fare class "c" is associated with all travel on the GRT route that passes through zones 5, 6, and 7 the
// fare_rules.txt would contain these rows:
// c,GRT,,,5
// c,GRT,,,6
// c,GRT,,,7
// Because all contains_id zones must be matched for the fare to apply, an itinerary that passes through zones 5 and 6 but
// not zone 7 would not have fare class "c". For more detail, see FareExamples in the GoogleTransitDataFeed project wiki.
ContainsId string // Zone
feed *Feed
}