Class ScalarWeight

    • Field Detail

      • NON_VIABLE_WEIGHT

        public static final ScalarWeight NON_VIABLE_WEIGHT
        Instance of scalar weight to mark links/paths which can not be traversed.
    • Constructor Detail

      • ScalarWeight

        public ScalarWeight​(double value)
        Creates a new scalar weight with the given double value.
        Parameters:
        value - double value
    • Method Detail

      • toWeight

        public static ScalarWeight toWeight​(double value)
        Creates a new scalar weight with the given double value.
        Parameters:
        value - double value
        Returns:
        scalar weight instance
      • merge

        public Weight merge​(Weight otherWeight)
        Description copied from interface: Weight
        Merges the given weight with this one returning a new aggregated weight.
        Specified by:
        merge in interface Weight
        Parameters:
        otherWeight - weight to add
        Returns:
        aggregated weight
      • subtract

        public Weight subtract​(Weight otherWeight)
        Description copied from interface: Weight
        Subtracts the given weight from this one and produces a new weight.
        Specified by:
        subtract in interface Weight
        Parameters:
        otherWeight - weight to subtract
        Returns:
        residual weight
      • isViable

        public boolean isViable()
        Description copied from interface: Weight
        Returns true if the weighted subject (link/path) can be traversed; false otherwise.
        Specified by:
        isViable in interface Weight
        Returns:
        true if weight is adequate, false if weight is infinite
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isNegative

        public boolean isNegative()
        Description copied from interface: Weight
        Returns true if the weight is negative (means that aggregated path cost will decrease if we add weighted subject to it).
        Specified by:
        isNegative in interface Weight
        Returns:
        true if the weight is negative, false otherwise
      • value

        public double value()
        Returns inner double value.
        Returns:
        double value
      • setSamenessThreshold

        public static void setSamenessThreshold​(double threshold)
        Sets a new sameness threshold for comparing cost values; default is is Double.MIN_VALUE.
        Parameters:
        threshold - fractional double value
      • samenessThreshold

        public static double samenessThreshold()
        Returns the current sameness threshold for comparing cost values.
        Returns:
        current threshold