// JavaScript Document
/*

    VANIXON 4 IN A ROW JS
    
    --> FOUR IN A ROW - GAME THREAD <--
    

    Created by Vanixon GmbH, Pascal Stoop <http://www.vanixon.com>

*/


    /***********************************************
    
        DATA CLASSES
    
    ************************************************/
    
    function TictactoeQuestionThread() {
        //methids
        this.setTimerMS = function(value) {
            this.timerMS = value;
        };

        this.getTimerMS = function() {
            var result = 1000;
            result = this.timerMS;
            return result;
        };

        this.run = function() {
            if(!this.getShutdownState()) {
                if (!this.getPauseState()) {
                    if (refTictactoeGame !== null) {
                        //refFiarGame.moveAnimationAndRefresh();
                        refTictactoeGame.countDownQuestion();
                        
                        this.refTimeoutThread = window.setTimeout("refTictactoeQuestionThread.run()", this.getTimerMS());
                    }
                }
            }
        };

        this.getShutdownState = function() {
            var result = false;
            result = this.shutdown;
            return result;
        };

        this.setShutdownState = function(value) {
            this.shutdown = value;
            if (this.shutdown == true) {
                this.clearThreadTimeout();
            }
        };

        this.getPauseState = function() {
            var result = false;
            result = this.pause;
            return result;
        };

        this.setPauseState = function(value) {
            this.pause = value;
            if (this.pause == true) {
                this.clearThreadTimeout();
            }
        };
        
        this.clearThreadTimeout = function() {
            if (this.refTimeoutThread !== null) {
                window.clearTimeout(this.refTimeoutThread);
            }
        };

        //constructor
        this.shutdown = false;
        this.pause = false;
        this.timerMS = 0;
        this.refTimeoutThread = null;
    }

