com.github.skjolber.dc.model.StopTime Maven / Gradle / Ivy
package com.github.skjolber.dc.model;
import java.util.Comparator;
public class StopTime {
public static final int MISSING_VALUE = -999;
public static Comparator arrivalTimeComparator = new Comparator() {
@Override
public int compare(StopTime o1, StopTime o2) {
return Integer.compare(o1.getArrivalTime(), o2.getArrivalTime());
}
};
public static Comparator departureTimeComparator = new Comparator() {
@Override
public int compare(StopTime o1, StopTime o2) {
return Integer.compare(o1.getDepartureTime(), o2.getDepartureTime());
}
};
private Stop stop;
private Trip trip;
private int arrivalTime = MISSING_VALUE;
private int departureTime = MISSING_VALUE;
private int timepoint = MISSING_VALUE;
private int stopSequence;
private StopTime previous;
private StopTime next;
private String stopHeadsign;
private String routeShortName;
private int pickupType;
private int dropOffType;
private double shapeDistTraveled = MISSING_VALUE;
/** This is a Conveyal extension to the GTFS spec to support Seattle on/off peak fares. */
private String farePeriodId;
public StopTime() {
}
public Trip getTrip() {
return trip;
}
public void setTrip(Trip trip) {
this.trip = trip;
}
public int getStopSequence() {
return stopSequence;
}
public void setStopSequence(int stopSequence) {
this.stopSequence = stopSequence;
}
public Stop getStop() {
return stop;
}
public void setStop(Stop stop) {
this.stop = stop;
}
public boolean isArrivalTimeSet() {
return arrivalTime != MISSING_VALUE;
}
/**
* @return arrival time, in seconds since midnight
*/
public int getArrivalTime() {
return arrivalTime;
}
public void setArrivalTime(int arrivalTime) {
this.arrivalTime = arrivalTime;
}
public void clearArrivalTime() {
this.arrivalTime = MISSING_VALUE;
}
public boolean isDepartureTimeSet() {
return departureTime != MISSING_VALUE;
}
/**
* @return departure time, in seconds since midnight
*/
public int getDepartureTime() {
return departureTime;
}
public void setDepartureTime(int departureTime) {
this.departureTime = departureTime;
}
public void clearDepartureTime() {
this.departureTime = MISSING_VALUE;
}
public boolean isTimepointSet() {
return timepoint != MISSING_VALUE;
}
/**
* @return 1 if the stop-time is a timepoint location
*/
public int getTimepoint() {
return timepoint;
}
public void setTimepoint(int timepoint) {
this.timepoint = timepoint;
}
public void clearTimepoint() {
this.timepoint = MISSING_VALUE;
}
public String getStopHeadsign() {
return stopHeadsign;
}
public void setStopHeadsign(String headSign) {
this.stopHeadsign = headSign;
}
public String getRouteShortName() {
return routeShortName;
}
public void setRouteShortName(String routeShortName) {
this.routeShortName = routeShortName;
}
public int getPickupType() {
return pickupType;
}
public void setPickupType(int pickupType) {
this.pickupType = pickupType;
}
public int getDropOffType() {
return dropOffType;
}
public void setDropOffType(int dropOffType) {
this.dropOffType = dropOffType;
}
public boolean isShapeDistTraveledSet() {
return shapeDistTraveled != MISSING_VALUE;
}
public double getShapeDistTraveled() {
return shapeDistTraveled;
}
public void setShapeDistTraveled(double shapeDistTraveled) {
this.shapeDistTraveled = shapeDistTraveled;
}
public void clearShapeDistTraveled() {
this.shapeDistTraveled = MISSING_VALUE;
}
public String getFarePeriodId() {
return farePeriodId;
}
public void setFarePeriodId(String farePeriodId) {
this.farePeriodId = farePeriodId;
}
public StopTime getNext() {
return next;
}
public void setNext(StopTime next) {
this.next = next;
}
public StopTime getPrevious() {
return previous;
}
public void setPrevious(StopTime previous) {
this.previous = previous;
}
@Override
public String toString() {
return "StopTime [arrivalTime=" + arrivalTime + ", stopSequence=" + stopSequence + "]";
}
}