<commit_before>﻿using System;
using System.ComponentModel;
using Xamarin.Forms;

namespace Xamarin.FormsBook.Toolkit
{
    public class ColorViewModel : INotifyPropertyChanged
    {
        Color color;

        public event PropertyChangedEventHandler PropertyChanged;

        public double Red
        {
            set 
            {
                if (color.R != value)
                    Color = Color.FromRgba(value, color.G, color.B, color.A);
            }
            get 
            {
                return color.R; 
            }
        }

        public double Green
        {
            set
            {
                if (color.G != value)
                    Color = Color.FromRgba(color.R, value, color.B, color.A);
            }
            get
            {
                return color.G;
            }
        }

        public double Blue
        {
            set
            {
                if (color.B != value)
                    Color = Color.FromRgba(color.R, color.G, value, color.A);
            }
            get
            {
                return color.B;
            }
        }

        public double Alpha
        {
            set
            {
                if (color.A != value)
                    Color = Color.FromRgba(color.R, color.G, color.B, value);
            }
            get
            {
                return color.A;
            }
        }

        public double Hue
        {
            set
            {
                if (color.Hue != value)
                    Color = Color.FromHsla(value, color.Saturation, color.Luminosity, color.A);
            }
            get
            {
                return color.Hue;
            }
        }

        public double Saturation
        {
            set
            {
                if (color.Saturation != value)
                    Color = Color.FromHsla(color.Hue, value, color.Luminosity, color.A);
            }
            get
            {
                return color.Saturation;
            }
        }

        public double Luminosity
        {
            set
            {
                if (color.Luminosity != value)
                    Color = Color.FromHsla(color.Hue, color.Saturation, value, color.A);
            }
            get
            {
                return color.Luminosity;
            }
        }

        public Color Color
        {
            set
            {
                Color oldColor = color;

                if (color != value)
                {
                    color = value;
                    OnPropertyChanged("Color");
                }

                if (color.R != oldColor.R)
                    OnPropertyChanged("Red");

                if (color.G != oldColor.G)
                    OnPropertyChanged("Red");

                if (color.B != oldColor.B)<commit_msg>Nobody noticed this bug in ColorViewModel?<commit_after>﻿using System;
using System.ComponentModel;
using Xamarin.Forms;

namespace Xamarin.FormsBook.Toolkit
{
    public class ColorViewModel : INotifyPropertyChanged
    {
        Color color;

        public event PropertyChangedEventHandler PropertyChanged;

        public double Red
        {
            set 
            {
                if (color.R != value)
                    Color = Color.FromRgba(value, color.G, color.B, color.A);
            }
            get 
            {
                return color.R; 
            }
        }

        public double Green
        {
            set
            {
                if (color.G != value)
                    Color = Color.FromRgba(color.R, value, color.B, color.A);
            }
            get
            {
                return color.G;
            }
        }

        public double Blue
        {
            set
            {
                if (color.B != value)
                    Color = Color.FromRgba(color.R, color.G, value, color.A);
            }
            get
            {
                return color.B;
            }
        }

        public double Alpha
        {
            set
            {
                if (color.A != value)
                    Color = Color.FromRgba(color.R, color.G, color.B, value);
            }
            get
            {
                return color.A;
            }
        }

        public double Hue
        {
            set
            {
                if (color.Hue != value)
                    Color = Color.FromHsla(value, color.Saturation, color.Luminosity, color.A);
            }
            get
            {
                return color.Hue;
            }
        }

        public double Saturation
        {
            set
            {
                if (color.Saturation != value)
                    Color = Color.FromHsla(color.Hue, value, color.Luminosity, color.A);
            }
            get
            {
                return color.Saturation;
            }
        }

        public double Luminosity
        {
            set
            {
                if (color.Luminosity != value)
                    Color = Color.FromHsla(color.Hue, color.Saturation, value, color.A);
            }
            get
            {
                return color.Luminosity;
            }
        }

        public Color Color
        {
            set
            {
                Color oldColor = color;

                if (color != value)
                {
                    color = value;
                    OnPropertyChanged("Color");
                }

                if (color.R != oldColor.R)
                    OnPropertyChanged("Red");

                if (color.G != oldColor.G)
                    OnPropertyChanged("Green");

                if (color.B != oldColor.B)
{'fraction_non_alphanumeric': 0.08003487358326068, 'fraction_numerical': 0.0, 'mean_word_length': 0.8163394553514883, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5398989', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1394, 'n_words': 298}