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

org.opentripplanner.transit.model.network.GroupOfRoutes Maven / Gradle / Ivy

There is a newer version: 2.6.0
Show newest version
package org.opentripplanner.transit.model.network;

import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opentripplanner.transit.model.framework.AbstractTransitEntity;
import org.opentripplanner.transit.model.framework.FeedScopedId;
import org.opentripplanner.transit.model.framework.LogInfo;
import org.opentripplanner.util.lang.StringUtils;

/**
 * OTP model for NeTEx GroupOfLines. Not used for GTFS at the moment. This is used to categorize
 * lines based on their particular purposes such as fare harmonization or public presentation. For
 * example divide lines into commercial and non-commercial groups.
 */
public class GroupOfRoutes
  extends AbstractTransitEntity
  implements LogInfo {

  private final String name;
  private final String privateCode;
  private final String shortName;
  private final String description;

  GroupOfRoutes(GroupOfRoutesBuilder builder) {
    super(builder.getId());
    // Optional fields
    this.name = builder.getName();
    this.privateCode = builder.getPrivateCode();
    this.shortName = builder.getShortName();
    this.description = builder.getDescription();
  }

  public static GroupOfRoutesBuilder of(FeedScopedId id) {
    return new GroupOfRoutesBuilder(id);
  }

  @Nonnull
  public String getName() {
    return logName();
  }

  @Override
  @Nonnull
  public String logName() {
    return name;
  }

  @Nullable
  public String getShortName() {
    return shortName;
  }

  @Nullable
  public String getPrivateCode() {
    return privateCode;
  }

  @Nullable
  public String getDescription() {
    return description;
  }

  @Override
  public GroupOfRoutesBuilder copy() {
    return new GroupOfRoutesBuilder(this);
  }

  @Override
  public boolean sameAs(@Nonnull GroupOfRoutes other) {
    return (
      getId().equals(other.getId()) &&
      Objects.equals(name, other.name) &&
      Objects.equals(shortName, other.shortName) &&
      Objects.equals(privateCode, other.privateCode) &&
      Objects.equals(description, other.description)
    );
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy