Class 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 being null and no object being present. The id field is need for quicker comparison in hashCode() and equals(Object) and is only valid when comparing values inside one Parameter.
    • 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 parameter
        data - the data value to be saved. Can be null
      • 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 parameter
        data - the data value to be saved. Can be null
        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
      • getRequiredWeight

        public double getRequiredWeight()
      • hasWeight

        public boolean hasWeight()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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 parameter
        data - the data value to be saved. Can be null
        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 parameter
        data - the data value to be saved. Can be null
        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 a Value.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 be null
        weight - the weight of the value which can be used to prioritize values. Higher weight = higher priority
        Returns:
        the builder with the given data