<commit_before>/*
 * bacteria-ui, GUI for cellular automaton
 * Copyright (C) 2016 <NAME>
 *
 * See the LICENSE file for terms of use.
 */

#include "TableModel.hpp"

TableModel::TableModel(QObject* parent, Ints hashes) :
    QAbstractTableModel(parent), hashes_(hashes) {
}

int TableModel::rowCount(const Index& /*parent*/) const {
    return 1;
}

int TableModel::columnCount(const Index& /*parent*/) const {
    return hashes_.size();
}

QVariant TableModel::data(const Index& index, int role) const {
    if (role == Qt::DecorationRole) {
        return QColor(QRgb(hashes_[index.column()]));
    }
    return QVariant();
}

void TableModel::updateData() {
    reset();
}
<commit_msg>TableModel: one column and many rows<commit_after>/*
 * bacteria-ui, GUI for cellular automaton
 * Copyright (C) 2016 <NAME>
 *
 * See the LICENSE file for terms of use.
 */

#include "TableModel.hpp"

TableModel::TableModel(QObject* parent, Ints hashes) :
    QAbstractTableModel(parent), hashes_(hashes) {
}

int TableModel::rowCount(const Index& /*parent*/) const {
    return hashes_.size();
}

int TableModel::columnCount(const Index& /*parent*/) const {
    return 1;
}

QVariant TableModel::data(const Index& index, int role) const {
    if (role == Qt::DecorationRole) {
        return QColor(QRgb(hashes_[index.row()]));
    }
    return QVariant();
}

void TableModel::updateData() {
    reset();
}

{'fraction_non_alphanumeric': 0.1452074391988555, 'fraction_numerical': 0.00715307582260372, 'mean_word_length': 4.105839416058394, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6922985', 'n_tokens_mistral': 468, 'n_tokens_neox': 451, 'n_words': 119}