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

org.opentripplanner.transit.model.timetable.TripOnServiceDateBuilder Maven / Gradle / Ivy

The newest version!
package org.opentripplanner.transit.model.timetable;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import org.opentripplanner.transit.model.framework.AbstractEntityBuilder;
import org.opentripplanner.transit.model.framework.FeedScopedId;

public class TripOnServiceDateBuilder
  extends AbstractEntityBuilder {

  private Trip trip;
  private LocalDate serviceDate;
  private TripAlteration tripAlteration;
  private List replacementFor = List.of();

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

  TripOnServiceDateBuilder(TripOnServiceDate original) {
    super(original);
    this.trip = original.getTrip();
    this.serviceDate = original.getServiceDate();
    this.tripAlteration = original.getTripAlteration();
    this.replacementFor = new ArrayList<>(original.getReplacementFor());
  }

  public TripOnServiceDateBuilder withTrip(Trip trip) {
    this.trip = trip;
    return this;
  }

  public TripOnServiceDateBuilder withServiceDate(LocalDate serviceDate) {
    this.serviceDate = serviceDate;
    return this;
  }

  public TripOnServiceDateBuilder withTripAlteration(TripAlteration tripAlteration) {
    this.tripAlteration = tripAlteration;
    return this;
  }

  public TripOnServiceDateBuilder withReplacementFor(List replacementFor) {
    this.replacementFor = replacementFor;
    return this;
  }

  public Trip getTrip() {
    return trip;
  }

  public LocalDate getServiceDate() {
    return serviceDate;
  }

  public TripAlteration getTripAlteration() {
    return tripAlteration;
  }

  public List getReplacementFor() {
    return replacementFor;
  }

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy