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
  • Constructor Details

    • ShapePointMergeStrategy

      public ShapePointMergeStrategy()
  • Method Details

    • getEntityTypes

      public void getEntityTypes(Collection<Class<?>> entityTypes)
      Description copied from interface: EntityMergeStrategy
      Determine 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: AbstractCollectionEntityMergeStrategy
      An entity-specific method to determine the set of unique identifiers used by collection entities in the specified GTFS feed.
      Specified by:
      getKeys in class AbstractCollectionEntityMergeStrategy<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: AbstractCollectionEntityMergeStrategy
      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.
      Specified by:
      scoreDuplicateKey in class AbstractCollectionEntityMergeStrategy<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: AbstractCollectionEntityMergeStrategy
      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. 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:
      renameKey in class AbstractCollectionEntityMergeStrategy<org.onebusaway.gtfs.model.AgencyAndId>
      Parameters:
      context -
      oldId - the original id in the source input feed
      newId - 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: AbstractCollectionEntityMergeStrategy
      Writes the specified entity collection to the merged output feed.
      Specified by:
      saveElementsForKey in class AbstractCollectionEntityMergeStrategy<org.onebusaway.gtfs.model.AgencyAndId>
      Parameters:
      context -
      shapeId - the identifier for the entity collection to save