javax.constraints.impl.search.goal.ReversibleActionGoal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsr331 Show documentation
Show all versions of jsr331 Show documentation
JCP Standard JSR331 “Java Constraint Programming API”. It is used for Modeling and Solving Constraint Satisfaction and Optimization Problems using Java and off-the-shelf Constraint/Linear Solvers
package javax.constraints.impl.search.goal;
import javax.constraints.extra.ReversibleAction;
public class ReversibleActionGoal implements ReversibleAction {
Goal goal;
public ReversibleActionGoal(Goal goal) {
this.goal = goal;
}
@Override
public boolean execute() throws Exception {
boolean result = true;
try {
goal.execute();
} catch (Exception e) {
result = false;
}
return result;
}
public Goal getGoal() {
return goal;
}
}