public class IndexBasedModelConverter extends Object implements ModelConverter
ModelConverter based on using the indices of supplied Parameter and Value. This means
that the first parameter in the list of InputParameterModel.getParameters() is translated to 0, the second
one to 1 and so on and so fourth. The same is done with values per parameter.
These integers are then used for TupleList and Combination, so [0, 1] is a combination
where the first parameter is mapped to it's first value and the second one to its second value.| Constructor and Description |
|---|
IndexBasedModelConverter(InputParameterModel model)
Creates and initializes a new converter with a
SimpleCartesianProductConstraintConverter to convert
Constraint to TupleList. |
IndexBasedModelConverter(InputParameterModel model,
IndexBasedConstraintConverter constraintsConverter)
Creates and initializes a new converter with the given model and constraints converter.
|
| Modifier and Type | Method and Description |
|---|---|
int[] |
convertCombination(Combination combination)
Converts a
Combination object to an integer array representation with the corresponding value number. |
Combination |
convertCombination(int[] combination)
Converts a combinations represented by an integer array into a
Combination object with the corresponding
parameters and values. |
TupleList |
convertConstraint(Constraint constraint)
Converts a
Constraint object into a TupleList representation which is equal. |
Constraint |
convertConstraint(TupleList constraint)
Converts a
TupleList object into a Constraint representation which is equal. |
Parameter |
convertParameter(int parameter)
Converts an integer representation back to a
Parameter object. |
int |
convertParameter(Parameter parameter)
Converts a
Parameter object into an equivalent integer representation. |
Value |
convertValue(int parameter,
int value)
Converts the integer representation of a value into a
Value object. |
int |
convertValue(Parameter parameter,
Value value)
Converts a
Value to an integer representation. |
CombinatorialTestModel |
getConvertedModel() |
InputParameterModel |
getModel() |
public IndexBasedModelConverter(InputParameterModel model)
SimpleCartesianProductConstraintConverter to convert
Constraint to TupleList.model - the model which is converted. Must not be nullpublic IndexBasedModelConverter(InputParameterModel model, IndexBasedConstraintConverter constraintsConverter)
model - the model which is converted. Must not be nullconstraintsConverter - the converter used to convert the model's Constraint to TupleListpublic InputParameterModel getModel()
getModel in interface ModelConverterModelConverterpublic CombinatorialTestModel getConvertedModel()
getConvertedModel in interface ModelConverterModelConverter.getModel())public int[] convertCombination(Combination combination)
ModelConverterCombination object to an integer array representation with the corresponding value number.
If the array returned by this method is given into ModelConverter.convertCombination(int[]), a Combination
equal to the original one should be returned.convertCombination in interface ModelConvertercombination - the combination to be converted. Must not be nullpublic Combination convertCombination(int[] combination)
ModelConverterCombination object with the corresponding
parameters and values.convertCombination in interface ModelConvertercombination - the combination to be converted. Must not be nullCombination so that it matches the model conversionpublic int convertParameter(Parameter parameter)
ModelConverterParameter object into an equivalent integer representation. If the integer returned by
this method is given to ModelConverter.convertParameter(int), the original parameter is returned.convertParameter in interface ModelConverterparameter - the parameter to convert. Needs to be in the original model, otherwise success of this method
is not guaranteed. Must not be nullpublic Parameter convertParameter(int parameter)
ModelConverterParameter object.convertParameter in interface ModelConverterparameter - the parameter to convert. Needs to be in the original model, otherwise success of this method
is not guaranteed. Must not be negativeParameter representation so that it matches the model conversionpublic int convertValue(Parameter parameter, Value value)
ModelConverterValue to an integer representation. As values are only unique in their corresponding
Parameters, the parameter is needed as well. It can be converted using
ModelConverter.convertParameter(Parameter). If the converted value and parameter are given to
ModelConverter.convertValue(int, int), the original value is returned.convertValue in interface ModelConverterparameter - the parameter in which the value is locatedvalue - the value to convertpublic Value convertValue(int parameter, int value)
ModelConverterValue object. The parameter is needed since
values are only unique in the context of their parameters. The parameter can be converted with
ModelConverter.convertParameter(int).convertValue in interface ModelConverterparameter - the parameter in which the value is locatedvalue - the value to convertValue representation so that it matches the model conversionpublic TupleList convertConstraint(Constraint constraint)
ModelConverterConstraint object into a TupleList representation which is equal. If the
TupleList returned by this method is given to ModelConverter.convertConstraint(TupleList), the original
constraint will be returned.convertConstraint in interface ModelConverterconstraint - the constraint to convert. Needs to be one in the original model, otherwise success of this
method is not guaranteed. Must not be nullTupleList representation so that it matches the model conversionpublic Constraint convertConstraint(TupleList constraint)
ModelConverterTupleList object into a Constraint representation which is equal.convertConstraint in interface ModelConverterconstraint - the constraint to convert. Needs to be one in the original model, otherwise success of this
method is not guaranteed. Must not be nullConstraint representation so that it matches the model conversionCopyright © 2019. All rights reserved.