Package pal.algorithmics
Class UndoableAction.Utils
- java.lang.Object
-
- pal.algorithmics.UndoableAction.Utils
-
- Enclosing interface:
- UndoableAction
public static final class UndoableAction.Utils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static UndoableAction
getCombined(UndoableAction[] subActions)
Create an action that combines multiple actionsstatic UndoableAction
getDistributedSelection(UndoableAction[] subActions, double[] actionProportions)
Create an action that selects uniformly from a number of sub actionsstatic UndoableAction
getSimpleDesparation(UndoableAction primaryAction, UndoableAction desparateAction, double desparationLimit, int desparationInterval)
A simple tool for change actions when things get desparatestatic UndoableAction
getSimpleUniformSelection(UndoableAction[] subActions)
Create an action that selects uniformly from a number of sub actions
-
-
-
Method Detail
-
getSimpleUniformSelection
public static final UndoableAction getSimpleUniformSelection(UndoableAction[] subActions)
Create an action that selects uniformly from a number of sub actions- Parameters:
subActions
-- Returns:
-
getDistributedSelection
public static final UndoableAction getDistributedSelection(UndoableAction[] subActions, double[] actionProportions)
Create an action that selects uniformly from a number of sub actions- Parameters:
subActions
-acitionProportions
-- Returns:
- Throws:
java.lang.IllegalArgumentException
- if action array and proportion arrays are different lengths
-
getCombined
public static final UndoableAction getCombined(UndoableAction[] subActions)
Create an action that combines multiple actions- Parameters:
subActions
- The actions that are do in turn.- Returns:
- An action that performs all the sub actions
-
getSimpleDesparation
public static final UndoableAction getSimpleDesparation(UndoableAction primaryAction, UndoableAction desparateAction, double desparationLimit, int desparationInterval)
A simple tool for change actions when things get desparate- Parameters:
primaryAction
- The main action to do when things are going welldesparateAction
- The action to do when things get desparate. The desperation value for the desparate action will be scaled according to how much over the limit we aredesparationLimit
- The desparate value at which we start doing the desparate actiondesparationInterval
- The time between desparate actions when we cross the cutoff (a value of one will mean do all the time after desparation value has crossed cutoff)
-
-