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

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

The newest version!
package org.openlr.encoder;

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

import java.util.List;
import java.util.OptionalDouble;

class CompositeProcessor implements IntermediateProcessor {
    private final List processors;

    CompositeProcessor(List processors) {
        this.processors = processors;
    }

    @Override
    public > OptionalDouble getDistanceToNext(Path path) {
        return processors.stream()
                .map(processor -> processor.getDistanceToNext(path))
                .filter(OptionalDouble::isPresent)
                .mapToDouble(OptionalDouble::getAsDouble)
                .min();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy