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.generic
Class GenericSwapMove

    java.lang.Object
      org.drools.planner.core.move.generic.GenericSwapMove

All Implemented Interfaces:
  TabuPropertyEnabled, Move

    public class GenericSwapMove

extends Object
implements Move, TabuPropertyEnabled

Constructor Summary
`GenericSwapMove(Collection<PlanningVariableDescriptor> planningVariableDescriptors, Object leftPlanningEntity, org.drools.FactHandle leftPlanningEntityFactHandle, Object rightPlanningEntity, org.drools.FactHandle rightPlanningEntityFactHandle)`

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` | `equals(Object o)`
`Collection<? extends Object>` | `getTabuProperties()` The returned Collection should a stable order.
`int` | `hashCode()`
`boolean` | `isMoveDoable(org.drools.WorkingMemory workingMemory)` Called before a move is evaluated to decide whether the move can be done and evaluated.
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### GenericSwapMove

    public GenericSwapMove(Collection<PlanningVariableDescriptor> planningVariableDescriptors,
                           Object leftPlanningEntity,
                           org.drools.FactHandle leftPlanningEntityFactHandle,
                           Object rightPlanningEntity,
                           org.drools.FactHandle rightPlanningEntityFactHandle)

Method Detail

### isMoveDoable

    public boolean isMoveDoable(org.drools.WorkingMemory workingMemory)

  Description copied from interface: `Move`
  Called before a move is evaluated to decide whether 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 (for example due to build-in hard constraints).
  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.

  Specified by:
    `isMoveDoable` in interface `Move`
  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

    public Move createUndoMove(org.drools.WorkingMemory workingMemory)

  Description copied from interface: `Move`
  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.

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

### doMove

    public void doMove(org.drools.WorkingMemory workingMemory)

  Description copied from interface: `Move`
  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.

  Specified by:
    `doMove` in interface `Move`
  Parameters:
    `workingMemory` - never null, the `WorkingMemory` that needs to get notified of the changes.

### getTabuProperties

    public Collection<? extends Object> getTabuProperties()

  Description copied from interface: `TabuPropertyEnabled`
  The returned Collection should a stable order. For example: use `List` or `LinkedHashSet`, but not `HashSet`. Duplicates entries in the returned Collection are best avoided.

  Specified by:
    `getTabuProperties` in interface `TabuPropertyEnabled`
  Returns:
    never null

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

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-2012 JBoss by Red Hat. All Rights Reserved.