org.drools.planner.core.move
Class CompositeMove
java.lang.Object
org.drools.planner.core.move.CompositeMove
- All Implemented Interfaces:
- TabuPropertyEnabled, Move
public class CompositeMove
- extends Object
- implements Move, TabuPropertyEnabled
A CompositeMove is composed out of multiple other moves.
Warning: one of the moveList moves should not rely on the effect on of a previous moveList move
to create an uncorrupted undoMove. In other words,
- See Also:
Move
moveList
protected List<Move> moveList
CompositeMove
public CompositeMove(List<Move> moveList)
- Parameters:
moveList
- cannot be null
getMoveList
public List<Move> getMoveList()
isMoveDoable
public boolean isMoveDoable(org.drools.WorkingMemory workingMemory)
- Description copied from interface:
Move
- 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.
- 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
- the WorkingMemory
that needs to get notified of the changes.
getTabuProperties
public Collection<? extends Object> getTabuProperties()
- Specified by:
getTabuProperties
in interface TabuPropertyEnabled
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
Copyright © 2001-2011 JBoss Inc.. All Rights Reserved.