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

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

There is a newer version: 0.7
Show newest version
package com.github.k0zka.finder4j.backtrack.termination;

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

/**
 * Terminate the search after the first solution is received.
 * 
 * @param 
 * @param 
 */
public class FirstSolutionTerminationStrategy>
		implements TerminationStrategy, SolutionListener {

	private X state = null;

	public X getSolution() {
		return state;
	}

	public void onSolution(final X state) {
		this.state = state;
	}

	public boolean stop(final X state) {
		return this.state != null;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy