<commit_before>/*
  Copyright 2014 SINTEF ICT, Applied Mathematics.
*/

#ifndef DIMENSION_HEADER_INCLUDED
#define DIMENSION_HEADER_INCLUDED

#include <array>

enum BaseDimension {
    Length,
    Time,
    Mass,
    Temperature,
    ElectricCurrent,
    QuantityOfSubstance,
    LuminousIntensity
};

class Dimension
{
public:
    Dimension()
        : dim_{{ 0, 0, 0, 0, 0, 0, 0 }}
    {
    }

    // Accept implicit conversion from array.
    Dimension(const std::array<int,7>& dim)
        : dim_(dim)
    {
    }

    void setCoefficient(BaseDimension index, int coeff)
    {
        dim_[index] = coeff;
    }

    int coefficient(BaseDimension index)
    {
        return dim_[index];
    }

    Dimension operator+ (const Dimension& other)
    {
        Dimension result(*this);
        for (int dd = 0; dd < 7; ++dd) {
            result.dim_[dd] += other.dim_[dd];
        }
        return result;
    }

    Dimension operator- (const Dimension& other)
    {
        Dimension result(*this);<commit_msg>Make coefficient() const.<commit_after>/*
  Copyright 2014 SINTEF ICT, Applied Mathematics.
*/

#ifndef DIMENSION_HEADER_INCLUDED
#define DIMENSION_HEADER_INCLUDED

#include <array>

enum BaseDimension {
    Length,
    Time,
    Mass,
    Temperature,
    ElectricCurrent,
    QuantityOfSubstance,
    LuminousIntensity
};

class Dimension
{
public:
    Dimension()
        : dim_{{ 0, 0, 0, 0, 0, 0, 0 }}
    {
    }

    // Accept implicit conversion from array.
    Dimension(const std::array<int,7>& dim)
        : dim_(dim)
    {
    }

    void setCoefficient(BaseDimension index, int coeff)
    {
        dim_[index] = coeff;
    }

    int coefficient(BaseDimension index) const
    {
        return dim_[index];
    }

    Dimension operator+ (const Dimension& other)
    {
        Dimension result(*this);
        for (int dd = 0; dd < 7; ++dd) {
            result.dim_[dd] += other.dim_[dd];
        }
        return result;
    }

    Dimension operator- (const Dimension& other)
    {
        Dimension result(*this);
{'fraction_non_alphanumeric': 0.10997067448680352, 'fraction_numerical': 0.013685239491691105, 'mean_word_length': 2.2962962962962963, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '5357994', 'n_tokens_mistral': 703, 'n_tokens_neox': 662, 'n_words': 162}