Package org.onebusaway.gtfs_merge
Class GtfsMergeContext
java.lang.Object
org.onebusaway.gtfs_merge.GtfsMergeContext
Manages state for the current merge operation, which is specific to particular feed and GTFS
entity type.
- Author:
- bdferris
-
Constructor Summary
ConstructorsConstructorDescriptionGtfsMergeContext(org.onebusaway.gtfs.services.GtfsRelationalDao source, org.onebusaway.gtfs.services.GtfsMutableRelationalDao target, String prefix, Map<String, Object> entityByRawId) -
Method Summary
Modifier and TypeMethodDescriptiongetEntityForRawId(String rawId) Find an entity registered withputEntityWithRawId(String, Object)for the current entity type across feeds merged so far, including the current feed.intorg.onebusaway.gtfs.services.GtfsRelationalDaoorg.onebusaway.gtfs.services.GtfsMutableRelationalDaobooleanisEntityJustAddedWithRawId(String rawId) It can be useful to know if an entity returned bygetEntityForRawId(String)was added from the current source feed or from some previous feed.voidputEntityWithRawId(String rawId, Object entity) Indicate that an entity with the specified raw GTFS id as been added to the merged output GTFS feed.voidsetResolvedDuplicateDetectionStrategy(EDuplicateDetectionStrategy resolvedDuplicateDetectionStrategy) Set the duplicate detection strategy that has been chosen for this entity type.
-
Constructor Details
-
GtfsMergeContext
-
-
Method Details
-
getSource
public org.onebusaway.gtfs.services.GtfsRelationalDao getSource()- Returns:
- the source feed GTFS DAO from which entities should be read.
-
getTarget
public org.onebusaway.gtfs.services.GtfsMutableRelationalDao getTarget()- Returns:
- the target feed GTFS DAO where merged entities should be written.
-
getPrefix
- Returns:
- a unique prefix that can be used to make duplicate or overlapping ids unique during the current merge operation.
-
putEntityWithRawId
Indicate that an entity with the specified raw GTFS id as been added to the merged output GTFS feed. Since typically only a single entity can be added to a feed for a particular id, this method can be used in combination withgetEntityForRawId(String)to detect id and entity collisions across feeds.- Parameters:
rawId-entity-
-
getEntityForRawId
Find an entity registered withputEntityWithRawId(String, Object)for the current entity type across feeds merged so far, including the current feed. Can be used to detect id and entity collisions across feeds.- Parameters:
rawId-- Returns:
- an entity associated with the specified raw GTFS id for the current entity type, or null if no entity with the specified id exists.
-
isEntityJustAddedWithRawId
It can be useful to know if an entity returned bygetEntityForRawId(String)was added from the current source feed or from some previous feed.- Parameters:
rawId-- Returns:
- true if an entity with the specified id was added from the feed currently being
processed with a call to
putEntityWithRawId(String, Object).
-
getNextSequenceCounter
public int getNextSequenceCounter()- Returns:
- a unique integer for the current merge operation.
-
getResolvedDuplicateDetectionStrategy
- Returns:
- the duplicate detection strategy that has been chosen for the current entity type.
-
setResolvedDuplicateDetectionStrategy
public void setResolvedDuplicateDetectionStrategy(EDuplicateDetectionStrategy resolvedDuplicateDetectionStrategy) Set the duplicate detection strategy that has been chosen for this entity type. A strategy might have been specified directly by the user or we might have auto-detected the best strategy based on available data.- Parameters:
resolvedDuplicateDetectionStrategy-
-