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

com.github.k0zka.finder4j.backtrack.termination.OrTerminationStrategy Maven / Gradle / Ivy

package com.github.k0zka.finder4j.backtrack.termination;

import java.util.ArrayList;
import java.util.List;

import com.github.k0zka.finder4j.backtrack.State;
import com.github.k0zka.finder4j.backtrack.TerminationStrategy;

public class OrTerminationStrategy implements TerminationStrategy {

	private final List> strategies;
	
	public OrTerminationStrategy(List> strategies) {
		super();
		this.strategies = new ArrayList<>(strategies);
	}

	@Override
	public boolean stop(X state) {
		for(TerminationStrategy strategy : strategies) {
			if(strategy.stop(state)) {
				return true;
			}
		}
		return false;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy