Class AbstractNonIdentifiableSingleEntityMergeStrategy<T>

Type Parameters:
T -
All Implemented Interfaces:
EntityMergeStrategy
Direct Known Subclasses:
FareRuleMergeStrategy, FrequencyMergeStrategy, TransferMergeStrategy

public abstract class AbstractNonIdentifiableSingleEntityMergeStrategy<T> extends AbstractSingleEntityMergeStrategy<T>
Non-identifiable entities include types like
invalid reference
Transfer
, FareRule and Frequency entities. These entities do not have identifiers in the GTFS feed so they do not duplicate other entities in the id-based sense. Instead, these entities more often define a rule for how other entities might be interpreted. As such, determining if two non-identifiable entities are duplicates can be a bit tricky. For now, we simply consider entities of this type to be duplicates if they are exactly the same in two feeds. It's left as future work to implement fuzzy duplicate detection for entities of this type.
Author:
bdferris
  • Constructor Details

    • AbstractNonIdentifiableSingleEntityMergeStrategy

      public AbstractNonIdentifiableSingleEntityMergeStrategy(Class<T> entityType)
  • Method Details

    • pickBestDuplicateDetectionStrategy

      protected EDuplicateDetectionStrategy pickBestDuplicateDetectionStrategy(GtfsMergeContext context)
      Description copied from class: AbstractEntityMergeStrategy
      Determines the best EDuplicateDetectionStrategy to use for merging entities from the current source feed into the merged output feed. Sub-classes are required to provide the most appropriate strategy for merging their particular entity type.
      Specified by:
      pickBestDuplicateDetectionStrategy in class AbstractEntityMergeStrategy
      Parameters:
      context -
      Returns:
    • getIdentityDuplicate

      protected org.onebusaway.gtfs.model.IdentityBean<?> getIdentityDuplicate(GtfsMergeContext context, org.onebusaway.gtfs.model.IdentityBean<?> newEntity)
      Non-identifiable entities obviously don't have identifiers. However, we consider two entities to be identifier-based duplicates if the entities themselves are identical.
      Specified by:
      getIdentityDuplicate in class AbstractSingleEntityMergeStrategy<T>
      Parameters:
      context -
      newEntity -
      Returns:
      a duplicate entity with the specified id or null if none exists.
    • entitiesAreIdentical

      protected abstract boolean entitiesAreIdentical(T entityA, T entityB)
      Determines if two entities are identical, such that adding both to a feed would have the same effect.
      Parameters:
      entityA -
      entityB -
      Returns:
      true if the two specified entities are identical
    • replaceDuplicateEntry

      protected void replaceDuplicateEntry(GtfsMergeContext context, T oldEntity, T newEntity)
      Non-identifiable entities can't be referenced by other GTFS entities, so there shouldn't be any work to do here.
      Specified by:
      replaceDuplicateEntry in class AbstractSingleEntityMergeStrategy<T>
      Parameters:
      context -
      oldEntity - the old entity in the source feed that should be replaced
      newEntity - the new entity in the output merged feed that duplicates the old entity
    • rename

      protected void rename(GtfsMergeContext context, org.onebusaway.gtfs.model.IdentityBean<?> entity)
      Non-identifiable entities should never have raw GTFS identifier overlap, so this method should never be called. If it is, an exception will be thrown.
      Parameters:
      context -
      entity -