Class Value
- java.lang.Object
-
- de.rwth.swc.coffee4j.engine.configuration.model.Value
-
public final class Value extends Object
Represents a value for a input parameter testModel in combinatorial testing. One could say that this class is not really needed as it just wraps an object, but it gives the additional distinction between this value object beingnulland no object being present. The id field is need for quicker comparison inhashCode()andequals(Object)and is only valid when comparing values inside oneParameter.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classValue.BuilderHelper class which temporary stores data and weight until an id can be assigned to the value.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object object)Objectget()intgetId()doublegetRequiredWeight()OptionalDoublegetWeight()inthashCode()booleanhasWeight()StringtoString()static Valuevalue(int id, Object data)Convenience method which can be statically imported for easier and more readable code.static Valuevalue(int id, Object data, double weight)Convenience method which can be statically imported for easier and more readable code.static Value.Builderweighted(Object data, double weight)Creates aValue.Builderwith the given data and weight.
-
-
-
Constructor Detail
-
Value
public Value(int id, Object data)Creates a new value with the given id and object- Parameters:
id- an id which should be unique inside the values parameterdata- the data value to be saved. Can benull
-
Value
public Value(int id, Object data, Double weight)Creates a new value with the given id and object- Parameters:
id- an id which should be unique inside the values parameterdata- the data value to be saved. Can benullweight- the weight of the value which can be used to prioritize values. Higher weight = higher priority
-
-
Method Detail
-
getId
public int getId()
- Returns:
- the values id which is unique only inside its parameter
-
get
public Object get()
- Returns:
- the actual value. May be
null
-
getWeight
public OptionalDouble getWeight()
-
getRequiredWeight
public double getRequiredWeight()
-
hasWeight
public boolean hasWeight()
-
value
public static Value value(int id, Object data)
Convenience method which can be statically imported for easier and more readable code.- Parameters:
id- an id which should be unique inside the values parameterdata- the data value to be saved. Can benull- Returns:
- a value with the given id and data
-
value
public static Value value(int id, Object data, double weight)
Convenience method which can be statically imported for easier and more readable code.- Parameters:
id- an id which should be unique inside the values parameterdata- the data value to be saved. Can benullweight- the weight of the value which can be used to prioritize values. Higher weight = higher priority- Returns:
- a value with the given id and data
-
weighted
public static Value.Builder weighted(Object data, double weight)
Creates aValue.Builderwith the given data and weight.This can be used together with
Parameter.Builderto given weights to values.- Parameters:
data- the data value to be saved. Can benullweight- the weight of the value which can be used to prioritize values. Higher weight = higher priority- Returns:
- the builder with the given data
-
-