Package org.uncommons.watchmaker.swing
Class ProbabilityParameterControl
- java.lang.Object
-
- org.uncommons.watchmaker.swing.ProbabilityParameterControl
-
- All Implemented Interfaces:
EvolutionControl
public class ProbabilityParameterControl extends Object implements EvolutionControl
A GUI control that allows the user to set/update the value of aProbabilityparameter.
-
-
Constructor Summary
Constructors Constructor Description ProbabilityParameterControl(Probability defaultValue)Creates a control with a default range of 0..1 and a default granularity of 2 decimal places.ProbabilityParameterControl(Probability minimum, Probability maximum, int decimalPlaces, Probability initialValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JComponentgetControl()NumberGenerator<Probability>getNumberGenerator()Returns a number generator that simply returns the current probability value represented by the position of the slider control.voidreset()Resets the control to its initial configuration.voidsetDescription(String description)Provides a textual description of the purpose of the control.
-
-
-
Constructor Detail
-
ProbabilityParameterControl
public ProbabilityParameterControl(Probability defaultValue)
Creates a control with a default range of 0..1 and a default granularity of 2 decimal places.- Parameters:
defaultValue- The default probability value.
-
ProbabilityParameterControl
public ProbabilityParameterControl(Probability minimum, Probability maximum, int decimalPlaces, Probability initialValue)
- Parameters:
minimum- The minimum probability that this control will permit.maximum- The maximum probability that this control will permit.decimalPlaces- The granularity of the control.initialValue- The default probability.
-
-
Method Detail
-
getControl
public JComponent getControl()
- Specified by:
getControlin interfaceEvolutionControl- Returns:
- The GUI component used by this control.
-
reset
public void reset()
Resets the control to its initial configuration.- Specified by:
resetin interfaceEvolutionControl
-
getNumberGenerator
public NumberGenerator<Probability> getNumberGenerator()
Returns a number generator that simply returns the current probability value represented by the position of the slider control.- Returns:
- A number generator that can be used to control an evolutionary program.
-
setDescription
public void setDescription(String description)
Provides a textual description of the purpose of the control. This may be displayed somewhere on the GUI component (typically as tooltip text).- Specified by:
setDescriptionin interfaceEvolutionControl- Parameters:
description- The description of the control.
-
-