
org.opentripplanner.framework.model.TimeAndCost Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of otp Show documentation
Show all versions of otp Show documentation
The OpenTripPlanner multimodal journey planning system
The newest version!
package org.opentripplanner.framework.model;
import java.time.Duration;
import org.opentripplanner.framework.time.DurationUtils;
/**
* Tuple of time(duration) and cost.
*/
public record TimeAndCost(Duration time, Cost cost) {
public static final TimeAndCost ZERO = new TimeAndCost(Duration.ZERO, Cost.ZERO);
public int timeInSeconds() {
return (int) time.toSeconds();
}
public boolean isZero() {
return this.equals(ZERO);
}
@Override
public String toString() {
return "(" + DurationUtils.durationToStr(time) + " " + cost + ")";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy