define("umlStateMachineApi", ["clientkernelLoggerApi"],
    function(clientkernelLoggerApi) {
        "use strict";

        function $iterator(o) {
            if (o instanceof Array) return function() {
                return {
                    cur: 0,
                    arr: o,
                    hasNext: function() {
                        return this.cur < this.arr.length;
                    },
                    next: function() {
                        return this.arr[this.cur++];
                    }
                };
            };
            return typeof(o.iterator) == 'function' ? $bind(o, o.iterator) : o.iterator;
        };;
        var $fid = 0;

        function $bind(o, m) {
            if (m == null) return null;
            if (m.__id__ == null) m.__id__ = $fid++;
            var f;
            if (o.hx__closures__ == null) o.hx__closures__ = {};
            else f = o.hx__closures__[m.__id__];
            if (f == null) {
                f = function() {
                    return f.method.apply(f.scope, arguments);
                };
                f.scope = o;
                f.method = m;
                o.hx__closures__[m.__id__] = f;
            }
            return f;
        };
        var $_;
        var $estr = function() {
            return _hcmn_.js_Boot.__string_rec(this, '');
        };
        if (typeof umlStateMachineApi == 'undefined') {
            var umlStateMachineApi = {};
        };

        umlStateMachineApi.IState = function() {}
        umlStateMachineApi.IState.prototype = {

            onEnter: function(handler) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            },
            onRun: function(handler) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            },
            onExit: function(handler) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            },
            final: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            },
            finalDeaf: function() {
                return {
                    arguments: [],
                    returns: "*"
                };
            }
        };

        umlStateMachineApi.IStateMachine = function() {}
        umlStateMachineApi.IStateMachine.prototype = {

            useLogger: function(logger) {
                return {
                    arguments: ["*"],
                    returns: "void"
                };
            },
            addState: function(state) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            },
            addTransition: function(sourceState, targetState, trigger) {
                return {
                    arguments: ["*", "*", "*"],
                    returns: "*"
                };
            },
            addStateInternalTransition: function(state, trigger) {
                return {
                    arguments: ["*", "*"],
                    returns: "*"
                };
            },
            trigger: function(trigger, payload) {
                return {
                    arguments: ["*", {
                        type: "*",
                        opt: true
                    }],
                    returns: "void"
                };
            }
        };

        umlStateMachineApi.IStateMachineProvider = function() {}
        umlStateMachineApi.IStateMachineProvider.prototype = {

            getStateMachine: function(initState, logger) {
                return {
                    arguments: ["*", "*"],
                    returns: "*"
                };
            }
        };

        umlStateMachineApi.ITransition = function() {}
        umlStateMachineApi.ITransition.prototype = {

            guardCondition: function(handler) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            },
            action: function(handler) {
                return {
                    arguments: ["*"],
                    returns: "*"
                };
            }
        };
        umlStateMachineApi.StateType = function(value) {
            this.value = "";
            this.value = value.toUpperCase();
        };
        umlStateMachineApi.StateType.__name__ = ["umlStateMachineApi", "StateType"];
        umlStateMachineApi.StateType.prototype.value = null;
        umlStateMachineApi.StateType.prototype.getValue = function() {
            return this.value;
        };
        umlStateMachineApi.StateType.prototype.toString = function() {
            return this.value;
        };
        umlStateMachineApi.StateType.prototype.equals = function(type) {
            if (type == null) return false;
            if (this.value == type.getValue()) return true;
            return false;
        };
        umlStateMachineApi.StateType.prototype.__class__ = umlStateMachineApi.StateType;
        umlStateMachineApi.StateMachineException = function(triger, state, type) {
            this.message = umlStateMachineApi.StateMachineException.generateErrorMessage(triger, state, type);
            this.type = type;
        };
        umlStateMachineApi.StateMachineException.__name__ = ["umlStateMachineApi", "StateMachineException"];
        umlStateMachineApi.StateMachineException.prototype.message = null;
        umlStateMachineApi.StateMachineException.prototype.type = null;
        umlStateMachineApi.StateMachineException.prototype.getType = function() {
            return this.type;
        };
        umlStateMachineApi.StateMachineException.prototype.getMessage = function() {
            return this.message;
        };
        umlStateMachineApi.StateMachineException.generateErrorMessage = function(triger, state, type) {
            switch (type[1]) {
                case 0:
                    return "Triger: " + _hcmn_.Std.string(triger) + " CAN'T  fire in FINAL state: " + _hcmn_.Std.string(state);
                case 1:
                    return "No valid transition for Triger: " + _hcmn_.Std.string(triger) + " in state: " + _hcmn_.Std.string(state);
                case 2:
                    return "Trying to use State that is not defined in state machine: " + _hcmn_.Std.string(state);
            }
        };
        umlStateMachineApi.StateMachineException.prototype.__class__ = umlStateMachineApi.StateMachineException;
        umlStateMachineApi.StateMachineExceptionType = {
            __ename__: ["umlStateMachineApi", "StateMachineExceptionType"],
            __constructs__: ["STATE_IS_FINAL", "NO_VALID_TRANSITION", "NON_EXISTING_STATE"]
        };
        umlStateMachineApi.StateMachineExceptionType.NO_VALID_TRANSITION = ["NO_VALID_TRANSITION", 1];
        umlStateMachineApi.StateMachineExceptionType.NO_VALID_TRANSITION.toString = $estr;
        umlStateMachineApi.StateMachineExceptionType.NO_VALID_TRANSITION.__enum__ = umlStateMachineApi.StateMachineExceptionType;
        umlStateMachineApi.StateMachineExceptionType.STATE_IS_FINAL = ["STATE_IS_FINAL", 0];
        umlStateMachineApi.StateMachineExceptionType.STATE_IS_FINAL.toString = $estr;
        umlStateMachineApi.StateMachineExceptionType.STATE_IS_FINAL.__enum__ = umlStateMachineApi.StateMachineExceptionType;
        umlStateMachineApi.StateMachineExceptionType.NON_EXISTING_STATE = ["NON_EXISTING_STATE", 2];
        umlStateMachineApi.StateMachineExceptionType.NON_EXISTING_STATE.toString = $estr;
        umlStateMachineApi.StateMachineExceptionType.NON_EXISTING_STATE.__enum__ = umlStateMachineApi.StateMachineExceptionType;
        umlStateMachineApi.StateType.INITIAL = new umlStateMachineApi.StateType("INITIAL");;
        umlStateMachineApi.StateType.NORMAL = new umlStateMachineApi.StateType("NORMAL");;
        umlStateMachineApi.StateType.FINAL = new umlStateMachineApi.StateType("FINAL");;
        umlStateMachineApi.StateType.FINAL_DEAF = new umlStateMachineApi.StateType("FINAL_DEAF");;
        return {
            exports: umlStateMachineApi
        };
    });
//# sourceURL=umlStateMachineApi.js