-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add showNegativeScheduledArrivals option to data-sources.xml
- Loading branch information
1 parent
561d038
commit e1c810a
Showing
4 changed files
with
153 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...way/transit_data_federation/impl/realtime/gtfs_realtime/GtfsRealtimeNegativeArrivals.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright (C) 2016 University of South Florida | ||
* | ||
* 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.transit_data_federation.impl.realtime.gtfs_realtime; | ||
|
||
public interface GtfsRealtimeNegativeArrivals { | ||
|
||
public Boolean getShowNegativeScheduledArrivalByAgencyId(String agencyId); | ||
} |
65 changes: 65 additions & 0 deletions
65
...transit_data_federation/impl/realtime/gtfs_realtime/GtfsRealtimeNegativeArrivalsImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Copyright (C) 2016 University of South Florida | ||
* | ||
* 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.transit_data_federation.impl.realtime.gtfs_realtime; | ||
|
||
import org.springframework.beans.factory.InitializingBean; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.HashMap; | ||
import java.util.Iterator; | ||
import java.util.Map; | ||
|
||
import javax.annotation.PostConstruct; | ||
|
||
@Component | ||
public class GtfsRealtimeNegativeArrivalsImpl implements | ||
GtfsRealtimeNegativeArrivals, InitializingBean { | ||
|
||
private Map<String, Boolean> agencyNegativeScheduledArrivalMap; | ||
|
||
private Map<String,GtfsRealtimeSource> gtfsRealtimeSourceMap; | ||
|
||
@Autowired | ||
public void setGtfsRealtimeSourceMap( | ||
Map<String, GtfsRealtimeSource> gtfsRealtimeSourceMap) { | ||
this.gtfsRealtimeSourceMap = gtfsRealtimeSourceMap; | ||
} | ||
|
||
@Override | ||
public void afterPropertiesSet() throws Exception { | ||
init(); | ||
} | ||
|
||
@SuppressWarnings("rawtypes") | ||
@PostConstruct | ||
public void init() { | ||
Iterator it = gtfsRealtimeSourceMap.entrySet().iterator(); | ||
agencyNegativeScheduledArrivalMap = new HashMap<String, Boolean>(); | ||
while (it.hasNext()) { | ||
Map.Entry pair = (Map.Entry)it.next(); | ||
GtfsRealtimeSource grs = (GtfsRealtimeSource) pair.getValue(); | ||
for (String id : grs.getAgencyIds()) { | ||
agencyNegativeScheduledArrivalMap.put(id, grs.getShowNegativeScheduledArrivals()); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public Boolean getShowNegativeScheduledArrivalByAgencyId(String agencyId) { | ||
return agencyNegativeScheduledArrivalMap.get(agencyId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters