All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.entur.netex.index.impl.NetexEntitiesIndexImpl Maven / Gradle / Ivy

There is a newer version: 3.1.29
Show newest version
package org.entur.netex.index.impl;

import java.time.LocalDateTime;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.entur.netex.index.api.NetexEntitiesIndex;
import org.entur.netex.index.api.NetexEntityIndex;
import org.entur.netex.index.api.VersionedNetexEntityIndex;
import org.rutebanken.netex.model.Authority;
import org.rutebanken.netex.model.Block;
import org.rutebanken.netex.model.Branding;
import org.rutebanken.netex.model.CompositeFrame;
import org.rutebanken.netex.model.DatedServiceJourney;
import org.rutebanken.netex.model.DayType;
import org.rutebanken.netex.model.DayTypeAssignment;
import org.rutebanken.netex.model.DestinationDisplay;
import org.rutebanken.netex.model.FareZone;
import org.rutebanken.netex.model.FlexibleLine;
import org.rutebanken.netex.model.FlexibleStopPlace;
import org.rutebanken.netex.model.GroupOfLines;
import org.rutebanken.netex.model.GroupOfStopPlaces;
import org.rutebanken.netex.model.GroupOfTariffZones;
import org.rutebanken.netex.model.JourneyPattern;
import org.rutebanken.netex.model.Line;
import org.rutebanken.netex.model.Network;
import org.rutebanken.netex.model.Notice;
import org.rutebanken.netex.model.NoticeAssignment;
import org.rutebanken.netex.model.OperatingDay;
import org.rutebanken.netex.model.OperatingPeriod;
import org.rutebanken.netex.model.Operator;
import org.rutebanken.netex.model.Parking;
import org.rutebanken.netex.model.PassengerStopAssignment;
import org.rutebanken.netex.model.Quay;
import org.rutebanken.netex.model.ResourceFrame;
import org.rutebanken.netex.model.Route;
import org.rutebanken.netex.model.RoutePoint;
import org.rutebanken.netex.model.ScheduledStopPoint;
import org.rutebanken.netex.model.ServiceCalendarFrame;
import org.rutebanken.netex.model.ServiceFrame;
import org.rutebanken.netex.model.ServiceJourney;
import org.rutebanken.netex.model.ServiceJourneyInterchange;
import org.rutebanken.netex.model.ServiceLink;
import org.rutebanken.netex.model.SiteFrame;
import org.rutebanken.netex.model.StopPlace;
import org.rutebanken.netex.model.TariffZone;
import org.rutebanken.netex.model.TimetableFrame;
import org.rutebanken.netex.model.TopographicPlace;
import org.rutebanken.netex.model.VehicleScheduleFrame;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;

/**
 *
 */
public class NetexEntitiesIndexImpl implements NetexEntitiesIndex {

    // Indexes to entities
    public final NetexEntityIndex authoritiesById;
    public final NetexEntityIndex datedServiceJourneys;
    public final Multimap datedServiceJourneyByServiceJourneyRefIndex;
    public final NetexEntityIndex dayTypeById;
    public final Multimap dayTypeAssignmentByDayTypeId;
    public final Multimap passengerStopAssignmentByStopPointRef;
    public final NetexEntityIndex destinationDisplayById;
    public final NetexEntityIndex flexibleStopPlaceById;
    public final NetexEntityIndex groupOfLinesById;
    public final NetexEntityIndex groupOfStopPlacesById;
    public final NetexEntityIndex journeyPatternsById;
    public final NetexEntityIndex flexibleLineByid;
    public final NetexEntityIndex lineById;
    public final NetexEntityIndex networkById;
    public final NetexEntityIndex noticeById;
    public final NetexEntityIndex noticeAssignmentById;
    public final NetexEntityIndex operatingDayById;
    public final NetexEntityIndex operatingPeriodById;
    public final NetexEntityIndex operatorsById;
    public final NetexEntityIndex brandingsById;
    public final VersionedNetexEntityIndex quayById;
    public final Map flexibleStopPlaceByStopPointRef;
    public final Map quayIdByStopPointRef;
    public final Map stopPlaceIdByStopPointRef;
    public final Map stopPlaceIdByQuayId;
    public final NetexEntityIndex routeById;
    public final NetexEntityIndex serviceJourneyById;
    public final NetexEntityIndex serviceJourneyInterchangeById;
    public final Multimap serviceJourneyInterchangeByServiceJourneyRef;
    public final NetexEntityIndex serviceLinkById;
    public final VersionedNetexEntityIndex stopPlaceById;
    public final VersionedNetexEntityIndex tariffZonesById;
    public final VersionedNetexEntityIndex topographicPlaceById;
    public final VersionedNetexEntityIndex parkingById;
    public final VersionedNetexEntityIndex scheduledStopPointById;
    public final NetexEntityIndex routePointById;
    public final NetexEntityIndex blockById;
    public final VersionedNetexEntityIndex fareZoneById;
    public final VersionedNetexEntityIndex groupOfTariffZonesById;
    public final Multimap parkingsByParentSiteRef;

    // Relations between entities - The Netex XML sometimes rely on the
    // nested structure of the XML document, rater than explicit references.
    // Since we throw away the document we need to keep track of these.

    public final Map networkIdByGroupOfLineId;

    // NeTEx Frames
    public final Collection compositeFrames;
    public final Collection resourceFrames;
    public final Collection siteFrames;
    public final Collection serviceFrames;
    public final Collection serviceCalendarFrames;
    public final Collection vehicleScheduleFrames;
    public final Collection timetableFrames;

    private LocalDateTime publicationTimestamp;

    /**
     * Create a root node.
     */
    public NetexEntitiesIndexImpl() {
        this.authoritiesById = new NetexEntityMapByIdImpl<>();
        this.dayTypeById = new NetexEntityMapByIdImpl<>();
        this.dayTypeAssignmentByDayTypeId = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
        this.passengerStopAssignmentByStopPointRef = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
        this.datedServiceJourneys = new NetexEntityMapByIdImpl<>();
        this.datedServiceJourneyByServiceJourneyRefIndex = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
        this.destinationDisplayById = new NetexEntityMapByIdImpl<>();
        this.flexibleStopPlaceById = new NetexEntityMapByIdImpl<>();
        this.groupOfLinesById = new NetexEntityMapByIdImpl<>();
        this.groupOfStopPlacesById = new NetexEntityMapByIdImpl<>();
        this.journeyPatternsById = new NetexEntityMapByIdImpl<>();
        this.flexibleLineByid = new NetexEntityMapByIdImpl<>();
        this.lineById = new NetexEntityMapByIdImpl<>();
        this.networkById = new NetexEntityMapByIdImpl<>();
        this.networkIdByGroupOfLineId = new ConcurrentHashMap<>();
        this.noticeById = new NetexEntityMapByIdImpl<>();
        this.noticeAssignmentById = new NetexEntityMapByIdImpl<>();
        this.operatingDayById = new NetexEntityMapByIdImpl<>();
        this.operatingPeriodById = new NetexEntityMapByIdImpl<>();
        this.operatorsById = new NetexEntityMapByIdImpl<>();
        this.brandingsById = new NetexEntityMapByIdImpl<>();
        this.quayById = new VersionedNetexEntityIndexImpl<>();
        this.flexibleStopPlaceByStopPointRef = new ConcurrentHashMap<>();
        this.quayIdByStopPointRef = new ConcurrentHashMap<>();
        this.stopPlaceIdByStopPointRef = new ConcurrentHashMap<>();
        this.stopPlaceIdByQuayId = new ConcurrentHashMap<>();
        this.routeById = new NetexEntityMapByIdImpl<>();
        this.serviceJourneyById = new NetexEntityMapByIdImpl<>();
        this.serviceJourneyInterchangeById = new NetexEntityMapByIdImpl<>();
        this.serviceJourneyInterchangeByServiceJourneyRef = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
        this.serviceLinkById = new NetexEntityMapByIdImpl<>();
        this.stopPlaceById = new VersionedNetexEntityIndexImpl<>();
        this.tariffZonesById = new VersionedNetexEntityIndexImpl<>();
        this.topographicPlaceById = new VersionedNetexEntityIndexImpl<>();
        this.parkingById = new VersionedNetexEntityIndexImpl<>();
        this.scheduledStopPointById = new VersionedNetexEntityIndexImpl<>();
        this.routePointById = new NetexEntityMapByIdImpl<>();
        this.blockById = new NetexEntityMapByIdImpl<>();
        this.fareZoneById = new VersionedNetexEntityIndexImpl<>();
        this.groupOfTariffZonesById = new VersionedNetexEntityIndexImpl<>();
        this.compositeFrames = new HashSet<>();
        this.siteFrames = new HashSet<>();
        this.resourceFrames = new HashSet<>();
        this.serviceFrames = new HashSet<>();
        this.serviceCalendarFrames = new HashSet<>();
        this.vehicleScheduleFrames = new HashSet<>();
        this.timetableFrames = new HashSet<>();
        this.parkingsByParentSiteRef = Multimaps.synchronizedListMultimap(ArrayListMultimap.create());
    }

    @Override
    public NetexEntityIndex getGroupOfLinesIndex() {
        return groupOfLinesById;
    }

    @Override
    public NetexEntityIndex getNetworkIndex() {
        return networkById;
    }

    @Override
    public Map getNetworkIdByGroupOfLineIdIndex() {
        return networkIdByGroupOfLineId;
    }

    @Override
    public NetexEntityIndex getAuthorityIndex() {
        return authoritiesById;
    }

    @Override
    public NetexEntityIndex getDayTypeIndex() {
        return dayTypeById;
    }

    @Override
    public Multimap getDayTypeAssignmentsByDayTypeIdIndex() {
        return dayTypeAssignmentByDayTypeId;
    }

