/
GtfsRelationalDao.java
131 lines (101 loc) · 3.69 KB
/
GtfsRelationalDao.java
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* Copyright (C) 2011 Brian Ferris <bdferris@onebusaway.org>
* Copyright (C) 2011 Google, Inc.
* Copyright (C) 2011 Laurent Gregoire <laurent.gregoire@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onebusaway.gtfs.services;
import org.onebusaway.gtfs.model.Agency;
import org.onebusaway.gtfs.model.AgencyAndId;
import org.onebusaway.gtfs.model.FareAttribute;
import org.onebusaway.gtfs.model.FareRule;
import org.onebusaway.gtfs.model.Frequency;
import org.onebusaway.gtfs.model.Route;
import org.onebusaway.gtfs.model.ServiceCalendar;
import org.onebusaway.gtfs.model.ServiceCalendarDate;
import org.onebusaway.gtfs.model.ShapePoint;
import org.onebusaway.gtfs.model.Stop;
import org.onebusaway.gtfs.model.StopTime;
import org.onebusaway.gtfs.model.Trip;
import java.util.List;
/**
* While {@link GtfsDao} has basic methods for retrieving collections of
* entities and entities by id, {@link GtfsRelationalDao} adds some basic
* methods for retrieving entities using more complex data relations.
*
* You can imagine many complex queries that you might perform on GTFS data,
* most of which will not be included here. These are just some basic relational
* methods that we use to bootstrap other GTFS classes. To add more complex
* queries, look at the specific mechanisms provided by classes implementing
* {@link GtfsRelationalDao} and {@link GtfsDao}.
*
* @author bdferris
*/
public interface GtfsRelationalDao extends GtfsDao {
/****
* ServiceId Methods
****/
public List<String> getTripAgencyIdsReferencingServiceId(AgencyAndId serviceId);
/****
* Route Methods
****/
public List<Route> getRoutesForAgency(Agency agency);
/****
* Stop Methods
****/
public List<Stop> getStopsForStation(Stop station);
/****
* {@link Trip} Methods
****/
public List<Trip> getTripsForRoute(Route route);
public List<Trip> getTripsForShapeId(AgencyAndId shapeId);
public List<Trip> getTripsForServiceId(AgencyAndId serviceId);
public List<Trip> getTripsForBlockId(AgencyAndId blockId);
/****
* {@link StopTime} Methods
****/
/**
* @return the list of {@link StopTime} objects associated with the trip,
* sorted by {@link StopTime#getStopSequence()}
*/
public List<StopTime> getStopTimesForTrip(Trip trip);
/**
* @return the list of {@link StopTime} objects associated with the specified
* {@link Stop}, in no particular order
*/
public List<StopTime> getStopTimesForStop(Stop stop);
/****
* {@link ShapePoint} Methods
****/
public List<AgencyAndId> getAllShapeIds();
public List<ShapePoint> getShapePointsForShapeId(AgencyAndId shapeId);
/****
* {@link Frequency} Methods
****/
public List<Frequency> getFrequenciesForTrip(Trip trip);
/****
* {@link ServiceCalendar} Methods
****/
public List<AgencyAndId> getAllServiceIds();
public ServiceCalendar getCalendarForServiceId(AgencyAndId serviceId);
/****
* {@link ServiceCalendarDate} Methods
****/
public List<ServiceCalendarDate> getCalendarDatesForServiceId(
AgencyAndId serviceId);
/****
* {@link FareRule}
*****/
public List<FareRule> getFareRulesForFareAttribute(FareAttribute fareAttribute);
}