javax.constraints.impl.search.goal
Class Goal

java.lang.Object
  extended by javax.constraints.impl.CommonBase
      extended by javax.constraints.impl.search.AbstractSearchStrategy
          extended by javax.constraints.impl.search.goal.Goal
All Implemented Interfaces:
SearchStrategy
Direct Known Subclasses:
GoalAddSolution, GoalApplySolution, GoalAssignValue, GoalAssignValues, GoalAssignValuesTimeLimit, GoalAssignValueTimeLimit, GoalBacktrack, GoalCheckMaxNumberOfSolutions, GoalCheckTimeLimit, GoalCheckTotalTimeLimit, GoalConstraint, GoalLog, GoalLogSolution, GoalPrint, GoalSaveSolution, StrategyAsGoal

public abstract class Goal
extends AbstractSearchStrategy

This is a base implementation for a goal.


Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.constraints.SearchStrategy
SearchStrategy.SearchStrategyType
 
Constructor Summary
Goal(Solver solver)
           
Goal(Solver solver, java.lang.String name)
           
 
Method Summary
 Goal and(Goal goal)
          Returns an "AND" GoalI.
abstract  Goal execute()
          Method that executes an underlying goal in the proper implementation.
 SolverWithGoals getSolver()
          Returns a solver to which this goal belongs.
 Goal or(Goal goal)
          Returns an "OR" GoalI.
 void trace()
          Forces the solver to log information about this strategy every time when it is executed
 
Methods inherited from class javax.constraints.impl.search.AbstractSearchStrategy
getType, getValueSelector, getVarReals, getVars, getVarSelector, run, setType, setValueSelector, setValueSelectorType, setVarReals, setVars, setVars, setVars, setVarSelector, setVarSelectorType
 
Methods inherited from class javax.constraints.impl.CommonBase
getImpl, getName, getObject, getProblem, setImpl, setName, setObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.constraints.SearchStrategy
getImpl, getName, getObject, setImpl, setName, setObject
 

Constructor Detail

Goal

public Goal(Solver solver)

Goal

public Goal(Solver solver,
            java.lang.String name)
Method Detail

and

public Goal and(Goal goal)
Returns an "AND" GoalI. The GoalI "AND" succeeds if both of the Goals 'this' and the parameter 'goal' succeed. The GoalI "AND" fails if at least one of the Goals 'this' or the parameter 'goal' fail.

Parameters:
goal - the other GoalI which is part of the new "AND" GoalI.
Returns:
solver.and(this, goal)

execute

public abstract Goal execute()
                      throws java.lang.Exception
Method that executes an underlying goal in the proper implementation.

Returns:
goal or null
Throws:
java.lang.Exception

getSolver

public SolverWithGoals getSolver()
Returns a solver to which this goal belongs.

Specified by:
getSolver in interface SearchStrategy
Overrides:
getSolver in class AbstractSearchStrategy
Returns:
a solver to which this goal belongs.

or

public Goal or(Goal goal)
Returns an "OR" GoalI. The goal "OR" succeeds if at least one of the Goals 'this' or the parameter 'goal' succeeds. The GoalI "OR" fails if both Goals 'this' and the parameter 'goal' fail.

Parameters:
goal - the other GoalI which is part of the new "OR" GoalI.
Returns:
solver.or(this, goal)

trace

public final void trace()
Description copied from interface: SearchStrategy
Forces the solver to log information about this strategy every time when it is executed

Specified by:
trace in interface SearchStrategy
Overrides:
trace in class AbstractSearchStrategy