<commit_before>﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="FinalList.cs" company="<NAME>">
//   <NAME> 2013
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Belt.Equatable
{
    using System;

    public abstract class ValueBasedEquatable<TSelf, TValue> : IEquatable<ValueBasedEquatable<TSelf, TValue>>, IValueBasedEquatable<TValue>
    {
        // TODO This is a problem when TValue is e.g. a string
        private static readonly MemberwiseEqualityComparer<Tuple<TValue>> _equalityComparer = MemberwiseEqualityComparer<Tuple<TValue>>.ByFields;

        protected abstract TValue EquatableValue { get; }

        public bool Equals(ValueBasedEquatable<TSelf, TValue> other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }
            if (ReferenceEquals(this, other))
            {
                return true;
            }
            return _equalityComparer.Equals(Tuple.Create(EquatableValue), Tuple.Create(other.EquatableValue));
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }
            if (ReferenceEquals(this, obj))
            {
                return true;
            }
            if (obj.GetType() != GetType())
            {
                return false;<commit_msg>Obsolete TODO removed.<commit_after>﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="FinalList.cs" company="<NAME>">
//   <NAME> 2013
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Belt.Equatable
{
    using System;

    public abstract class ValueBasedEquatable<TSelf, TValue> : IEquatable<ValueBasedEquatable<TSelf, TValue>>, IValueBasedEquatable<TValue>
    {
        private static readonly MemberwiseEqualityComparer<Tuple<TValue>> _equalityComparer = MemberwiseEqualityComparer<Tuple<TValue>>.ByFields;

        protected abstract TValue EquatableValue { get; }

        public bool Equals(ValueBasedEquatable<TSelf, TValue> other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }
            if (ReferenceEquals(this, other))
            {
                return true;
            }
            return _equalityComparer.Equals(Tuple.Create(EquatableValue), Tuple.Create(other.EquatableValue));
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }
            if (ReferenceEquals(this, obj))
            {
                return true;
            }
            if (obj.GetType() != GetType())
            {
                return false;
{'fraction_non_alphanumeric': 0.23283678756476683, 'fraction_numerical': 0.0025906735751295338, 'mean_word_length': 1.231936416184971, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '7382175', 'n_tokens_mistral': 716, 'n_tokens_neox': 686, 'n_words': 148}