Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.drools.planner.core.move
Interface Move

All Known Implementing Classes:
  CompositeMove

    public interface Move

A Move represents a change in the solution.

Ussually the move holds a direct pointer to the part of the solution that it will change when `doMove(WorkingMemory)` is called. On that change it should also notify the `WorkingMemory` accordingly. A Move should implement `Object.equals(Object)` and `Object.hashCode()`.

Method Summary
`Move` | `createUndoMove(org.drools.WorkingMemory workingMemory)` Called before the move is done, so the move can be evaluated and then be undone without resulting into a permanent change in the solution.
`void` | `doMove(org.drools.WorkingMemory workingMemory)` Does the Move and updates the `Solution` and its `WorkingMemory` accordingly.
`boolean` | `isMoveDoable(org.drools.WorkingMemory workingMemory)` Called before a move is evaluated to decide wheter the move can be done and evaluated.

Method Detail

### isMoveDoable

    boolean isMoveDoable(org.drools.WorkingMemory workingMemory)

  Called before a move is evaluated to decide wheter the move can be done and evaluated. A Move isn't doable if:
  - Either doing it would change nothing in the solution.
  - Either it's simply not possible to do.
  Although you could filter out non-doable moves in for example the `MoveFactory`, this is not needed as the `Solver` will do it for you.

  Parameters:
    `workingMemory` - the `WorkingMemory` not yet modified by the move.
  Returns:
    true if the move achieves a change in the solution and the move is possible to do on the solution.

### createUndoMove

    Move createUndoMove(org.drools.WorkingMemory workingMemory)

  Called before the move is done, so the move can be evaluated and then be undone without resulting into a permanent change in the solution.

  Parameters:
    `workingMemory` - the `WorkingMemory` not yet modified by the move.
  Returns:
    an undoMove which does the exact opposite of this move.

### doMove

    void doMove(org.drools.WorkingMemory workingMemory)

  Does the Move and updates the `Solution` and its `WorkingMemory` accordingly. When the solution is modified, the `WorkingMemory`'s `FactHandle`s should be correctly notified, otherwise the score(s) calculated will be corrupted.

  Parameters:
    `workingMemory` - the `WorkingMemory` that needs to get notified of the changes.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011 JBoss Inc.. All Rights Reserved.