org.opentripplanner.graph_builder.module.geometry.IndexedLineSegmentComparator 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
package org.opentripplanner.graph_builder.module.geometry;
import org.apache.commons.math3.util.FastMath;
import org.locationtech.jts.geom.Coordinate;
import java.util.Comparator;
class IndexedLineSegmentComparator implements Comparator {
private Coordinate coord;
public IndexedLineSegmentComparator(Coordinate coord) {
this.coord = coord;
}
@Override
public int compare(IndexedLineSegment a, IndexedLineSegment b) {
return (int) FastMath.signum(a.distance(coord) - b.distance(coord));
}
}