<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BackEnd
{
    public abstract class Matrix
    {
        protected int[,] _Data;

        public Matrix(int size)
        {
            _Data = new int[size, size];
        }

        public Matrix(string path)
        {
            throw new NotImplementedException();
        }

        protected bool CheckRow(int row)
        {
            var set = new HashSet<int>();
            for (int col = 0; col != _Data.Length; ++col)
                set.Add(_Data[row, col]);
            return set.Count == _Data.Length;
        }

        protected bool CheckCol(int col)
        {
            var set = new HashSet<int>();
            for (int row = 0; row != _Data.Length; ++row)
                set.Add(_Data[row, col]);
            return set.Count == _Data.Length;
        }

        protected abstract bool CheckRgn(int row, int col);
        protected abstract bool CheckAll();

        public Tuple<bool, bool, bool, bool> SetValue(int row, int col, int val)
        {
            _Data[row, col] = val;
            var isValidRow = this.CheckRow(row);
            var isValidCol = this.CheckCol(col);
            var isValidRgn = this.CheckRgn(row, col);
            var isValidAll = isValidRow && isValidCol && isValidRgn ? this.CheckAll() : false;
            return Tuple.Create(isValidRow, isValidCol, isValidRgn, isValidAll);
        }

    }
}<commit_msg>add a 0 value checking<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BackEnd
{
    internal abstract class Matrix
    {
        protected int[,] _Data;

        public Matrix(int size)
        {
            _Data = new int[size, size];
        }

        protected bool CheckRow(int row)
        {
            var set = new HashSet<int>();
            for (int col = 0; col != _Data.Length; ++col)
                if (_Data[row, col] != 0) set.Add(_Data[row, col]);
            return set.Count == _Data.Length;
        }

        protected bool CheckCol(int col)
        {
            var set = new HashSet<int>();
            for (int row = 0; row != _Data.Length; ++row)
                if (_Data[row, col] != 0) set.Add(_Data[row, col]);
            return set.Count == _Data.Length;
        }

        protected abstract bool CheckRgn(int row, int col);
        protected abstract bool CheckAll();

        public Tuple<bool, bool, bool, bool> SetValue(int row, int col, int val)
        {
            _Data[row, col] = val;
            var isValidRow = this.CheckRow(row);
            var isValidCol = this.CheckCol(col);
            var isValidRgn = this.CheckRgn(row, col);
            var isValidAll = isValidRow && isValidCol && isValidRgn ? this.CheckAll() : false;
            return Tuple.Create(isValidRow, isValidCol, isValidRgn, isValidAll);
        }
    }
}
{'fraction_non_alphanumeric': 0.10962118672477372, 'fraction_numerical': 0.0023466309084813944, 'mean_word_length': 1.8830917874396136, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5291598', 'n_tokens_mistral': 877, 'n_tokens_neox': 856, 'n_words': 244}