Class AbstractNonIdentifiableSingleEntityMergeStrategy<T>
java.lang.Object
org.onebusaway.gtfs_merge.strategies.AbstractEntityMergeStrategy
org.onebusaway.gtfs_merge.strategies.AbstractSingleEntityMergeStrategy<T>
org.onebusaway.gtfs_merge.strategies.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
-
Field Summary
Fields inherited from class org.onebusaway.gtfs_merge.strategies.AbstractSingleEntityMergeStrategy
_entityTypeFields inherited from class org.onebusaway.gtfs_merge.strategies.AbstractEntityMergeStrategy
_duplicateDetectionStrategy, _logDuplicatesStrategy, _minElementDuplicateScoreForFuzzyMatch, _minElementsDuplicateScoreForAutoDetect, _minElementsInCommonScoreForAutoDetect -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanentitiesAreIdentical(T entityA, T entityB) Determines if two entities are identical, such that adding both to a feed would have the same effect.protected org.onebusaway.gtfs.model.IdentityBean<?> getIdentityDuplicate(GtfsMergeContext context, org.onebusaway.gtfs.model.IdentityBean<?> newEntity) Non-identifiable entities obviously don't have identifiers.protected EDuplicateDetectionStrategyDetermines the bestEDuplicateDetectionStrategyto use for merging entities from the current source feed into the merged output feed.protected voidrename(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.protected voidreplaceDuplicateEntry(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.Methods inherited from class org.onebusaway.gtfs_merge.strategies.AbstractSingleEntityMergeStrategy
getDescription, getEntityTypes, getFuzzyDuplicate, merge, mergeEntity, rejectDuplicateOverDifferences, saveMethods inherited from class org.onebusaway.gtfs_merge.strategies.AbstractEntityMergeStrategy
determineDuplicateDetectionStrategy, getDuplicateRenamingStrategy, setDuplicateDetectionStrategy, setDuplicateRenamingStrategy, setLogDuplicatesStrategy
-
Constructor Details
-
AbstractNonIdentifiableSingleEntityMergeStrategy
-
-
Method Details
-
pickBestDuplicateDetectionStrategy
Description copied from class:AbstractEntityMergeStrategyDetermines the bestEDuplicateDetectionStrategyto 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:
pickBestDuplicateDetectionStrategyin classAbstractEntityMergeStrategy- 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:
getIdentityDuplicatein classAbstractSingleEntityMergeStrategy<T>- Parameters:
context-newEntity-- Returns:
- a duplicate entity with the specified id or null if none exists.
-
entitiesAreIdentical
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
Non-identifiable entities can't be referenced by other GTFS entities, so there shouldn't be any work to do here.- Specified by:
replaceDuplicateEntryin classAbstractSingleEntityMergeStrategy<T>- Parameters:
context-oldEntity- the old entity in the source feed that should be replacednewEntity- the new entity in the output merged feed that duplicates the old entity
-
rename
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-
-