ai.timefold.solver.spring.boot.autoconfigure.config.TerminationProperty Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of timefold-solver-spring-boot-autoconfigure Show documentation
Show all versions of timefold-solver-spring-boot-autoconfigure Show documentation
Timefold solves planning problems.
This lightweight, embeddable planning engine implements powerful and scalable algorithms
to optimize business resource scheduling and planning.
This module contains the Spring Boot autoconfigure.
package ai.timefold.solver.spring.boot.autoconfigure.config;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.springframework.boot.convert.DurationStyle;
public enum TerminationProperty {
SPENT_LIMIT("spent-limit", TerminationProperties::setSpentLimit,
value -> DurationStyle.detectAndParse((String) value)),
UNIMPROVED_SPENT_LIMIT("unimproved-spent-limit", TerminationProperties::setUnimprovedSpentLimit,
value -> DurationStyle.detectAndParse((String) value)),
BEST_SCORE_LIMIT("best-score-limit", TerminationProperties::setBestScoreLimit, Object::toString);
private final String propertyName;
private final BiConsumer propertyUpdater;
private static final Set PROPERTY_NAMES = Stream.of(TerminationProperty.values())
.map(TerminationProperty::getPropertyName)
.collect(Collectors.toCollection(TreeSet::new));
TerminationProperty(String propertyName, BiConsumer propertySetter,
Function