    @Override
    public Multimap getPassengerStopAssignmentsByStopPointRefIndex() {
        return passengerStopAssignmentByStopPointRef;
    }

    @Override
    public NetexEntityIndex getDatedServiceJourneyIndex() {
        return datedServiceJourneys;
    }

    @Override
    public Multimap getDatedServiceJourneyByServiceJourneyRefIndex() {
        return datedServiceJourneyByServiceJourneyRefIndex;
    }

    @Override
    public NetexEntityIndex getDestinationDisplayIndex() {
        return destinationDisplayById;
    }

    @Override
    public NetexEntityIndex getFlexibleStopPlaceIndex() {
        return flexibleStopPlaceById;
    }

    @Override
    public NetexEntityIndex getGroupOfStopPlacesIndex() {
        return groupOfStopPlacesById;
    }

    @Override
    public NetexEntityIndex getJourneyPatternIndex() {
        return journeyPatternsById;
    }

    @Override
    public NetexEntityIndex getFlexibleLineIndex() {
        return flexibleLineByid;
    }

    @Override
    public NetexEntityIndex getLineIndex() {
        return lineById;
    }

    @Override
    public NetexEntityIndex getNoticeIndex() {
        return noticeById;
    }

    @Override
    public NetexEntityIndex getNoticeAssignmentIndex() {
        return noticeAssignmentById;
    }

    @Override
    public NetexEntityIndex getOperatingDayIndex() {
        return operatingDayById;
    }

    @Override
    public NetexEntityIndex getOperatingPeriodIndex() {
        return operatingPeriodById;
    }

    @Override
    public NetexEntityIndex getOperatorIndex() {
        return operatorsById;
    }

    @Override
    public NetexEntityIndex getBrandingIndex() {
        return brandingsById;
    }

    @Override
    public VersionedNetexEntityIndex getQuayIndex() {
        return quayById;
    }

    @Override
    public Map getFlexibleStopPlaceIdByStopPointRefIndex() {
        return flexibleStopPlaceByStopPointRef;
    }

    @Override
    public Map getQuayIdByStopPointRefIndex() {
        return quayIdByStopPointRef;
    }

    @Override
    public Map getStopPlaceIdByStopPointRefIndex() {
        return stopPlaceIdByStopPointRef;
    }

    @Override
    public Map getStopPlaceIdByQuayIdIndex() {
        return stopPlaceIdByQuayId;
    }

    @Override
    public NetexEntityIndex getRouteIndex() {
        return routeById;
    }

    @Override
    public NetexEntityIndex getServiceJourneyIndex() {
        return serviceJourneyById;
    }

    @Override
    public NetexEntityIndex getServiceJourneyInterchangeIndex() {
        return serviceJourneyInterchangeById;
    }

    @Override
    public Multimap getServiceJourneyInterchangeByServiceJourneyRefIndex() {
        return serviceJourneyInterchangeByServiceJourneyRef;
    }

    @Override
    public NetexEntityIndex getServiceLinkIndex() {
        return serviceLinkById;
    }

    @Override
    public VersionedNetexEntityIndex getStopPlaceIndex() {
        return stopPlaceById;
    }

    @Override
    public VersionedNetexEntityIndex getTariffZoneIndex() {
        return tariffZonesById;
    }

    @Override
    public VersionedNetexEntityIndex getTopographicPlaceIndex() {
        return topographicPlaceById;
    }

    @Override
    public VersionedNetexEntityIndex getParkingIndex() {
        return parkingById;
    }

    @Override
    public VersionedNetexEntityIndex getScheduledStopPointIndex() {
        return scheduledStopPointById;
    }

    @Override
    public NetexEntityIndex getRoutePointIndex() {
        return routePointById;
    }

    @Override
    public NetexEntityIndex getBlockIndex() {
        return blockById;
    }

    @Override
    public VersionedNetexEntityIndex getFareZoneIndex() {
        return fareZoneById;
    }

    @Override
    public VersionedNetexEntityIndex getGroupOfTariffZonesIndex() {
        return groupOfTariffZonesById;
    }

    @Override
    public Collection getCompositeFrames() {
        return compositeFrames;
    }

    @Override
    public Collection getResourceFrames() {
        return resourceFrames;
    }

    @Override
    public Collection getSiteFrames() {
        return siteFrames;
    }

    @Override
    public Collection getServiceFrames() {
        return serviceFrames;
    }

    @Override
    public Collection getServiceCalendarFrames() {
        return serviceCalendarFrames;
    }

    @Override
    public Collection getVehicleScheduleFrames() {
        return vehicleScheduleFrames;
    }

    @Override
    public Collection getTimetableFrames() {
        return timetableFrames;
    }

    @Override
    public LocalDateTime getPublicationTimestamp() {
        return publicationTimestamp;
    }

    @Override
    public void setPublicationTimestamp(LocalDateTime publicationTimestamp) {
        this.publicationTimestamp = publicationTimestamp;
    }

    @Override
    public Multimap getParkingsByParentSiteRefIndex() {
        return parkingsByParentSiteRef;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy