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

namespace CSharpGL
{
    /// <summary>
    /// GL.Enable(cap); or GL.Disable(cap);
    /// </summary>
    public abstract class EnableSwitch : GLSwitch
    {

        byte originalEnabled;
        private uint cap;

        public uint Cap
        {
            get { return cap; }
        }

        public bool EnableCap { get; set; }

        /// <summary>
        /// GL.Enable(cap);
        /// </summary>
        /// <param name="cap"></param>
        public EnableSwitch(uint cap) : this(cap, true) { }

        /// <summary>
        /// GL.Enable(cap); or GL.Disable(cap);
        /// </summary>
        /// <param name="cap"></param>
        /// <param name="enableCap"></param>
        public EnableSwitch(uint cap, bool enableCap)
        {
            this.cap = cap;
            this.EnableCap = enableCap;
        }

        public override string ToString()
        {
            if (this.EnableCap)
            { return string.Format("GL.Enable({0});", cap); }
            else
            { return string.Format("GL.Disable({0});", cap); }
        }

        protected override void SwitchOn()
        {
            this.originalEnabled = GL.IsEnabled(cap);

            if (this.EnableCap)
            {
                if (this.originalEnabled == 0)
                { GL.Enable(cap); }
            }
            else
            {
                if (this.originalEnabled != 0)
                { GL.Disable(cap); }
            }
        }

        protected override void SwitchOff()
        {
            if (this.EnableCap)
            {
                if (this.originalEnabled == 0)
                { GL.Disable(cap); }
            }
            else
            {
                if (this.originalEnabled != 0)
                { GL.Enable(cap); }
            }
        }<commit_msg>EnableSwitch<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CSharpGL
{
    /// <summary>
    /// GL.Enable(cap); or GL.Disable(cap);
    /// </summary>
    public abstract class EnableSwitch : GLSwitch
    {

        private byte originalEnabled;
        private bool lastEnableCap;
        private uint cap;

        public uint Cap
        {
            get { return cap; }
        }

        public bool EnableCap { get; set; }

        /// <summary>
        /// GL.Enable(cap);
        /// </summary>
        /// <param name="cap"></param>
        public EnableSwitch(uint cap) : this(cap, true) { }

        /// <summary>
        /// GL.Enable(cap); or GL.Disable(cap);
        /// </summary>
        /// <param name="cap"></param>
        /// <param name="enableCap"></param>
        public EnableSwitch(uint cap, bool enableCap)
        {
            this.cap = cap;
            this.EnableCap = enableCap;
        }

        public override string ToString()
        {
            if (this.EnableCap)
            { return string.Format("GL.Enable({0});", cap); }
            else
            { return string.Format("GL.Disable({0});", cap); }
        }

        protected override void SwitchOn()
        {
            this.originalEnabled = GL.IsEnabled(cap);

            this.lastEnableCap = this.EnableCap;
            if (this.lastEnableCap)
            {
                if (this.originalEnabled == 0)
                { GL.Enable(cap); }
            }
            else
            {
                if (this.originalEnabled != 0)
                { GL.Disable(cap); }
            }
        }

        protected override void SwitchOff()
        {
            if (this.lastEnableCap)
            {
                if (this.originalEnabled == 0)
                { GL.Disable(cap); }
            }
            else
            {
                if (this.originalEnabled != 0)
                { GL.Enable(cap); }
            }
        }
{'fraction_non_alphanumeric': 0.12838182746299132, 'fraction_numerical': 0.0030627871362940277, 'mean_word_length': 1.2419908466819223, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '7480369', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1026, 'n_words': 224}