Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "VIATRA/DSE/UserGuide/Strategy"
m (Nasz013.gmail.com moved page VIATRA/DSE/UserGuide/Strategy to VIATRA2/DSE/UserGuide/Strategy: VIATRA2 instead of VIATRA) |
(→Using the Strategy class) |
||
Line 1: | Line 1: | ||
= Using the Strategy class = | = Using the Strategy class = | ||
− | In this section the components of the | + | In this section the components of the <code>Strategy</code> class are explained including the following four interfaces and its built in implementations: |
− | * ICheckConstraints | + | * <code>ICheckConstraints</code> |
− | * | + | * <code>INextTransition</code> |
− | + | ||
− | + | ||
− | Its only responsibility is the call delegation to the four interfaces. Implementation of these interfaces can be set via simple set methods. The only exception is the | + | Its only responsibility is the call delegation to the four interfaces. Implementation of these interfaces can be set via simple set methods. The only exception is the <code>INextTransition</code> interface which is a required parameter in the constructor. |
== ICheckConstraints == | == ICheckConstraints == | ||
Line 17: | Line 15: | ||
</source> | </source> | ||
− | This method called every time a new state is traversed and if it returns false the current state will be marked as "shouldn't explore further" for the traversal strategy. Default implementation of this interface is the | + | This method called every time a new state is traversed and if it returns false the current state will be marked as "shouldn't explore further" for the traversal strategy. Default implementation of this interface is the <code>CheckAllConstraints</code> class, which simply checks all the given constraints and return false if at least one constraint is failed to be satisfied. |
Override this implementation if the "AND" logic between the constraints is not suitable or a global constraint cannot be defined using IncQuery. | Override this implementation if the "AND" logic between the constraints is not suitable or a global constraint cannot be defined using IncQuery. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== INextTransition == | == INextTransition == |
Revision as of 11:50, 8 January 2015
Using the Strategy class
In this section the components of the Strategy
class are explained including the following four interfaces and its built in implementations:
-
ICheckConstraints
-
INextTransition
Its only responsibility is the call delegation to the four interfaces. Implementation of these interfaces can be set via simple set methods. The only exception is the INextTransition
interface which is a required parameter in the constructor.
ICheckConstraints
This interface has only one method and it is responsible for deciding whether the current state satisfies the global constraints returning true if the answer is yes:
boolean checkConstraints(ThreadContext context);
This method called every time a new state is traversed and if it returns false the current state will be marked as "shouldn't explore further" for the traversal strategy. Default implementation of this interface is the CheckAllConstraints
class, which simply checks all the given constraints and return false if at least one constraint is failed to be satisfied.
Override this implementation if the "AND" logic between the constraints is not suitable or a global constraint cannot be defined using IncQuery.