public class DiscreteParameter extends IndependentParameter
discreteType
: 0: string 1: integer 2: double
This project was carried out at:
and supported byGenOpt Copyright (c) 1998-2021, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.
Modifier and Type | Field and Description |
---|---|
protected int |
dimension
number of admissible elements
|
protected int |
discreteType
flag for native type of elements in
values 0: string, 1: integer, 2: double |
protected int |
index
current value of the parameter
|
protected java.lang.String[] |
values
set of admissible values
|
protected double[] |
valuesNum
set of admissible values.
|
name
Constructor and Description |
---|
DiscreteParameter()
constructor.
|
DiscreteParameter(java.lang.String VariableName,
int InitialValue,
java.lang.String[] Values)
Constructor for a discrete variable.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.Object |
clone()
Clone
|
int |
getDiscreteType()
Gets the discrete
discreteType , as specified in DiscreteParameter. |
int |
getIndex()
Gets the index that points to the currently selected value.
|
double |
getValueDouble()
Gets the double representation of the currently selected value.
|
double |
getValueDouble(int ind)
Gets the double representation of the element with index
ind . |
java.lang.String |
getValueString()
Gets the string representation of the currently selected value.
|
java.lang.String |
getValueString(int ind)
Gets the string representation of the element with index
ind . |
int |
length()
Gets the number of elements
|
getName
protected java.lang.String[] values
protected double[] valuesNum
valuesNum
is the double representation of values
protected int dimension
protected int discreteType
values
protected int index
public DiscreteParameter()
public DiscreteParameter(java.lang.String VariableName, int InitialValue, java.lang.String[] Values)
VariableName
- Name of the free parameter as specified in the
command fileInitialValue
- Index of initial value of free parameterValues
- Set of admissible valuesprotected java.lang.Object clone()
clone
in class java.lang.Object
public final int getIndex()
public final int length()
public final java.lang.String getValueString()
public final java.lang.String getValueString(int ind)
ind
.ind
- index of the elementind
public final double getValueDouble()
public final double getValueDouble(int ind)
ind
.ind
is returned.ind
- index of the elementind
public int getDiscreteType()
discreteType
, as specified in DiscreteParameter.discreteType