<commit_before>/*  Copyright 2016 <NAME>
*
*   Licensed under the Apache License, Version 2.0 (the "License");
*   you may not use this file except in compliance with the License.
*   You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*   Unless required by applicable law or agreed to in writing, software
*   distributed under the License is distributed on an "AS IS" BASIS,
*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*   See the License for the specific language governing permissions and
*   limitations under the License.
*/
using System;
using System.Collections;
using System.Linq;

namespace FenixLib.Core
{
    [Serializable ()]
    public partial class Palette : IEnumerable
    {
        private Color[] _colors;

        protected Palette ( Color[] colors )
        {
            _colors = colors;
        }

        public Color[] Colors
        {
            get { return _colors; }
        }
        public Color this[int index]
        {
            get { return _colors[index]; }
            set { _colors[index] = value; }
        }

        public static Palette Create ( Color[] colors )
        {
            if ( colors.Length < 256 )
                throw new ArgumentException (); // TODO: Customize

            return new Palette ( colors );
        }

        public Palette GetCopy ()
        {
            Color[] colors = new Color[_colors.Length];
            _colors.CopyTo ( colors, 0 );
            return Create ( colors );
        }

        public IEnumerator GetEnumerator ()
        {
            return _colors.GetEnumerator ();
        }

        public override bool Equals ( object obj )
        {
            if ( ReferenceEquals ( obj, null ) )
            {
                return false;
            }

            // Should we use reference comparison?
            Palette palette = obj as Palette;
            if ( ReferenceEquals ( palette, null ) )
            {
                return false;
            }

            return Equals ( palette );
        }

        public bool Equals ( Palette palette )
        {
            // TODO: does it matter if we have the (object)?
            // Should we use reference comparison?
            if ( ReferenceEquals ( palette, null ) )
            {
                return false;
            }

            return ( Colors.SequenceEqual ( Colors ) );
        }

        public override int GetHashCode ()
        {
            // TODO: Pending to do a proper hashcode :)
            return _colors[0].r.GetHashCode () ^ _colors[100].r.GetHashCode ();
        }

        public static bool operator == ( Palette paletteA, Palette paletteB )
        {
            if ( ReferenceEquals ( paletteA, null ) )
            {
                return ReferenceEquals ( paletteB, null );
            }

            return paletteA.Equals ( paletteB );
        }

        public static bool operator != ( Palette paletteA, Palette paletteB )
        {
            return !( paletteA == paletteB );
        }
    }
}<commit_msg>Removed trailing underscore from private fields.<commit_after>/*  Copyright 2016 <NAME>
*
*   Licensed under the Apache License, Version 2.0 (the "License");
*   you may not use this file except in compliance with the License.
*   You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*   Unless required by applicable law or agreed to in writing, software
*   distributed under the License is distributed on an "AS IS" BASIS,
*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*   See the License for the specific language governing permissions and
*   limitations under the License.
*/
using System;
using System.Collections;
using System.Linq;

namespace FenixLib.Core
{
    [Serializable ()]
    public partial class Palette : IEnumerable
    {
        private Color[] colors;

        protected Palette ( Color[] colors )
        {
            this.colors = colors;
        }

        public Color[] Colors
        {
            get { return colors; }
        }
        public Color this[int index]
        {
            get { return colors[index]; }
            set { colors[index] = value; }
        }

        public static Palette Create ( Color[] colors )
        {
            if ( colors.Length < 256 )
                throw new ArgumentException (); // TODO: Customize

            return new Palette ( colors );
        }

        public Palette GetCopy ()
        {
            Color[] colors = new Color[this.colors.Length];
            this.colors.CopyTo ( colors, 0 );
            return Create ( colors );
        }

        public IEnumerator GetEnumerator ()
        {
            return colors.GetEnumerator ();
        }

        public override bool Equals ( object obj )
        {
            if ( ReferenceEquals ( obj, null ) )
            {
                return false;
            }

            // Should we use reference comparison?
            Palette palette = obj as Palette;
            if ( ReferenceEquals ( palette, null ) )
            {
                return false;
            }

            return Equals ( palette );
        }

        public bool Equals ( Palette palette )
        {
            // TODO: does it matter if we have the (object)?
            // Should we use reference comparison?
            if ( ReferenceEquals ( palette, null ) )
            {
                return false;
            }

            return ( Colors.SequenceEqual ( Colors ) );
        }

        public override int GetHashCode ()
        {
            // TODO: Pending to do a proper hashcode :)
            return colors[0].r.GetHashCode () ^ colors[100].r.GetHashCode ();
        }

        public static bool operator == ( Palette paletteA, Palette paletteB )
        {
            if ( ReferenceEquals ( paletteA, null ) )
            {
                return ReferenceEquals ( paletteB, null );
            }

            return paletteA.Equals ( paletteB );
        }

        public static bool operator != ( Palette paletteA, Palette paletteB )
        {
            return !( paletteA == paletteB );
        }
    }
}
{'fraction_non_alphanumeric': 0.08175088509816543, 'fraction_numerical': 0.005149662053427744, 'mean_word_length': 1.5534100246507807, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2626099', 'n_tokens_mistral': 1583, 'n_tokens_neox': 1505, 'n_words': 525}