<commit_before>package de.lmu.ifi.dbs.distance;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

/**
 * Provides a Distance for a double-valued distance.
 * 
 * @author <NAME> (<a
 *         href="mailto:<EMAIL>"><EMAIL></a>)
 */
public class DoubleDistance extends NumberDistance<DoubleDistance>
{

    /**
     * Generated serialVersionUID.
     */
    private static final long serialVersionUID = 3711413449321214862L;

    /**
     * The double value of this distance.
     */
    double value;

    /**
     * Empty constructor for serialization purposes.
     */
    public DoubleDistance()
    {
        super();
    }

    /**
     * Constructs a new DoubleDistance object that represents the double
     * argument.
     * 
     * @param value
     *            the value to be represented by the DoubleDistance.
     */
    public DoubleDistance(double value)
    {
        super();
        this.value = value;
    }

    /**
     * @see de.lmu.ifi.dbs.distance.Distance#plus(Distance)
     */
    public DoubleDistance plus(DoubleDistance distance)
    {

        return new DoubleDistance(this.value + distance.value);
    }

    /**
     * @see de.lmu.ifi.dbs.distance.Distance#minus(Distance)
     */
    public DoubleDistance minus(DoubleDistance distance)
    {
        return new DoubleDistance(this.value - distance.value);
    }

    /**
     * Returns a new distance as the product of this distance and the given
     * distance.
     * 
     * @param distance
     *            the distancce to be multiplied with this distance
     * @return a new distance as the product of this distance and the given
     *         distance
     */
    public DoubleDistance times(DoubleDistance distance)
    {
        return new DoubleDistance(this.value * distance.value);
    }

    /**
     * Returns a new distance as the product of this distance and the given
     * double value.
     * 
     * @param lambda
     *            the double value this distance should be multiplied with
     * @return a new distance as the product of this distance and the given
     *         double value
     */
    public DoubleDistance times(double lambda)
    {
        return new DoubleDistance(this.value * lambda);
    }

    /**
     * @see Comparable#compareTo(Object)
     */
    public int compareTo(DoubleDistance d)
    {
        return Double.compare(this.value, d.value);
    }

    /**
     * The object implements the writeExternal method to save its contents by
     * calling the methods of DataOutput for its primitive values or calling the
     * writeObject method of ObjectOutput for objects, strings, and arrays.
     * 
     * @param out
     *            the stream to write the object to<commit_msg>comment<commit_after>package de.lmu.ifi.dbs.distance;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;

/**
 * Provides a Distance for a double-valued distance.
 * 
 * @author <NAME> (<a
 *         href="mailto:<EMAIL>"><EMAIL></a>)
 */
public class DoubleDistance extends NumberDistance<DoubleDistance>
{

    /**
     * Generated serialVersionUID.
     */
    private static final long serialVersionUID = 3711413449321214862L;

    /**
     * The double value of this distance.
     */
    double value;

    /**
     * Empty constructor for serialization purposes.
     */
    public DoubleDistance()
    {
        super();
    }

    /**
     * Constructs a new DoubleDistance object that represents the double
     * argument.
     * 
     * @param value
     *            the value to be represented by the DoubleDistance.
     */
    public DoubleDistance(double value)
    {
        super();
        this.value = value;
    }

    /**
     * @see de.lmu.ifi.dbs.distance.Distance#plus(Distance)
     */
    public DoubleDistance plus(DoubleDistance distance)
    {

        return new DoubleDistance(this.value + distance.value);
    }

    /**
     * @see de.lmu.ifi.dbs.distance.Distance#minus(Distance)
     */
    public DoubleDistance minus(DoubleDistance distance)
    {
        return new DoubleDistance(this.value - distance.value);
    }

    /**
     * Returns a new distance as the product of this distance and the given
     * distance.
     * 
     * @param distance
     *            the distancce to be multiplied with this distance
     * @return a new distance as the product of this distance and the given
     *         distance
     */
    public DoubleDistance times(DoubleDistance distance)
    {
        return new DoubleDistance(this.value * distance.value);
    }

    /**
     * Returns a new distance as the product of this distance and the given
     * double value.
     * 
     * @param lambda
     *            the double value this distance should be multiplied with
     * @return a new distance as the product of this distance and the given
     *         double value
     */
    public DoubleDistance times(double lambda)
    {
        return new DoubleDistance(this.value * lambda);
    }

    /**
     * Compares this DoubleDistance with the given DoubleDistance
     * wrt the representad double.
     * 
     * <code>d1.compareTo(d2)</code> is the same as
     * {@link Double.compare(double, double) Double.compare(d1.value, d2.value)}.
     * 
     * @see Comparable#compareTo(Object)
     */
    public int compareTo(DoubleDistance d)
    {
        return Double.compare(this.value, d.value);
    }

    /**
     * The object implements the writeExternal method to save its contents by
     * calling the methods of DataOutput for its primitive values or calling the
     * writeObject method of ObjectOutput for objects, strings, and arrays.
     * 
     * @param out
     *            the stream to write the object to
{'fraction_non_alphanumeric': 0.0868133772309825, 'fraction_numerical': 0.007277768151100329, 'mean_word_length': 2.2066666666666666, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3218481', 'n_tokens_mistral': 1595, 'n_tokens_neox': 1519, 'n_words': 498}