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

org.opentripplanner.transit.model.site.RegularStopBuilder Maven / Gradle / Ivy

/* This file is based on code copied from project OneBusAway, see the LICENSE file for further information. */
package org.opentripplanner.transit.model.site;

import java.time.ZoneId;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.opentripplanner.transit.model.basic.I18NString;
import org.opentripplanner.transit.model.basic.TransitMode;
import org.opentripplanner.transit.model.framework.FeedScopedId;

/**
 * A place where actual boarding/departing happens. It can be a bus stop on one side of a road or a
 * platform at a train station. Equivalent to GTFS stop location 0 or NeTEx quay.
 */
public final class RegularStopBuilder
  extends StationElementBuilder {

  private String platformCode;

  private I18NString url;

  private ZoneId timeZone;

  private TransitMode gtfsVehicleType;

  private String netexVehicleSubmode;

  private final Set boardingAreas = new HashSet<>();

  private final Set fareZones = new HashSet<>();

  RegularStopBuilder(FeedScopedId id) {
    super(id);
  }

  RegularStopBuilder(RegularStop original) {
    super(original);
    this.platformCode = original.getPlatformCode();
    this.url = original.getUrl();
    this.timeZone = original.getTimeZone();
    this.gtfsVehicleType = original.getGtfsVehicleType();
    this.netexVehicleSubmode = original.getNetexVehicleSubmode().name();
  }

  public String platformCode() {
    return platformCode;
  }

  public RegularStopBuilder withPlatformCode(String platformCode) {
    this.platformCode = platformCode;
    return this;
  }

  public I18NString url() {
    return url;
  }

  public RegularStopBuilder withUrl(I18NString url) {
    this.url = url;
    return this;
  }

  public TransitMode vehicleType() {
    return gtfsVehicleType;
  }

  public RegularStopBuilder withVehicleType(TransitMode vehicleType) {
    this.gtfsVehicleType = vehicleType;
    return this;
  }

  public String netexVehicleSubmode() {
    return netexVehicleSubmode;
  }

  public RegularStopBuilder withNetexVehicleSubmode(String netexVehicleSubmode) {
    this.netexVehicleSubmode = netexVehicleSubmode;
    return this;
  }

  public ZoneId timeZone() {
    return timeZone;
  }

  public RegularStopBuilder withTimeZone(ZoneId timeZone) {
    this.timeZone = timeZone;
    return this;
  }

  public RegularStopBuilder addFareZones(FareZone fareZone) {
    this.fareZones.add(fareZone);
    return this;
  }

  public Set fareZones() {
    return fareZones;
  }

  public RegularStopBuilder addBoardingArea(BoardingArea boardingArea) {
    boardingAreas.add(boardingArea);
    return this;
  }

  public Collection boardingAreas() {
    return boardingAreas;
  }

  @Override
  RegularStopBuilder instance() {
    return this;
  }

  @Override
  protected RegularStop buildFromValues() {
    return new RegularStop(this);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy