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 beingnull
and 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 class
Value.Builder
Helper 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 boolean
equals(Object object)
Object
get()
int
getId()
double
getRequiredWeight()
OptionalDouble
getWeight()
int
hashCode()
boolean
hasWeight()
String
toString()
static Value
value(int id, Object data)
Convenience method which can be statically imported for easier and more readable code.static Value
value(int id, Object data, double weight)
Convenience method which can be statically imported for easier and more readable code.static Value.Builder
weighted(Object data, double weight)
Creates aValue.Builder
with 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 benull
weight
- 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 benull
weight
- 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.Builder
with the given data and weight.This can be used together with
Parameter.Builder
to given weights to values.- Parameters:
data
- the data value to be saved. Can benull
weight
- the weight of the value which can be used to prioritize values. Higher weight = higher priority- Returns:
- the builder with the given data
-
-