Class ShapePointMergeStrategy
java.lang.Object
org.onebusaway.gtfs_merge.strategies.AbstractEntityMergeStrategy
org.onebusaway.gtfs_merge.strategies.AbstractCollectionEntityMergeStrategy<org.onebusaway.gtfs.model.AgencyAndId>
org.onebusaway.gtfs_merge.strategies.ShapePointMergeStrategy
- All Implemented Interfaces:
EntityMergeStrategy
public class ShapePointMergeStrategy
extends AbstractCollectionEntityMergeStrategy<org.onebusaway.gtfs.model.AgencyAndId>
Entity merge strategy for handling
ShapePoint entities. Shape points are an example of an
entity collection, since multiple shape point entities are linked by a sinlge shape_id.- Author:
- bdferris
-
Field Summary
Fields inherited from class org.onebusaway.gtfs_merge.strategies.AbstractEntityMergeStrategy
_duplicateDetectionStrategy, _logDuplicatesStrategy, _minElementDuplicateScoreForFuzzyMatch, _minElementsDuplicateScoreForAutoDetect, _minElementsInCommonScoreForAutoDetect -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidgetEntityTypes(Collection<Class<?>> entityTypes) Determine the list of entity types handled by this merge strategy.protected Collection<org.onebusaway.gtfs.model.AgencyAndId> getKeys(org.onebusaway.gtfs.services.GtfsRelationalDao dao) An entity-specific method to determine the set of unique identifiers used by collection entities in the specified GTFS feed.protected voidrenameKey(GtfsMergeContext context, org.onebusaway.gtfs.model.AgencyAndId oldId, org.onebusaway.gtfs.model.AgencyAndId newId) If we detect that an entity collection in the source input feed duplicates an entity collection in the merged output feed, we rename all references to the old id in the source feed to use the id of the entity in the merged feed.protected voidsaveElementsForKey(GtfsMergeContext context, org.onebusaway.gtfs.model.AgencyAndId shapeId) Writes the specified entity collection to the merged output feed.protected doublescoreDuplicateKey(GtfsMergeContext context, org.onebusaway.gtfs.model.AgencyAndId key) Given an id identifying an entity collection in both the source input feed and the merged output feed, produce a score between 0.0 and 1.0 identifying how likely it is that the two entity collections are one and the same, where 0.0 means they having nothing in common and 1.0 meaning they are exactly the same.Methods inherited from class org.onebusaway.gtfs_merge.strategies.AbstractCollectionEntityMergeStrategy
getDescription, getRawKey, merge, pickBestDuplicateDetectionStrategyMethods inherited from class org.onebusaway.gtfs_merge.strategies.AbstractEntityMergeStrategy
determineDuplicateDetectionStrategy, getDuplicateRenamingStrategy, setDuplicateDetectionStrategy, setDuplicateRenamingStrategy, setLogDuplicatesStrategy
-
Constructor Details
-
ShapePointMergeStrategy
public ShapePointMergeStrategy()
-
-
Method Details
-
getEntityTypes
Description copied from interface:EntityMergeStrategyDetermine the list of entity types handled by this merge strategy.- Parameters:
entityTypes- the handled types should be added to this output collection.
-
getKeys
protected Collection<org.onebusaway.gtfs.model.AgencyAndId> getKeys(org.onebusaway.gtfs.services.GtfsRelationalDao dao) Description copied from class:AbstractCollectionEntityMergeStrategyAn entity-specific method to determine the set of unique identifiers used by collection entities in the specified GTFS feed.- Specified by:
getKeysin classAbstractCollectionEntityMergeStrategy<org.onebusaway.gtfs.model.AgencyAndId>- Parameters:
dao-- Returns:
- the set of unique identifiers
-
scoreDuplicateKey
protected double scoreDuplicateKey(GtfsMergeContext context, org.onebusaway.gtfs.model.AgencyAndId key) Description copied from class:AbstractCollectionEntityMergeStrategyGiven an id identifying an entity collection in both the source input feed and the merged output feed, produce a score between 0.0 and 1.0 identifying how likely it is that the two entity collections are one and the same, where 0.0 means they having nothing in common and 1.0 meaning they are exactly the same.- Specified by:
scoreDuplicateKeyin classAbstractCollectionEntityMergeStrategy<org.onebusaway.gtfs.model.AgencyAndId>- Parameters:
context-key-- Returns:
-
renameKey
protected void renameKey(GtfsMergeContext context, org.onebusaway.gtfs.model.AgencyAndId oldId, org.onebusaway.gtfs.model.AgencyAndId newId) Description copied from class:AbstractCollectionEntityMergeStrategyIf we detect that an entity collection in the source input feed duplicates an entity collection in the merged output feed, we rename all references to the old id in the source feed to use the id of the entity in the merged feed. That way, when examining other entities in the source feed that referenced the original entity collection with entities in the target feed that reference the duplicate entity, both sets of entity will now appear to reference the same thing. This can be useful for similarity detection.- Specified by:
renameKeyin classAbstractCollectionEntityMergeStrategy<org.onebusaway.gtfs.model.AgencyAndId>- Parameters:
context-oldId- the original id in the source input feednewId- the new id, which replaces the old in the source input feed
-
saveElementsForKey
protected void saveElementsForKey(GtfsMergeContext context, org.onebusaway.gtfs.model.AgencyAndId shapeId) Description copied from class:AbstractCollectionEntityMergeStrategyWrites the specified entity collection to the merged output feed.- Specified by:
saveElementsForKeyin classAbstractCollectionEntityMergeStrategy<org.onebusaway.gtfs.model.AgencyAndId>- Parameters:
context-shapeId- the identifier for the entity collection to save
-