<commit_before>namespace fgui {

    export const enum TransitionActionType {
        XY = 0,
        Size = 1,
        Scale = 2,
        Pivot = 3,
        Alpha = 4,
        Rotation = 5,
        Color = 6,
        Animation = 7,
        Visible = 8,
        Sound = 9,
        Transition = 10,
        Shake = 11,
        ColorFilter = 12,
        Skew = 13,
        Unknown = 14
    }

    export interface TransitionPlaySetting {
        onComplete?: (...args: any[]) => void,
        onCompleteObj?: any,
        onCompleteParam?: any,
        times: number,
        delay: number
    };

    export class Transition {

        public name: string;
        public autoPlayRepeat: number = 1;
        public autoPlayDelay: number = 0;

        private $owner: GComponent;
        private $ownerBaseX: number = 0;
        private $ownerBaseY: number = 0;
        private $items: TransitionItem[];
        private $totalTimes: number = 0;
        private $totalTasks: number = 0;
        private $playing: boolean = false;
        private $onComplete: (...args: any[]) => void;
        private $onCompleteObj: any;
        private $onCompleteParam: any;
        private $options: number = 0;
        private $reversed: boolean;
        private $maxTime: number = 0;
        private $autoPlay: boolean;

        public static OPTION_IGNORE_DISPLAY_CONTROLLER: number = 1;
        public static OPTION_AUTO_STOP_DISABLED:number = 1 >> 1;
        public static OPTION_AUTO_STOP_AT_END:number = 1 >> 2;
        
        private static FRAME_RATE: number = 24;

        public constructor(owner: GComponent) {
            this.$owner = owner;
            this.$items = [];
            this.$owner.on(DisplayObjectEvent.VISIBLE_CHANGED, this.$ownerVisibleChanged, this);
        }

        private $ownerVisibleChanged(vis:boolean, owner:GComponent):void
        {
            if ((this.$options & Transition.OPTION_AUTO_STOP_DISABLED) == 0 && vis === false)
                this.stop((this.$options & Transition.OPTION_AUTO_STOP_AT_END) != 0 ? true : false, false);
        }

        public get autoPlay(): boolean {
            return this.$autoPlay;
        }

        public set autoPlay(value: boolean) {
            if (this.$autoPlay != value) {
                this.$autoPlay = value;
                if (this.$autoPlay) {
                    if (this.$owner.onStage)
                        this.play({
                            times: this.autoPlayRepeat,
                            delay: this.autoPlayDelay
                        });
                }
                else {
                    if (!this.$owner.onStage)
                        this.stop(false, true);
                }
            }
        }

        public changeRepeat(value: number): void {
            this.$totalTimes = value | 0;
        }

        /**
         * Play transition by specified settings:
         * 1) pass whole parameters:
                onComplete?: (...args:any[]) => void,
                onCompleteObj?: any,
                onCompleteParam?: any,
                times: number,
                delay: number
         * 2) just pass 1 object which implements TransitionPlaySetting (recommended)
         */
        public play(...args: any[]): void {
            if (args.length && typeof (args[0]) == "object") {
                let obj = args[0] as TransitionPlaySetting;
                this.$play(obj.onComplete, obj.onCompleteObj, obj.onCompleteParam, obj.times || 1, obj.delay || 0, false);
            }
            else
                this.$play(args[0], args[1], args[2], args[3] || 1, args[4] || 0, false);
        }

        /**
         * Play transition by specified settings:
         * 1) pass whole parameters:
                onComplete?: (...args:any[]) => void,
                onCompleteObj?: any,
                onCompleteParam?: any,
                times: number,
                delay: number
         * 2) just pass 1 object which implements TransitionPlaySetting (recommended)
         */
        public playReverse(...args: any[]) {
            if (args.length && typeof (args[0]) == "object") {
                let obj = args[0] as TransitionPlaySetting;
                this.$play(obj.onComplete, obj.onCompleteObj, obj.onCompleteParam, obj.times || 1, obj.delay || 0, true);
            }
            else
                this.$play(args[0], args[1], args[2], args[3] || 1, args[4] || 0, true);
        }

        private $play(onComplete?: (...args: any[]) => void, onCompleteObj?: any, onCompleteParam?: any, times?: number, delay?: number, reversed: boolean = false) {
            this.stop();
            if (times == 0) times = 1;
            else if (times == -1) times = Number.MAX_VALUE;
            this.$totalTimes = times;
            this.$reversed = reversed;
            this.internalPlay(delay);
            this.$playing = this.$totalTasks > 0;
            if (this.$playing) {
                this.$onComplete = onComplete;
                this.$onCompleteParam = onCompleteParam;
                this.$onCompleteObj = onCompleteObj;

                if ((this.$options & Transition.OPTION_IGNORE_DISPLAY_CONTROLLER) != 0) {
                    this.$items.forEach(item => {
                        if (item.target != null && item.target != this.$owner)
                            item.lockToken = item.target.lockGearDisplay();
                    }, this);<commit_msg>syntax fix<commit_after>namespace fgui {

    export const enum TransitionActionType {
        XY = 0,
        Size = 1,
        Scale = 2,
        Pivot = 3,
        Alpha = 4,
        Rotation = 5,
        Color = 6,
        Animation = 7,
        Visible = 8,
        Sound = 9,
        Transition = 10,
        Shake = 11,
        ColorFilter = 12,
        Skew = 13,
        Unknown = 14
    }

    export interface TransitionPlaySetting {
        onComplete?: (...args: any[]) => void,
        onCompleteObj?: any,
        onCompleteParam?: any,
        times: number,
        delay: number
    };

    export class Transition {

        public name: string;
        public autoPlayRepeat: number = 1;
        public autoPlayDelay: number = 0;

        private $owner: GComponent;
        private $ownerBaseX: number = 0;
        private $ownerBaseY: number = 0;
        private $items: TransitionItem[];
        private $totalTimes: number = 0;
        private $totalTasks: number = 0;
        private $playing: boolean = false;
        private $onComplete: (...args: any[]) => void;
        private $onCompleteObj: any;
        private $onCompleteParam: any;
        private $options: number = 0;
        private $reversed: boolean;
        private $maxTime: number = 0;
        private $autoPlay: boolean;

        public static OPTION_IGNORE_DISPLAY_CONTROLLER: number = 1;
        public static OPTION_AUTO_STOP_DISABLED:number = 1 >> 1;
        public static OPTION_AUTO_STOP_AT_END:number = 1 >> 2;
        
        private static FRAME_RATE: number = 24;

        public constructor(owner: GComponent) {
            this.$owner = owner;
            this.$items = [];
            this.$owner.on(DisplayObjectEvent.VISIBLE_CHANGED, this.$ownerVisibleChanged, this);
        }

        private $ownerVisibleChanged(vis:boolean, owner:GComponent):void
        {
            if ((this.$options & Transition.OPTION_AUTO_STOP_DISABLED) == 0 && vis === false)
                this.stop((this.$options & Transition.OPTION_AUTO_STOP_AT_END) != 0 ? true : false, false);
        }

        public get autoPlay(): boolean {
            return this.$autoPlay;
        }

        public set autoPlay(value: boolean) {
            if (this.$autoPlay != value) {
                this.$autoPlay = value;
                if (this.$autoPlay) {
                    if (this.$owner.onStage)
                        this.play({
                            times: this.autoPlayRepeat,
                            delay: this.autoPlayDelay
                        });
                }
                else {
                    if (!this.$owner.onStage)
                        this.stop(false, true);
                }
            }
        }

        public changeRepeat(value: number): void {
            this.$totalTimes = value | 0;
        }

        /**
         * Play transition by specified settings:
         * 1) pass whole parameters:
                onComplete?: (...args:any[]) => void,
                onCompleteObj?: any,
                onCompleteParam?: any,
                times: number,
                delay: number
         * 2) just pass 1 object which implements TransitionPlaySetting (recommended)
         */
        public play(...args: any[]): void {
            if (args.length && typeof (args[0]) == "object") {
                let obj = args[0] as TransitionPlaySetting;
                this.$play(obj.onComplete, obj.onCompleteObj, obj.onCompleteParam, obj.times || 1, obj.delay || 0, false);
            }
            else
                this.$play(args[0], args[1], args[2], args[3] || 1, args[4] || 0, false);
        }

        /**
         * Play transition by specified settings:
         * 1) pass whole parameters:
                onComplete?: (...args:any[]) => void,
                onCompleteObj?: any,
                onCompleteParam?: any,
                times: number,
                delay: number
         * 2) just pass 1 object which implements TransitionPlaySetting (recommended)
         */
        public playReverse(...args: any[]):void {
            if (args.length && typeof (args[0]) == "object") {
                let obj = args[0] as TransitionPlaySetting;
                this.$play(obj.onComplete, obj.onCompleteObj, obj.onCompleteParam, obj.times || 1, obj.delay || 0, true);
            }
            else
                this.$play(args[0], args[1], args[2], args[3] || 1, args[4] || 0, true);
        }

        private $play(onComplete?: (...args: any[]) => void, onCompleteObj?: any, onCompleteParam?: any, times?: number, delay?: number, reversed: boolean = false) {
            this.stop();
            if (times == 0) times = 1;
            else if (times == -1) times = Number.MAX_VALUE;
            this.$totalTimes = times;
            this.$reversed = reversed;
            this.internalPlay(delay);
            this.$playing = this.$totalTasks > 0;
            if (this.$playing) {
                this.$onComplete = onComplete;
                this.$onCompleteParam = onCompleteParam;
                this.$onCompleteObj = onCompleteObj;

                if ((this.$options & Transition.OPTION_IGNORE_DISPLAY_CONTROLLER) != 0) {
                    this.$items.forEach(item => {
                        if (item.target != null && item.target != this.$owner)
                            item.lockToken = item.target.lockGearDisplay();
                    }, this);
{'fraction_non_alphanumeric': 0.11512976256212037, 'fraction_numerical': 0.013068286397938524, 'mean_word_length': 1.5678166351606806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 25, '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': '1257047', 'n_tokens_mistral': 3077, 'n_tokens_neox': 2821, 'n_words': 744}