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

org.openlr.encoder.MaxDistanceProcessor Maven / Gradle / Ivy

The newest version!
package org.openlr.encoder;

import org.openlr.map.Line;
import org.openlr.map.Path;

import java.util.OptionalDouble;

class MaxDistanceProcessor implements IntermediateProcessor {
    private final double maxDistance;

    MaxDistanceProcessor(double maxDistance) {
        this.maxDistance = maxDistance;
    }

    @Override
    public > OptionalDouble getDistanceToNext(Path path) {
        if (path.getLength() > maxDistance) {
            return OptionalDouble.of(maxDistance);
        }
        else {
            return OptionalDouble.empty();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy