Class Distribution.Parameter
java.lang.Object
common.distributions.Distribution.Parameter
- All Implemented Interfaces:
Cloneable
- Enclosing class:
Distribution
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Distribution.ValueCheckerprotected Stringprotected booleanprotected Stringprotected Objectprotected Class<?> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns a shallow copy of this Parameter.Gets a brief description of this parameter, used on distributionpanelgetName()Gets the name of this parametergetValue()Gets this parameter's valueGets a ValueChecker to check if a parameter's value is in the correct range.Class<?> Gets this parameter value's class, ie the class of which parameter value is instance of.booleanReturns if this parameter has to be added directly to the distribution when translating it into XMLparseValue(String value) Parses string if parameter is of a known numeric type.booleanSets value for this parameter.booleanSets value for this parameter.booleanSets value for this parameter.voidsetValueChecker(Distribution.ValueChecker checker) Sets a ValueChecker to check if a parameter's value is in the correct range.
-
Field Details
-
valueClass
-
value
-
name
-
description
-
checker
-
directParameter
protected boolean directParameter
-
-
Constructor Details
-
Parameter
Constructs a new Parameter object. If a custom check on input values is needed, a call tosetValueChecker(ValueChecker checker)method must be performed.- Parameters:
name- name of this parameterdescription- brief description of this parameter usagevalueClass- Class type of value of this parameterdefaultValue- initial value for this parametergetParameterClasspath()for more details.
-
Parameter
public Parameter(String name, String description, Class<?> valueClass, Object defaultValue, boolean directParameter) Constructs a new Parameter object. If a custom check on input values is needed, a call tosetValueChecker(ValueChecker checker)method must be performed.- Parameters:
name- name of this parameterdescription- brief description of this parameter usagevalueClass- Class type of value of this parameterdefaultValue- initial value for this parameterdirectParameter- indicates if this parameter will be added to the distribution of the parameter object when translating it to XMLgetParameterClasspath()for more details.
-
-
Method Details
-
setValueChecker
Sets a ValueChecker to check if a parameter's value is in the correct range. If no checks are required do not call this method- Parameters:
checker- Instance of ValueChecker Interface
-
getValueChecker
Gets a ValueChecker to check if a parameter's value is in the correct range. If no checks are required do not call this method- Returns:
- checker Instance of ValueChecker Interface
-
setValue
Sets value for this parameter. Returns if parameter could be assigned correctly- Parameters:
value- value to be assigned to this parameter- Returns:
- If value.class is different from valueClass, or parameter value is not valid, returns false, otherwise true
-
setValue
Sets value for this parameter. Returns if parameter could be assigned correctly- Parameters:
value- value to be assigned to this parameter- Returns:
- If value.class is different from valueClass, or parameter value is not valid, returns false, otherwise true
-
setValue
Sets value for this parameter. If parameter class is String sets it, otherwise try to parse string if parameter is of a known numeric type. Returns if parameter could be assigned correctly.- Parameters:
value- to be assigned to this parameter or to be parsed- Returns:
- If value.class is different from valueClass, or parameter value is not parsable or valid, returns false, otherwise true
-
parseValue
-
getValue
-
getValueClass
Gets this parameter value's class, ie the class of which parameter value is instance of.- Returns:
- parameter value's class
-
getDescription
Gets a brief description of this parameter, used on distributionpanel- Returns:
- parameter's description
-
getName
-
isDirectParameter
public boolean isDirectParameter()Returns if this parameter has to be added directly to the distribution when translating it into XML- Returns:
- true if the parameter has to be added to the distribution. false otherwise
-
clone
Returns a shallow copy of this Parameter. Note that as nothing can be inferred about all values clonability, so parameters are only referenced and not cloned. This should not be a problem as every value should be an immutable type.
-