text:
/**
 * Audio Sprites are a combination of audio files and a JSON configuration.
 * The JSON follows the format of that created by https://github.com/tonistiigi/audiosprite
 *
 * @class Phaser.AudioSprite
 * @constructor
 * @param {Phaser.Game} game - Reference to the current game instance.
 * @param {string} key - Asset key for the sound.
 */
Phaser.AudioSprite = function (game, key) {

    /**
    * A reference to the currently running Game.
    * @property {Phaser.Game} game
    */
    this.game = game;

    /**
     * Asset key for the Audio Sprite.
     * @property {string} key
     */
    this.key = key;

    /**
     * JSON audio atlas object.
     * @property {object} config
     */
    this.config = this.game.cache.getJSON(key + '-audioatlas');

    /**
     * If a sound is set to auto play, this holds the marker key of it.
     * @property {string} autoplayKey
     */
    this.autoplayKey = null;

    /**
     * Is a sound set to autoplay or not?
     * @property {boolean} autoplay
     * @default
     */
    this.autoplay = false;

    /**
     * An object containing the Phaser.Sound objects for the Audio Sprite.
     * @property {object} sounds
     */
    this.sounds = {};

    for (var k in this.config.spritemap)
    {
        var marker = this.config.spritemap[k];
        var sound = this.game.add.sound(this.key);

        sound.addMarker(k, marker.start, (marker.end - marker.start), null, marker.loop);

        this.sounds[k] = sound;
    }

    if (this.config.autoplay)
    {
        this.autoplayKey = this.config.autoplay;
        this.play(this.autoplayKey);
        this.autoplay = this.sounds[this.autoplayKey];
    }

};

Phaser.AudioSprite.prototype = {

    /**
     * Play a sound with the given name.
     *
     * @method Phaser.AudioSprite#play
     * @param {string} [marker] - The name of sound to play
     * @param {number} [volume=1] - Volume of the sound you want to play. If none is given it will use the volume given to the Sound when it was created (which defaults to 1 if none was specified).
     * @return {Phaser.Sound} This sound instance.
     */
    play: function (marker, volume) {

        if (volume === undefined) { volume = 1; }

        return this.sounds[marker].play(marker, null, volume);

    },

    /**
     * Stop a sound with the given name.
     *
     * @method Phaser.AudioSprite#stop
     * @param {string} [marker=''] - The name of sound to stop. If none is given it will stop all sounds in the audio sprite.
     */
    stop: function (marker) {

        if (!marker)
        {
            for (var key in this.sounds)
            {
                this.sounds[key].stop();
            }
        }
        else
        {
            this.sounds[marker].stop();
        }

    },

    /**
     * Get a sound with the given name.
     *
     * @method Phaser.AudioSprite#get
     * @param {string} marker - The name of sound to get.
     * @return {Phaser.Sound} The sound instance.
     */
    get: function(marker) {

        return this.sounds[marker];

    }

};

Phaser.AudioSprite.prototype.constructor = Phaser.AudioSprite;

/**
* @author       Richard Davey <rich@photonstorm.com>
* @copyright    2015 Photon Storm Ltd.
* @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/

/**
* The Sound class constructor.
*
* @class Phaser.Sound
* @constructor
* @param {Phaser.Game} game - Reference to the current game instance.
* @param {string} key - Asset key for the sound.
* @param {number} [volume=1] - Default value for the volume, between 0 and 1.
* @param {boolean} [loop=false] - Whether or not the sound will loop.
*/
Phaser.Sound = function (game, key, volume, loop, connect) {

    if (volume === undefined) { volume = 1; }
    if (loop === undefined) { loop = false; }
    if (connect === undefined) { connect = game.sound.connectToMaster; }

    /**
    * A reference to the currently running Game.
    * @property {Phaser.Game} game
    */
    this.game = game;

    /**
    * @property {string} name - Name of the sound.
    */
    this.name = key;

    /**
    * @property {string} key - Asset key for the sound.
    */
    this.key = key;

    /**
    * @property {boolean} loop - Whether or not the sound or current sound marker will loop.
    */
    this.loop = loop;

    /**
    * @property {number} volume - The sound or sound marker volume. A value between 0 (silence) and 1 (full volume).
    */
    this.volume = volume;

    /**
    * @property {object} markers - The sound markers.
    */
    this.markers = {};

    /**
    * @property {AudioContext} context - Reference to the AudioContext instance.
    */
    this.context = null;

    /**
    * @property {boolean} autoplay - Boolean indicating whether the sound should start automatically.
    */
    this.autoplay = false;

    /**
    * @property {number} totalDuration - The total duration of the sound in seconds.
    */
    this.totalDuration = 0;

    /**
    * @property {number} startTime - The time the Sound starts at (typically 0 unless starting from a marker)
    * @default
    */
    this.startTime = 0;

    /**
    * @property {number} currentTime - The current time the sound is at.
    */
    this.currentTime = 0;

    /**
    * @property {number} duration - The duration of the current sound marker in seconds.
    */
    this.duration = 0;

    /**
    * @property {number} durationMS - The duration of the current sound marker in ms.
    */
    this.durationMS = 0;

    /**
    * @property {number} position - The position of the current sound marker.
    */
    this.position = 0;

    /**
    * @property {number} stopTime - The time the sound stopped.
    */
    this.stopTime = 0;

    /**
    * @property {boolean} paused - true if the sound is paused, otherwise false.
    * @default
    */
    this.paused = false;

    /**
    * @property {number} pausedPosition - The position the sound had reached when it was paused.
    */
    this.pausedPosition = 0;

    /**
    * @property {number} pausedTime - The game time at which the sound was paused.
    */
    this.pausedTime = 0;

    /**
    * @property {boolean} isPlaying - true if the sound is currently playing, otherwise false.
    * @default
    */
    this.isPlaying = false;

    /**
    * @property {string} currentMarker - The string ID of the currently playing marker, if any.
    * @default
    */
    this.currentMarker = '';

    /**
    * @property {Phaser.Tween} fadeTween - The tween that fades the audio, set via Sound.fadeIn and Sound.fadeOut.
    */
    this.fadeTween = null;

    /**
    * @property {boolean} pendingPlayback - true if the sound file is pending playback
    * @readonly
    */
    this.pendingPlayback = false;

    /**
    * @property {boolean} override - if true when you play this sound it will always start from the beginning.
    * @default
    */
    this.override = false;

    /**
    * @property {boolean} allowMultiple - This will allow you to have multiple instances of this Sound playing at once. This is only useful when running under Web Audio, and we recommend you implement a local pooling system to not flood the sound channels.
    * @default
    */
    this.allowMultiple = false;

    /**
    * @property {boolean} usingWebAudio - true if this sound is being played with Web Audio.
    * @readonly
    */
    this.usingWebAudio = this.game.sound.usingWebAudio;

    /**
    * @property {boolean} usingAudioTag - true if the sound is being played via the Audio tag.
    */
    this.usingAudioTag = this.game.sound.usingAudioTag;

    /**
    * @property {object} externalNode - If defined this Sound won't connect to the SoundManager master gain node, but will instead connect to externalNode.
    */
    this.externalNode = null;

    /**
    * @property {object} masterGainNode - The master gain node in a Web Audio system.
    */
    this.masterGainNode = null;

    /**
    * @property {object} gainNode - The gain node in a Web Audio system.
    */
    this.gainNode = null;

    /**
    * @property {object} _sound - Internal var.
    * @private
    */
    this._sound = null;

    if (this.usingWebAudio)
    {
        this.context = this.game.sound.context;
        this.masterGainNode = this.game.sound.masterGain;

        if (this.context.createGain === undefined)
        {
            this.gainNode = this.context.createGainNode();
        }
        else
        {
            this.gainNode = this.context.createGain();
        }

        this.gainNode.gain.value = volume * this.game.sound.volume;

        if (connect)
        {
            this.gainNode.connect(this.masterGainNode);
        }
    }
    else if (this.usingAudioTag)
    {
        if (this.game.cache.getSound(key) && this.game.cache.isSoundReady(key))
        {
            this._sound = this.game.cache.getSoundData(key);
            this.totalDuration = 0;

            if (this._sound.duration)
            {
                this.totalDuration = this._sound.duration;
            }
        }
        else
        {
            this.game.cache.onSoundUnlock.add(this.soundHasUnlocked, this);
        }
    }

    /**
    * @property {Phaser.Signal} onDecoded - The onDecoded event is dispatched when the sound has finished decoding (typically for mp3 files)
    */
    this.onDecoded = new Phaser.Signal();

    /**
    * @property {Phaser.Signal} onPlay - The onPlay event is dispatched each time this sound is played.
    */
    this.onPlay = new Phaser.Signal();

    /**
    * @property {Phaser.Signal} onPause - The onPause event is dispatched when this sound is paused.
    */
    this.onPause = new Phaser.Signal();

    /**
    * @property {Phaser.Signal} onResume - The onResume event is dispatched when this sound is resumed from a paused state.
    */
    this.onResume = new Phaser.Signal();

    /**
    * @property {Phaser.Signal} onLoop - The onLoop event is dispatched when this sound loops during playback.
    */
    this.onLoop = new Phaser.Signal();

    /**
    * @property {Phaser.Signal} onStop - The onStop event is dispatched when this sound stops playback.
    */
    this.onStop = new Phaser.Signal();

    /**
    * @property {Phaser.Signal} onMute - The onMouse event is dispatched when this sound is muted.
    */
    this.onMute = new Phaser.Signal();

    /**
    * @property {Phaser.Signal} onMarkerComplete - The onMarkerComplete event is dispatched when a marker within this sound completes playback.
    */
    this.onMarkerComplete = new Phaser.Signal();

    /**
    * @property {Phaser.Signal} onFadeComplete - The onFadeComplete event is dispatched when this sound finishes fading either in or out.
    */
    this.onFadeComplete = new Phaser.Signal();

    /**
    * @property {number} _volume - The global audio volume. A value between 0 (silence) and 1 (full volume).
    * @private
    */
    this._volume = volume;

    /**
    * @property {any} _buffer - Decoded data buffer / Audio tag.
    * @private
    */
    this._buffer = null;

    /**
    * @property {boolean} _muted - Boolean indicating whether the sound is muted or not.
    * @private
    */
    this._muted = false;

    /**
    * @property {number} _tempMarker - Internal marker var.
    * @private
    */
    this._tempMarker = 0;

    /**
    * @property {number} _tempPosition - Internal marker var.
    * @private
    */
    this._tempPosition = 0;

    /**
    * @property {number} _tempVolume - Internal marker var.
    * @private
    */
    this._tempVolume = 0;

    /**
    * @property {number} _muteVolume - Internal cache var.
    * @private
    */
    this._muteVolume = 0;

    /**
    * @property {boolean} _tempLoop - Internal cache var.
    * @private
    */
    this._tempLoop = 0;

    /**
    * @property {boolean} _paused - Was this sound paused via code or a game event?
    * @private
    */
    this._paused = false;

    /**
    * @property {boolean} _onDecodedEventDispatched - Was the onDecoded event dispatched?
    * @private
    */
    this._onDecodedEventDispatched = false;

};

Phaser.Sound.prototype = {

    /**
    * Called automatically when this sound is unlocked.
    * @method Phaser.Sound#soundHasUnlocked
    * @param {string} key - The Phaser.Cache key of the sound file to check for decoding.
    * @protected
    */
    soundHasUnlocked: function (key) {

        if (key === this.key)
        {
            this._sound = this.game.cache.getSoundData(this.key);
            this.totalDuration = this._sound.duration;
        }

    },

    /**
    * Adds a marker into the current Sound. A marker is represented by a unique key and a start time and duration.
    * This allows you to bundle multiple sounds together into a single audio file and use markers to jump between them for playback.
    *
    * @method Phaser.Sound#addMarker
    * @param {string} name - A unique name for this marker, i.e. 'explosion', 'gunshot', etc.
    * @param {number} start - The start point of this marker in the audio file, given in seconds. 2.5 = 2500ms, 0.5 = 500ms, etc.
    * @param {number} duration - The duration of the marker in seconds. 2.5 = 2500ms, 0.5 = 500ms, etc.
    * @param {number} [volume=1] - The volume the sound will play back at, between 0 (silent) and 1 (full volume).
    * @param {boolean} [loop=false] - Sets if the sound will loop or not.
    */
    addMarker: function (name, start, duration, volume, loop) {

        if (volume === undefined || volume === null) { volume = 1; }
        if (loop === undefined) { loop = false; }

        this.markers[name] = {
            name: name,
            start: start,
            stop: start + duration,
            volume: volume,
            duration: duration,
            durationMS: duration * 1000,
            loop: loop
        };

    },

    /**
    * Removes a marker from the sound.
    * @method Phaser.Sound#removeMarker
    * @param {string} name - The key of the marker to remove.
    */
    removeMarker: function (name) {

        delete this.markers[name];

    },

    /**
    * Called automatically by the AudioContext when the sound stops playing.
    * Doesn't get called if the sound is set to loop or is a section of an Audio Sprite.
    *
    * @method Phaser.Sound#onEndedHandler
    * @protected
    */
    onEndedHandler: function () {

        this.isPlaying = false;
        this.stop();

    },

    /**
    * Called automatically by Phaser.SoundManager.
    * @method Phaser.Sound#update
    * @protected
    */
    update: function () {

        if (!this.game.cache.checkSoundKey(this.key))
        {
            this.destroy();
            return;
        }

        if (this.isDecoded && !this._onDecodedEventDispatched)
        {
            this.onDecoded.dispatch(this);
            this._onDecodedEventDispatched = true;
        }

        if (this.pendingPlayback && this.game.cache.isSoundReady(this.key))
        {
            this.pendingPlayback = false;
            this.play(this._tempMarker, this._tempPosition, this._tempVolume, this._tempLoop);
        }

        if (this.isPlaying)
        {
            this.currentTime = this.game.time.time - this.startTime;

            if (this.currentTime >= this.durationMS)
            {
                if (this.usingWebAudio)
                {
                    if (this.loop)
                    {
                        //  won't work with markers, needs to reset the position
                        this.onLoop.dispatch(this);

                        if (this.currentMarker === '')
                        {
                            this.currentTime = 0;
                            this.startTime = this.game.time.time;
                        }
                        else
                        {
                            this.onMarkerComplete.dispatch(this.currentMarker, this);
                            this.play(this.currentMarker, 0, this.volume, true, true);
                        }
                    }
                    else
                    {
                        //  Stop if we're using an audio marker, otherwise we let onended handle it
                        if (this.currentMarker !== '')
                        {
                            this.stop();
                        }
                    }
                }
                else
                {
                    if (this.loop)
                    {
                        this.onLoop.dispatch(this);
                        this.play(this.currentMarker, 0, this.volume, true, true);
                    }
                    else
                    {
                        this.stop();
                    }
                }
            }
        }
    },

    /**
     * Loops this entire sound. If you need to loop a section of it then use Sound.play and the marker and loop parameters.
     *
     * @method Phaser.Sound#loopFull
     * @param {number} [volume=1] - Volume of the sound you want to play. If none is given it will use the volume given to the Sound when it was created (which defaults to 1 if none was specified).
     * @return {Phaser.Sound} This sound instance.
     */
    loopFull: function (volume) {

        this.play(null, 0, volume, true);

    },

    /**
    * Play this sound, or a marked section of it.
    *
    * @method Phaser.Sound#play
    * @param {string} [marker=''] - If you want to play a marker then give the key here, otherwise leave blank to play the full sound.
    * @param {number} [position=0] - The starting position to play the sound from - this is ignored if you provide a marker.
    * @param {number} [volume=1] - Volume of the sound you want to play. If none is given it will use the volume given to the Sound when it was created (which defaults to 1 if none was specified).
    * @param {boolean} [loop=false] - Loop when finished playing? If not using a marker / audio sprite the looping will be done via the WebAudio loop property, otherwise it's time based.
    * @param {boolean} [forceRestart=true] - If the sound is already playing you can set forceRestart to restart it from the beginning.
    * @return {Phaser.Sound} This sound instance.
    */
    play: function (marker, position, volume, loop, forceRestart) {

        if (marker === undefined || marker === false || marker === null) { marker = ''; }
        if (forceRestart === undefined) { forceRestart = true; }

        if (this.isPlaying && !this.allowMultiple && !forceRestart && !this.override)
        {
            //  Use Restart instead
            return this;
        }

        if (this._sound && this.isPlaying && !this.allowMultiple && (this.override || forceRestart))
        {
            if (this.usingWebAudio)
            {
                if (this.externalNode)
                {
                    this._sound.disconnect(this.externalNode);
                }
                else
                {
                    this._sound.disconnect(this.gainNode);
                }

                if (this._sound.stop === undefined)
                {
                    this._sound.noteOff(0);
                }
                else
                {
                    try {
                        this._sound.stop(0);
                    }
                    catch (e) {
                    }
                }
            }
            else if (this.usingAudioTag)
            {
                this._sound.pause();
                this._sound.currentTime = 0;
            }
        }

        if (marker === '' && Object.keys(this.markers).length > 0)
        {
            //  If they didn't specify a marker but this is an audio sprite,
            //  we should never play the entire thing
            return this;
        }

        if (marker !== '')
        {
            this.currentMarker = marker;

            if (this.markers[marker])
            {
                //  Playing a marker? Then we default to the marker values
                this.position = this.markers[marker].start;
                this.volume = this.markers[marker].volume;
                this.loop = this.markers[marker].loop;
                this.duration = this.markers[marker].duration;
                this.durationMS = this.markers[marker].durationMS;

                if (typeof volume !== 'undefined')
                {
                    this.volume = volume;
                }

                if (typeof loop !== 'undefined')
                {
                    this.loop = loop;
                }

                this._tempMarker = marker;
                this._tempPosition = this.position;
                this._tempVolume = this.volume;
                this._tempLoop = this.loop;
            }
            else
            {
                // console.warn("Phaser.Sound.play: audio marker " + marker + " doesn't exist");
                return this;
            }
        }
        else
        {
            position = position || 0;

            if (volume === undefined) { volume = this._volume; }
            if (loop === undefined) { loop = this.loop; }

            this.position = position;
            this.volume = volume;
            this.loop = loop;
            this.duration = 0;
            this.durationMS = 0;

            this._tempMarker = marker;
            this._tempPosition = position;
            this._tempVolume = volume;
            this._tempLoop = loop;
        }

        if (this.usingWebAudio)
        {
            //  Does the sound need decoding?
            if (this.game.cache.isSoundDecoded(this.key))
            {
                this._sound = this.context.createBufferSource();

                if (this.externalNode)
                {
                    this._sound.connect(this.externalNode);
                }
                else
                {
                    this._sound.connect(this.gainNode);
                }

                this._buffer = this.game.cache.getSoundData(this.key);
                this._sound.buffer = this._buffer;

                if (this.loop && marker === '')
                {
                    this._sound.loop = true;
                }

                if (!this.loop && marker === '')
                {
                    this._sound.onended = this.onEndedHandler.bind(this);
                }

                this.totalDuration = this._sound.buffer.duration;

                if (this.duration === 0)
                {
                    this.duration = this.totalDuration;
                    this.durationMS = Math.ceil(this.totalDuration * 1000);
                }

                //  Useful to cache this somewhere perhaps?
                if (this._sound.start === undefined)
                {
                    this._sound.noteGrainOn(0, this.position, this.duration);
                }
                else
                {
                    if (this.loop && marker === '')
                    {
                        this._sound.start(0, 0);
                    }
                    else
                    {
                        this._sound.start(0, this.position, this.duration);
                    }
                }

                this.isPlaying = true;
                this.startTime = this.game.time.time;
                this.currentTime = 0;
                this.stopTime = this.startTime + this.durationMS;
                this.onPlay.dispatch(this);
            }
            else
            {
                this.pendingPlayback = true;

                if (this.game.cache.getSound(this.key) && this.game.cache.getSound(this.key).isDecoding === false)
                {
                    this.game.sound.decode(this.key, this);
                }
            }
        }
        else
        {
            if (this.game.cache.getSound(this.key) && this.game.cache.getSound(this.key).locked)
            {
                this.game.cache.reloadSound(this.key);
                this.pendingPlayback = true;
            }
            else
            {
                if (this._sound && (this.game.device.cocoonJS || this._sound.readyState === 4))
                {
                    this._sound.play();
                    //  This doesn't become available until you call play(), wonderful ...
                    this.totalDuration = this._sound.duration;

                    if (this.duration === 0)
                    {
                        this.duration = this.totalDuration;
                        this.durationMS = this.totalDuration * 1000;
                    }

                    this._sound.currentTime = this.position;
                    this._sound.muted = this._muted;

                    if (this._muted)
                    {
                        this._sound.volume = 0;
                    }
                    else
                    {
                        this._sound.volume = this._volume;
                    }

                    this.isPlaying = true;
                    this.startTime = this.game.time.time;
                    this.currentTime = 0;
                    this.stopTime = this.startTime + this.durationMS;
                    this.onPlay.dispatch(this);
                }
                else
                {
                    this.pendingPlayback = true;
                }
            }
        }

        return this;

    },

    /**
    * Restart the sound, or a marked section of it.
    *
    * @method Phaser.Sound#restart
    * @param {string} [marker=''] - If you want to play a marker then give the key here, otherwise leave blank to play the full sound.
    * @param {number} [position=0] - The starting position to play the sound from - this is ignored if you provide a marker.
    * @param {number} [volume=1] - Volume of the sound you want to play.
    * @param {boolean} [loop=false] - Loop when it finished playing?
    */
    restart: function (marker, position, volume, loop) {

        marker = marker || '';
        position = position || 0;
        volume = volume || 1;
        if (loop === undefined) { loop = false; }

        this.play(marker, position, volume, loop, true);

    },

    /**
    * Pauses the sound.
    *
    * @method Phaser.Sound#pause
    */
    pause: function () {

        if (this.isPlaying && this._sound)
        {
            this.paused = true;
            this.pausedPosition = this.currentTime;
            this.pausedTime = this.game.time.time;
            this.onPause.dispatch(this);
            this.stop();
        }

    },

    /**
    * Resumes the sound.
    *
    * @method Phaser.Sound#resume
    */
    resume: function () {

        if (this.paused && this._sound)
        {
            if (this.usingWebAudio)
            {
                var p = this.position + (this.pausedPosition / 1000);

                this._sound = this.context.createBufferSource();
                this._sound.buffer = this._buffer;

                if (this.externalNode)
                {
                    this._sound.connect(this.externalNode);
                }
                else
                {
                    this._sound.connect(this.gainNode);
                }

                if (this.loop)
                {
                    this._sound.loop = true;
                }

                if (!this.loop && this.currentMarker === '')
                {
                    this._sound.onended = this.onEndedHandler.bind(this);
                }

                var duration = this.duration - (this.pausedPosition / 1000);

                if (this._sound.start === undefined)
                {
                    this._sound.noteGrainOn(0, p, duration);
                    //this._sound.noteOn(0); // the zero is vitally important, crashes iOS6 without it
                }
                else
                {
                    if (this.loop && this.game.device.chrome)
                    {
                        //  Handle chrome bug: https://code.google.com/p/chromium/issues/detail?id=457099
                        if (this.game.device.chromeVersion === 42)
                        {
                            this._sound.start(0);
                        }
                        else
                        {
                            this._sound.start(0, p);
                        }
                    }
                    else
                    {
                        this._sound.start(0, p, duration);
                    }
                }
            }
            else
            {
                this._sound.play();
            }

            this.isPlaying = true;
            this.paused = false;
            this.startTime += (this.game.time.time - this.pausedTime);
            this.onResume.dispatch(this);
        }

    },

    /**
    * Stop playing this sound.
    *
    * @method Phaser.Sound#stop
    */
    stop: function () {

        if (this.isPlaying && this._sound)
        {
            if (this.usingWebAudio)
            {
                if (this.externalNode)
                {
                    this._sound.disconnect(this.externalNode);
                }
                else
                {
                    this._sound.disconnect(this.gainNode);
                }

                if (this._sound.stop === undefined)
                {
                    this._sound.noteOff(0);
                }
                else
                {
                    try {
                        this._sound.stop(0);
                    }
                    catch (e)
                    {
                        //  Thanks Android 4.4
                    }
                }
            }
            else if (this.usingAudioTag)
            {
                this._sound.pause();
                this._sound.currentTime = 0;
            }
        }

        this.pendingPlayback = false;
        this.isPlaying = false;
        var prevMarker = this.currentMarker;

        if (this.currentMarker !== '')
        {
            this.onMarkerComplete.dispatch(this.currentMarker, this);
        }

        this.currentMarker = '';

        if (this.fadeTween !== null)
        {
            this.fadeTween.stop();
        }

        if (!this.paused)
        {
            this.onStop.dispatch(this, prevMarker);
        }

    },

    /**
     * Starts this sound playing (or restarts it if already doing so) and sets the volume to zero.
     * Then increases the volume from 0 to 1 over the duration specified.
     *
     * At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
     * and the final volume (1) as the second parameter.
     *
     * @method Phaser.Sound#fadeIn
     * @param {number} [duration=1000] - The time in milliseconds over which the Sound should fade in.
     * @param {boolean} [loop=false] - Should the Sound be set to loop? Note that this doesn't cause the fade to repeat.
     * @param {string} [marker=(current marker)] - The marker to start at; defaults to the current (last played) marker. To start playing from the beginning specify specify a marker of `''`.
     */
    fadeIn: function (duration, loop, marker) {

        if (loop === undefined) { loop = false; }
        if (marker === undefined) { marker = this.currentMarker; }

        if (this.paused)
        {
            return;
        }

        this.play(marker, 0, 0, loop);

        this.fadeTo(duration, 1);

    },

    /**
     * Decreases the volume of this Sound from its current value to 0 over the duration specified.
     * At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
     * and the final volume (0) as the second parameter.
     *
     * @method Phaser.Sound#fadeOut
     * @param {number} [duration=1000] - The time in milliseconds over which the Sound should fade out.
     */
    fadeOut: function (duration) {

        this.fadeTo(duration, 0);

    },

    /**
     * Fades the volume of this Sound from its current value to the given volume over the duration specified.
     * At the end of the fade Sound.onFadeComplete is dispatched with this Sound object as the first parameter,
     * and the final volume (volume) as the second parameter.
     *
     * @method Phaser.Sound#fadeTo
     * @param {number} [duration=1000] - The time in milliseconds during which the Sound should fade out.
     * @param {number} [volume] - The volume which the Sound should fade to. This is a value between 0 and 1.
     */
    fadeTo: function (duration, volume) {

        if (!this.isPlaying || this.paused || volume === this.volume)
        {
            return;
        }

        if (duration === undefined) { duration = 1000; }

        if (volume === undefined)
        {
            console.warn("Phaser.Sound.fadeTo: No Volume Specified.");
            return;
        }

        this.fadeTween = this.game.add.tween(this).to( { volume: volume }, duration, Phaser.Easing.Linear.None, true);

        this.fadeTween.onComplete.add(this.fadeComplete, this);

    },

    /**
     * Internal handler for Sound.fadeIn, Sound.fadeOut and Sound.fadeTo.
     *
     * @method Phaser.Sound#fadeComplete
     * @private
     */
    fadeComplete: function () {

        this.onFadeComplete.dispatch(this, this.volume);

        if (this.volume === 0)
        {
            this.stop();
        }

    },

    /**
    * Destroys this sound and all associated events and removes it from the SoundManager.
    *
    * @method Phaser.Sound#destroy
    * @param {boolean} [remove=true] - If true this Sound is automatically removed from the SoundManager.
    */
    destroy: function (remove) {

        if (remove === undefined) { remove = true; }

        this.stop();

        if (remove)
        {
            this.game.sound.remove(this);
        }
        else
        {
            this.markers = {};
            this.context = null;
            this._buffer = null;
            this.externalNode = null;

            this.onDecoded.dispose();
            this.onPlay.dispose();
            this.onPause.dispose();
            this.onResume.dispose();
            this.onLoop.dispose();
            this.onStop.dispose();
            this.onMute.dispose();
            this.onMarkerComplete.dispose();
        }

    }

};

Phaser.Sound.prototype.constructor = Phaser.Sound;

/**
* @name Phaser.Sound#isDecoding
* @property {boolean} isDecoding - Returns true if the sound file is still decoding.
* @readonly
*/
Object.defineProperty(Phaser.Sound.prototype, "isDecoding", {

    get: function () {
        return this.game.cache.getSound(this.key).isDecoding;
    }

});

/**
* @name Phaser.Sound#isDecoded
* @property {boolean} isDecoded - Returns true if the sound file has decoded.
* @readonly
*/
Object.defineProperty(Phaser.Sound.prototype, "isDecoded", {

    get: function () {
        return this.game.cache.isSoundDecoded(this.key);
    }

});

/**
* @name Phaser.Sound#mute
* @property {boolean} mute - Gets or sets the muted state of this sound.
*/
Object.defineProperty(Phaser.Sound.prototype, "mute", {

    get: function () {

        return (this._muted || this.game.sound.mute);

    },

    set: function (value) {

        value = value || false;

        if (value === this._muted)
        {
            return;
        }

        if (value)
        {
            this._muted = true;
            this._muteVolume = this._tempVolume;

            if (this.usingWebAudio)
            {
                this.gainNode.gain.value = 0;
            }
            else if (this.usingAudioTag && this._sound)
            {
                this._sound.volume = 0;
            }
        }
        else
        {
            this._muted = false;

            if (this.usingWebAudio)
            {
                this.gainNode.gain.value = this._muteVolume;
            }
            else if (this.usingAudioTag && this._sound)
            {
                this._sound.volume = this._muteVolume;
            }
        }

        this.onMute.dispatch(this);

    }

});

/**
* @name Phaser.Sound#volume
* @property {number} volume - Gets or sets the volume of this sound, a value between 0 and 1.
* @readonly
*/
Object.defineProperty(Phaser.Sound.prototype, "volume", {

    get: function () {
        return this._volume;
    },

    set: function (value) {

        //  Causes an Index size error in Firefox if you don't clamp the value
        if (this.game.device.firefox && this.usingAudioTag)
        {
            value = this.game.math.clamp(value, 0, 1);
        }

        if (this._muted)
        {
            this._muteVolume = value;
            return;
        }

        this._tempVolume = value;
        this._volume = value;

        if (this.usingWebAudio)
        {
            this.gainNode.gain.value = value;
        }
        else if (this.usingAudioTag && this._sound)
        {
            this._sound.volume = value;
        }
    }

});

/**
* @author       Richard Davey <rich@photonstorm.com>
* @copyright    2015 Photon Storm Ltd.
* @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/

/**
* The Sound Manager is responsible for playing back audio via either the Legacy HTML Audio tag or via Web Audio if the browser supports it.
* Note: On Firefox 25+ on Linux if you have media.gstreamer disabled in about:config then it cannot play back mp3 or m4a files.
* The audio file type and the encoding of those files are extremely important. Not all browsers can play all audio formats.
* There is a good guide to what's supported here: http://hpr.dogphilosophy.net/test/
*
* If you are reloading a Phaser Game on a page that never properly refreshes (such as in an AngularJS project) then you will quickly run out
* of AudioContext nodes. If this is the case create a global var called PhaserGlobal on the window object before creating the game. The active
* AudioContext will then be saved to window.PhaserGlobal.audioContext when the Phaser game is destroyed, and re-used when it starts again.
*
* Mobile warning: There are some mobile devices (certain iPad 2 and iPad Mini revisions) that cannot play 48000 Hz audio.
* When they try to play the audio becomes extremely distorted and buzzes, eventually crashing the sound system.
* The solution is to use a lower encoding rate such as 44100 Hz.
*
* @class Phaser.SoundManager
* @constructor
* @param {Phaser.Game} game - Reference to the current game instance.
*/
Phaser.SoundManager = function (game) {

    /**
    * @property {Phaser.Game} game - Local reference to game.
    */
    this.game = game;

    /**
    * @property {Phaser.Signal} onSoundDecode - The event dispatched when a sound decodes (typically only for mp3 files)
    */
    this.onSoundDecode = new Phaser.Signal();

    /**
    * This signal is dispatched whenever the global volume changes. The new volume is passed as the only parameter to your callback.
    * @property {Phaser.Signal} onVolumeChange
    */
    this.onVolumeChange = new Phaser.Signal();

    /**
    * This signal is dispatched when the SoundManager is globally muted, either directly via game code or as a result of the game pausing.
    * @property {Phaser.Signal} onMute
    */
    this.onMute = new Phaser.Signal();

    /**
    * This signal is dispatched when the SoundManager is globally un-muted, either directly via game code or as a result of the game resuming from a pause.
    * @property {Phaser.Signal} onUnMute
    */
    this.onUnMute = new Phaser.Signal();

    /**
    * @property {AudioContext} context - The AudioContext being used for playback.
    * @default
    */
    this.context = null;

    /**
    * @property {boolean} usingWebAudio - True the SoundManager and device are both using Web Audio.
    * @readonly
    */
    this.usingWebAudio = false;

    /**
    * @property {boolean} usingAudioTag - True the SoundManager and device are both using the Audio tag instead of Web Audio.
    * @readonly
    */
    this.usingAudioTag = false;

    /**
    * @property {boolean} noAudio - True if audio been disabled via the PhaserGlobal (useful if you need to use a 3rd party audio library) or the device doesn't support any audio.
    * @default
    */
    this.noAudio = false;

    /**
    * @property {boolean} connectToMaster - Used in conjunction with Sound.externalNode this allows you to stop a Sound node being connected to the SoundManager master gain node.
    * @default
    */
    this.connectToMaster = true;

    /**
    * @property {boolean} touchLocked - true if the audio system is currently locked awaiting a touch event.
    * @default
    */
    this.touchLocked = false;

    /**
    * @property {number} channels - The number of audio channels to use in playback.
    * @default
    */
    this.channels = 32;

    /**
    * @property {boolean} _codeMuted - Internal mute tracking var.
    * @private
    * @default
    */
    this._codeMuted = false;

    /**
    * @property {boolean} _muted - Internal mute tracking var.
    * @private
    * @default
    */
    this._muted = false;

    /**
    * @property {AudioContext} _unlockSource - Internal unlock tracking var.
    * @private
    * @default
    */
    this._unlockSource = null;

    /**
    * @property {number} _volume - The global audio volume. A value between 0 (silence) and 1 (full volume).
    * @private
    * @default
    */
    this._volume = 1;

    /**
    * @property {array} _sounds - An array containing all the sounds
    * @private
    */
    this._sounds = [];

    /**
    * @property {Phaser.ArraySet} _watchList - An array set containing all the sounds being monitored for decoding status.
    * @private
    */
    this._watchList = new Phaser.ArraySet();

    /**
    * @property {boolean} _watching - Is the SoundManager monitoring the watchList?
    * @private
    */
    this._watching = false;

    /**
    * @property {function} _watchCallback - The callback to invoke once the watchlist is clear.
    * @private
    */
    this._watchCallback = null;

    /**
    * @property {object} _watchContext - The context in which to call the watchlist callback.
    * @private
    */
    this._watchContext = null;

};

Phaser.SoundManager.prototype = {

    /**
    * Initialises the sound manager.
    * @method Phaser.SoundManager#boot
    * @protected
    */
    boot: function () {

        if (this.game.device.iOS && this.game.device.webAudio === false)
        {
            this.channels = 1;
        }

        //  PhaserGlobal overrides
        if (window['PhaserGlobal'])
        {
            //  Check to see if all audio playback is disabled (i.e. handled by a 3rd party class)
            if (window['PhaserGlobal'].disableAudio === true)
            {
                this.noAudio = true;
                this.touchLocked = false;
                return;
            }

            //  Check if the Web Audio API is disabled (for testing Audio Tag playback during development)
            if (window['PhaserGlobal'].disableWebAudio === true)
            {
                this.usingAudioTag = true;
                this.touchLocked = false;
                return;
            }
        }

        if (window['PhaserGlobal'] && window['PhaserGlobal'].audioContext)
        {
            this.context = window['PhaserGlobal'].audioContext;
        }
        else
        {
            if (!!window['AudioContext'])
            {
                try {
                    this.context = new window['AudioContext']();
                } catch (error) {
                    this.context = null;
                    this.usingWebAudio = false;
                    this.touchLocked = false;
                }
            }
            else if (!!window['webkitAudioContext'])
            {
                try {
                    this.context = new window['webkitAudioContext']();
                } catch (error) {
                    this.context = null;
                    this.usingWebAudio = false;
                    this.touchLocked = false;
                }
            }
        }

        if (this.context === null)
        {
            //  No Web Audio support - how about legacy Audio?
            if (window['Audio'] === undefined)
            {
                this.noAudio = true;
                return;
            }
            else
            {
                this.usingAudioTag = true;
            }
        }
        else
        {
            this.usingWebAudio = true;

            if (this.context.createGain === undefined)
            {
                this.masterGain = this.context.createGainNode();
            }
            else
            {
                this.masterGain = this.context.createGain();
            }

            this.masterGain.gain.value = 1;
            this.masterGain.connect(this.context.destination);
        }

        if (!this.noAudio)
        {
            //  On mobile we need a native touch event before we can play anything, so capture it here
            if (!this.game.device.cocoonJS && this.game.device.iOS || (window['PhaserGlobal'] && window['PhaserGlobal'].fakeiOSTouchLock))
            {
                this.setTouchLock();
            }
        }

    },

    /**
    * Sets the Input Manager touch callback to be SoundManager.unlock.
    * Required for iOS audio device unlocking. Mostly just used internally.
    *
    * @method Phaser.SoundManager#setTouchLock
    */
    setTouchLock: function () {

        this.game.input.touch.addTouchLockCallback(this.unlock, this);
        this.touchLocked = true;

    },

    /**
    * Enables the audio, usually after the first touch.
    *
    * @method Phaser.SoundManager#unlock
    * @return {boolean} True if the callback should be removed, otherwise false.
    */
    unlock: function () {

        if (this.noAudio || !this.touchLocked || this._unlockSource !== null)
        {
            return true;
        }

        //  Global override (mostly for Audio Tag testing)
        if (this.usingAudioTag)
        {
            this.touchLocked = false;
            this._unlockSource = null;
        }
        else if (this.usingWebAudio)
        {
            // Create empty buffer and play it
            // The SoundManager.update loop captures the state of it and then resets touchLocked to false

            var buffer = this.context.createBuffer(1, 1, 22050);
            this._unlockSource = this.context.createBufferSource();
            this._unlockSource.buffer = buffer;
            this._unlockSource.connect(this.context.destination);

            if (this._unlockSource.start === undefined)
            {
                this._unlockSource.noteOn(0);
            }
            else
            {
                this._unlockSource.start(0);
            }
        }

        //  We can remove the event because we've done what we needed (started the unlock sound playing)
        return true;

    },

    /**
    * Stops all the sounds in the game.
    *
    * @method Phaser.SoundManager#stopAll
    */
    stopAll: function () {

        if (this.noAudio)
        {
            return;
        }

        for (var i = 0; i < this._sounds.length; i++)
        {
            if (this._sounds[i])
            {
                this._sounds[i].stop();
            }
        }

    },

    /**
    * Pauses all the sounds in the game.
    *
    * @method Phaser.SoundManager#pauseAll
    */
    pauseAll: function () {

        if (this.noAudio)
        {
            return;
        }

        for (var i = 0; i < this._sounds.length; i++)
        {
            if (this._sounds[i])
            {
                this._sounds[i].pause();
            }
        }

    },

    /**
    * Resumes every sound in the game.
    *
    * @method Phaser.SoundManager#resumeAll
    */
    resumeAll: function () {

        if (this.noAudio)
        {
            return;
        }

        for (var i = 0; i < this._sounds.length; i++)
        {
            if (this._sounds[i])
            {
                this._sounds[i].resume();
            }
        }

    },

    /**
    * Decode a sound by its asset key.
    *
    * @method Phaser.SoundManager#decode
    * @param {string} key - Assets key of the sound to be decoded.
    * @param {Phaser.Sound} [sound] - Its buffer will be set to decoded data.
    */
    decode: function (key, sound) {

        sound = sound || null;

        var soundData = this.game.cache.getSoundData(key);

        if (soundData)
        {
            if (this.game.cache.isSoundDecoded(key) === false)
            {
                this.game.cache.updateSound(key, 'isDecoding', true);

                var _this = this;

                try {
                    this.context.decodeAudioData(soundData, function (buffer) {

                        if (buffer)
                        {
                            _this.game.cache.decodedSound(key, buffer);
                            _this.onSoundDecode.dispatch(key, sound);
                        }
                    });
                }
                catch (e) {}
            }
        }

    },

    /**
     * This method allows you to give the SoundManager a list of Sound files, or keys, and a callback.
     * Once all of the Sound files have finished decoding the callback will be invoked.
     * The amount of time spent decoding depends on the codec used and file size.
     * If all of the files given have already decoded the callback is triggered immediately.
     *
     * @method Phaser.SoundManager#setDecodedCallback
     * @param {string|array} files - An array containing either Phaser.Sound objects or their key strings as found in the Phaser.Cache.
     * @param {Function} callback - The callback which will be invoked once all files have finished decoding.
     * @param {Object} callbackContext - The context in which the callback will run.
     */
    setDecodedCallback: function (files, callback, callbackContext) {

        if (typeof files === 'string')
        {
            files = [ files ];
        }

        this._watchList.reset();

        for (var i = 0; i < files.length; i++)
        {
            if (files[i] instanceof Phaser.Sound)
            {
                if (!this.game.cache.isSoundDecoded(files[i].key))
                {
                    this._watchList.add(files[i].key);
                }
            }
            else if (!this.game.cache.isSoundDecoded(files[i]))
            {
                this._watchList.add(files[i]);
            }
        }

        //  All decoded already?
        if (this._watchList.total === 0)
        {
            this._watching = false;
            callback.call(callbackContext);
        }
        else
        {
            this._watching = true;
            this._watchCallback = callback;
            this._watchContext = callbackContext;
        }

    },

    /**
    * Updates every sound in the game, checks for audio unlock on mobile and monitors the decoding watch list.
    *
    * @method Phaser.SoundManager#update
    * @protected
    */
    update: function () {

        if (this.noAudio)
        {
            return;
        }

        if (this.touchLocked && this._unlockSource !== null && (this._unlockSource.playbackState === this._unlockSource.PLAYING_STATE || this._unlockSource.playbackState === this._unlockSource.FINISHED_STATE))
        {
            this.touchLocked = false;
            this._unlockSource = null;
        }

        for (var i = 0; i < this._sounds.length; i++)
        {
            this._sounds[i].update();
        }

        if (this._watching)
        {
            var key = this._watchList.first;

            while (key)
            {
                if (this.game.cache.isSoundDecoded(key))
                {
                    this._watchList.remove(key);
                }

                key = this._watchList.next;
            }

            if (this._watchList.total === 0)
            {
                this._watching = false;
                this._watchCallback.call(this._watchContext);
            }
        }

    },

    /**
    * Adds a new Sound into the SoundManager.
    *
    * @method Phaser.SoundManager#add
    * @param {string} key - Asset key for the sound.
    * @param {number} [volume=1] - Default value for the volume.
    * @param {boolean} [loop=false] - Whether or not the sound will loop.
    * @param {boolean} [connect=true] - Controls if the created Sound object will connect to the master gainNode of the SoundManager when running under WebAudio.
    * @return {Phaser.Sound} The new sound instance.
    */
    add: function (key, volume, loop, connect) {

        if (volume === undefined) { volume = 1; }
        if (loop === undefined) { loop = false; }
        if (connect === undefined) { connect = this.connectToMaster; }

        var sound = new Phaser.Sound(this.game, key, volume, loop, connect);

        this._sounds.push(sound);

        return sound;

    },

    /**
     * Adds a new AudioSprite into the SoundManager.
     *
     * @method Phaser.SoundManager#addSprite
     * @param {string} key - Asset key for the sound.
     * @return {Phaser.AudioSprite} The new AudioSprite instance.
     */
    addSprite: function(key) {

        var audioSprite = new Phaser.AudioSprite(this.game, key);

        return audioSprite;

    },

    /**
    * Removes a Sound from the SoundManager. The removed Sound is destroyed before removal.
    *
    * @method Phaser.SoundManager#remove
    * @param {Phaser.Sound} sound - The sound object to remove.
    * @return {boolean} True if the sound was removed successfully, otherwise false.
    */
    remove: function (sound) {

        var i = this._sounds.length;

        while (i--)
        {
            if (this._sounds[i] === sound)
            {
                this._sounds[i].destroy(false);
                this._sounds.splice(i, 1);
                return true;
            }
        }

        return false;

    },

    /**
    * Removes all Sounds from the SoundManager that have an asset key matching the given value.
    * The removed Sounds are destroyed before removal.
    *
    * @method Phaser.SoundManager#removeByKey
    * @param {string} key - The key to match when removing sound objects.
    * @return {number} The number of matching sound objects that were removed.
    */
    removeByKey: function (key) {

        var i = this._sounds.length;
        var removed = 0;

        while (i--)
        {
            if (this._sounds[i].key === key)
            {
                this._sounds[i].destroy(false);
                this._sounds.splice(i, 1);
                removed++;
            }
        }

        return removed;

    },

    /**
    * Adds a new Sound into the SoundManager and starts it playing.
    *
    * @method Phaser.SoundManager#play
    * @param {string} key - Asset key for the sound.
    * @param {number} [volume=1] - Default value for the volume.
    * @param {boolean} [loop=false] - Whether or not the sound will loop.
    * @return {Phaser.Sound} The new sound instance.
    */
    play: function (key, volume, loop) {

        if (this.noAudio)
        {
            return;
        }

        var sound = this.add(key, volume, loop);

        sound.play();

        return sound;

    },

    /**
    * Internal mute handler called automatically by the SoundManager.mute setter.
    *
    * @method Phaser.SoundManager#setMute
    * @private
    */
    setMute: function () {

        if (this._muted)
        {
            return;
        }

        this._muted = true;

        if (this.usingWebAudio)
        {
            this._muteVolume = this.masterGain.gain.value;
            this.masterGain.gain.value = 0;
        }

        //  Loop through sounds
        for (var i = 0; i < this._sounds.length; i++)
        {
            if (this._sounds[i].usingAudioTag)
            {
                this._sounds[i].mute = true;
            }
        }

        this.onMute.dispatch();

    },

    /**
    * Internal mute handler called automatically by the SoundManager.mute setter.
    *
    * @method Phaser.SoundManager#unsetMute
    * @private
    */
    unsetMute: function () {

        if (!this._muted || this._codeMuted)
        {
            return;
        }

        this._muted = false;

        if (this.usingWebAudio)
        {
            this.masterGain.gain.value = this._muteVolume;
        }

        //  Loop through sounds
        for (var i = 0; i < this._sounds.length; i++)
        {
            if (this._sounds[i].usingAudioTag)
            {
                this._sounds[i].mute = false;
            }
        }

        this.onUnMute.dispatch();

    },

    /**
    * Stops all the sounds in the game, then destroys them and finally clears up any callbacks.
    *
    * @method Phaser.SoundManager#destroy
    */
    destroy: function () {

        this.stopAll();

        for (var i = 0; i < this._sounds.length; i++)
        {
            if (this._sounds[i])
            {
                this._sounds[i].destroy();
            }
        }

        this._sounds = [];

        this.onSoundDecode.dispose();

        if (this.context && window['PhaserGlobal'])
        {
            //  Store this in the PhaserGlobal window var, if set, to allow for re-use if the game is created again without the page refreshing
            window['PhaserGlobal'].audioContext = this.context;
        }

    }

};

Phaser.SoundManager.prototype.constructor = Phaser.SoundManager;

/**
* @name Phaser.SoundManager#mute
* @property {boolean} mute - Gets or sets the muted state of the SoundManager. This effects all sounds in the game.
*/
Object.defineProperty(Phaser.SoundManager.prototype, "mute", {

    get: function () {

        return this._muted;

    },

    set: function (value) {

        value = value || false;

        if (value)
        {
            if (this._muted)
            {
                return;
            }

            this._codeMuted = true;
            this.setMute();
        }
        else
        {
            if (!this._muted)
            {
                return;
            }

            this._codeMuted = false;
            this.unsetMute();
        }
    }

});

/**
* @name Phaser.SoundManager#volume
* @property {number} volume - Gets or sets the global volume of the SoundManager, a value between 0 and 1. The value given is clamped to the range 0 to 1.
*/
Object.defineProperty(Phaser.SoundManager.prototype, "volume", {

    get: function () {

        return this._volume;

    },

    set: function (value) {

        if (value < 0)
        {
            value = 0;
        }
        else if (value > 1)
        {
            value = 1;
        }

        if (this._volume !== value)
        {
            this._volume = value;

            if (this.usingWebAudio)
            {
                this.masterGain.gain.value = value;
            }
            else
            {
                //  Loop through the sound cache and change the volume of all html audio tags
                for (var i = 0; i < this._sounds.length; i++)
                {
                    if (this._sounds[i].usingAudioTag)
                    {
                        this._sounds[i].volume = this._sounds[i].volume * value;
                    }
                }
            }

            this.onVolumeChange.dispatch(value);

        }

    }

});


text:
package org.apache.axis2.transport.sms.smpp;

import org.apache.axis2.transport.sms.SMSImplManager;
import org.apache.axis2.transport.sms.SMSTransportConstents;
import org.apache.axis2.transport.sms.SMSMessage;
import org.apache.axis2.transport.sms.SMSManager;
import org.apache.axis2.description.TransportInDescription;
import org.apache.axis2.description.TransportOutDescription;
import org.apache.axis2.AxisFault;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jsmpp.session.SMPPSession;
import org.jsmpp.session.BindParameter;
import org.jsmpp.bean.*;
import org.jsmpp.util.TimeFormatter;
import org.jsmpp.util.AbsoluteTimeFormatter;
import org.jsmpp.InvalidResponseException;
import org.jsmpp.PDUException;
import org.jsmpp.extra.NegativeResponseException;
import org.jsmpp.extra.ResponseTimeoutException;

import java.io.IOException;
import java.util.Date;

public class SMPPImplManager implements SMSImplManager {

     /** the reference to the actual commons logger to be used for log messages */
    protected Log log = LogFactory.getLog(this.getClass());
    private SMPPTransportInDetails smppTransportInDetails = SMPPTransportInDetails.getInstence();
    private SMPPTransportOutDetails smppTransportOutDetails = SMPPTransportOutDetails.getInstence();

    private volatile boolean stop=true;
    private SMSManager smsInManeger;

    private SMPPSession inSession;
    private SMPPSession outSession;
    private static TimeFormatter timeFormatter = new AbsoluteTimeFormatter();

    /**
     * SMPP implementation Constents
     */
    public static String SOURCE_ADDRESS_TON = "source_address_ton";
    public static String SOURCE_ADDRESS_NPI = "source_address_npi";

    public static String DESTINATION_ADDRESS_TON = "destination_address_ton";
    public static String DESTINATION_ADDRESS_NPI = "destination_address_npi";

    public void start() {
        inSession = new SMPPSession();
        try {
            inSession.connectAndBind(smppTransportInDetails.getHost(), smppTransportInDetails.getPort(), new BindParameter(BindType.BIND_RX, smppTransportInDetails.getSystemId(),
                        smppTransportInDetails.getPassword(), smppTransportInDetails.getSystemType() , TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, null));

            SMPPListener listener = new SMPPListener(smsInManeger);
            inSession.setMessageReceiverListener(listener);
            stop = false;
            System.out.println(" [Axis2] bind and connect to " + smppTransportInDetails.getHost()+" : " +
                    smppTransportInDetails.getPort() + " on SMPP Transport");

        } catch (IOException e) {
            log.error("Unable to conncet" + e);
        }

    }

    public void stop() {
        log.info("Stopping SMPP Transport ...");
        stop = true;

        if(inSession != null) {
            inSession.unbindAndClose();
        }

        if(outSession !=null) {
            outSession.unbindAndClose();
        }
    }

    public void setTransportInDetails(TransportInDescription transportInDetails) throws AxisFault {
        if(transportInDetails == null) {
            throw new AxisFault("No transport in details");
        }

        if(transportInDetails.getParameter(SMSTransportConstents.SYSTEM_TYPE) != null){
            smppTransportInDetails.setSystemType((String)transportInDetails.getParameter(
                    SMSTransportConstents.SYSTEM_TYPE).getValue());
        }

        if (transportInDetails.getParameter(SMSTransportConstents.SYSTEM_ID) != null) {
            smppTransportInDetails.setSystemId((String)transportInDetails.getParameter(SMSTransportConstents.SYSTEM_ID).
                    getValue());
        } else {
            throw new AxisFault("System Id not set");
        }

        if (transportInDetails.getParameter(SMSTransportConstents.PASSWORD) != null) {
            smppTransportInDetails.setPassword((String)transportInDetails.getParameter(SMSTransportConstents.PASSWORD).
                    getValue());
        } else {
            throw new AxisFault("password not set");
        }

        if(transportInDetails.getParameter(SMSTransportConstents.HOST) != null) {
            smppTransportInDetails.setHost((String)transportInDetails.getParameter(SMSTransportConstents.HOST).
                    getValue());
        }

        if(transportInDetails.getParameter(SMSTransportConstents.PORT) != null) {
            smppTransportInDetails.setPort(Integer.parseInt((String)transportInDetails.getParameter(
                    SMSTransportConstents.PORT).getValue()));
        }

        if(transportInDetails.getParameter(SMSTransportConstents.PHONE_NUMBER) != null) {
            smppTransportInDetails.setPhoneNumber((String)transportInDetails.getParameter(
                    SMSTransportConstents.PHONE_NUMBER).getValue());
        }
    }

    public void setTransportOutDetails(TransportOutDescription transportOutDetails) throws AxisFault{
         if(transportOutDetails == null) {
            throw new AxisFault("No transport in details");
        }

        if(transportOutDetails.getParameter(SMSTransportConstents.SYSTEM_TYPE) != null){
            smppTransportOutDetails.setSystemType((String)transportOutDetails.getParameter(
                    SMSTransportConstents.SYSTEM_TYPE).getValue());
        }

        if (transportOutDetails.getParameter(SMSTransportConstents.SYSTEM_ID) != null) {
            smppTransportOutDetails.setSystemId((String)transportOutDetails.getParameter(SMSTransportConstents.SYSTEM_ID).
                    getValue());
        } else {
            throw new AxisFault("System Id not set");
        }

        if (transportOutDetails.getParameter(SMSTransportConstents.PASSWORD) != null) {
            smppTransportOutDetails.setPassword((String)transportOutDetails.getParameter(SMSTransportConstents.PASSWORD).
                    getValue());
        } else {
            throw new AxisFault("password not set");
        }

        if(transportOutDetails.getParameter(SMSTransportConstents.HOST) != null) {
            smppTransportOutDetails.setHost((String)transportOutDetails.getParameter(SMSTransportConstents.HOST).
                    getValue());
        }

        if(transportOutDetails.getParameter(SMSTransportConstents.PORT) != null) {
            smppTransportOutDetails.setPort(Integer.parseInt((String)transportOutDetails.getParameter(
                    SMSTransportConstents.PORT).getValue()));
        }

        if(transportOutDetails.getParameter(SMSTransportConstents.PHONE_NUMBER) != null) {
            smppTransportOutDetails.setPhoneNumber((String)transportOutDetails.getParameter(
                    SMSTransportConstents.PHONE_NUMBER).getValue());
        }
    }

    public void sendSMS(SMSMessage sm) {
        TypeOfNumber sourceTon =TypeOfNumber.UNKNOWN;
        NumberingPlanIndicator sourceNpi = NumberingPlanIndicator.UNKNOWN;

        TypeOfNumber destTon = TypeOfNumber.UNKNOWN;
        NumberingPlanIndicator destNpi = NumberingPlanIndicator.UNKNOWN;
        try {
            if (outSession == null) {
                outSession = new SMPPSession();
                outSession.setEnquireLinkTimer(smppTransportOutDetails.getEnquireLinkTimer());
                outSession.setTransactionTimer(smppTransportOutDetails.getTransactionTimer());
                outSession.connectAndBind(smppTransportOutDetails.getHost(), smppTransportOutDetails.getPort(),
                        new BindParameter(BindType.BIND_TX, smppTransportOutDetails.getSystemId(),
                                smppTransportOutDetails.getPassword(), smppTransportOutDetails.getSystemType(),
                                TypeOfNumber.UNKNOWN, NumberingPlanIndicator.UNKNOWN, null));

                log.debug("Conected and bind to " + smppTransportOutDetails.getHost());
            }

            boolean invert = true;

            if("false".equals(sm.getProperties().get(SMSTransportConstents.INVERT_SOURCE_AND_DESTINATION))){
                invert = false;
            }

            if(invert) {
                if(sm.getProperties().get(DESTINATION_ADDRESS_NPI) != null) {
                    sourceNpi = NumberingPlanIndicator.valueOf((String)sm.getProperties().get(DESTINATION_ADDRESS_NPI));
                }

                if(sm.getProperties().get(DESTINATION_ADDRESS_TON) != null) {
                    sourceTon = TypeOfNumber.valueOf((String)sm.getProperties().get(DESTINATION_ADDRESS_TON));
                }
                if(sm.getProperties().get(SOURCE_ADDRESS_NPI) != null) {
                    destNpi = NumberingPlanIndicator.valueOf((String)sm.getProperties().get(SOURCE_ADDRESS_NPI));
                }
                if(sm.getProperties().get(SOURCE_ADDRESS_TON) != null) {
                    destTon = TypeOfNumber.valueOf((String)sm.getProperties().get(SOURCE_ADDRESS_TON));
                }

            } else {

                if(sm.getProperties().get(DESTINATION_ADDRESS_NPI) != null) {
                    destNpi = NumberingPlanIndicator.valueOf((String)sm.getProperties().get(DESTINATION_ADDRESS_NPI));
                }

                if(sm.getProperties().get(DESTINATION_ADDRESS_TON) != null) {
                    destTon = TypeOfNumber.valueOf((String)sm.getProperties().get(DESTINATION_ADDRESS_TON));
                }

                if(sm.getProperties().get(SOURCE_ADDRESS_NPI) != null) {
                    sourceNpi = NumberingPlanIndicator.valueOf((String)sm.getProperties().get(SOURCE_ADDRESS_NPI));
                }

                if(sm.getProperties().get(SOURCE_ADDRESS_TON) != null) {
                    sourceTon = TypeOfNumber.valueOf((String)sm.getProperties().get(SOURCE_ADDRESS_TON));
                }

            }

            String messageId = outSession.submitShortMessage(
                    "CMT",
                    sourceTon,
                    sourceNpi,
                    sm.getSender(),
                    destTon,
                    destNpi,
                    sm.getReceiver(),
                    new ESMClass(),
                    (byte) 0,
                    (byte) 1,
                    timeFormatter.format(new Date()),
                    null,
                    new RegisteredDelivery(SMSCDeliveryReceipt.DEFAULT),
                    (byte) 0,
                    new GeneralDataCoding(false, false, MessageClass.CLASS1,Alphabet.ALPHA_DEFAULT),
                    (byte) 0,
                    sm.getContent().getBytes()
            );

            log.debug("Message Submited with id" + messageId);
        } catch (IOException e) {
            log.error("Unable to Connect ", e);
        } catch (InvalidResponseException e) {
            log.debug("Invalid responce Exception", e);
        } catch (PDUException e) {
            log.debug("PDU Exception", e);
        } catch (NegativeResponseException e) {
            log.debug(e);
        } catch (ResponseTimeoutException e) {
            log.debug(e);
        }

    }

    public void setSMSInManager(SMSManager manager) {
        this.smsInManeger = manager;
    }

    public SMSManager getSMSInManager() {
        return smsInManeger;
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace embree
{
  std::vector<Handle<Device::RTPrimitive> > loadXML(const FileName &fileName);
}

#endif


text:
//  Copyright (c) 2014-2015 First Flamingo Enterprise B.V.
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
//  ATLJourneyElement.h
//  FlamingoModel
//
//  Created by Berend Schotanus on 31-07-14.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

typedef enum {
    ATLElementStatusExpected = 0,
    ATLElementStatusPresent,
    ATLElementStatusCompleted
} ATLElementStatus;

@class ATLJourney;

@interface ATLJourneyElement : NSManagedObject

#pragma mark - Status and relations
/**
 The journey to which the element belongs.
 */
@property (nonatomic, retain) ATLJourney *journey;
/**
 The status of the element, indicating whether the element is traveled in future, present or past.
 */
@property (nonatomic, assign) ATLElementStatus status;
/**
 The position of the element within its journey
 */
@property (nonatomic) int16_t order;
/**
 Previous element in the journey or nil if not available.
 */
@property (nonatomic, readonly) ATLJourneyElement *previousElement;
/**
 Next element in the journey or nil if not available.
 */
@property (nonatomic, readonly) ATLJourneyElement *nextElement;
/**
 Notify the system that the element was passed. This will change the status of the element and all previous elements to competed.
 */
- (void)passedBy;

@property (nonatomic, readonly) BOOL isDummyElement;

#pragma mark - Managing time
/**
 Estimated Time of Departure of this element. The default implementation returns nil, the getter has to be overwritten by subclasses.
 */
@property (nonatomic, readonly) NSDate *estimatedDeparture;
/**
 Estimated Time of Arrival of this element. The default implementation returns nil, the getter has to be overwritten by subclasses.
 */
@property (nonatomic, readonly) NSDate *estimatedArrival;
/**
 The time when this element ends, either arrival or departure.
 */
@property (nonatomic, readonly) NSDate *endTime;

- (void)recalculateTimesForeward:(BOOL)forewardDirection;

@end


text:
using System;
using System.Linq.Expressions;

namespace Penneo.Util
{
    /// <summary>
    /// Reflection utilities
    /// </summary>
    internal static class ReflectionUtil
    {
        /// <summary>
        /// Get the property name from a property get expression
        /// </summary>
        public static string GetPropertyName<T>(Expression<Func<T, object>> property)
        {
            var e = property.Body;

            var unary = property.Body as UnaryExpression;
            if (unary != null)
            {
                e = unary.Operand;
            }

            return ((MemberExpression) e).Member.Name;
        }

        /// <summary>
        /// Get the property name from a property get expression
        /// </summary>
        public static string GetPropertyName<T>(Expression<Func<T, byte[]>> property)
        {
            return ((MemberExpression)property.Body).Member.Name;
        }

        /// <summary>
        /// Get the property name from a property get expression
        /// </summary>
        public static string GetPropertyName<T>(Expression<Func<T, string>> property)
        {
            return ((MemberExpression) property.Body).Member.Name;
        }
    }
}


text: Servicios


text:
package eu.verdelhan.ta4j.indicators.simple;

import eu.verdelhan.ta4j.TimeSeries;
import eu.verdelhan.ta4j.mocks.MockTimeSeries;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

public class AmountIndicatorTest {

    private AmountIndicator amountIndicator;

    TimeSeries timeSeries;

    @Before
    public void setUp() {
        timeSeries = new MockTimeSeries();
        amountIndicator = new AmountIndicator(timeSeries);
    }

    @Test
    public void indicatorShouldRetrieveTickAmountPrice() {
        for (int i = 0; i < 10; i++) {
            assertEquals(amountIndicator.getValue(i), timeSeries.getTick(i).getAmount());
        }
    }
}


text:
<?php
function jsonResponse($status, $result){
    return json_encode(array('status' => $status, 'response' => $result));
}
?>


text:
// backbone.hexer.js 0.1
// (c) 2015 Lindsay Gaines

// backbone.hexer may be freely distributed under the MIT license.
// For all details and documentation:
// http://github.com/aethr/backbone.hexer

(function(root, factory) {
  // Set up depending on the environment. Start with AMD.
  if (typeof define === 'function' && define.amd) {
    define(['underscore', 'backbone', 'jquery', 'exports'], function(_, Backbone, $, exports) {
      // Export global even in AMD case in case this script is loaded with
      // others that may still expect a global Backbone.
      Backbone.Hexer = factory(root, exports, _, Backbone, $);
    });

  // Next for Node.js or CommonJS. jQuery may not be needed as a module.
  } else if (typeof exports !== 'undefined') {
    var _ = require('underscore'), Backbone = require('backbone'), $;
    try { $ = require('jquery'); } catch(e) {}

    factory(root, exports, _, Backbone, $);

  // Finally, as a browser global.
  } else {
    root.Backbone.Hexer = factory(root, {}, root._, root.Backbone, (root.jQuery || root.Zepto || root.ender || root.$));
  }
}(this, function(root, Hexer, _, Backbone, $) {

  // a Hexer is a Backbone View
  Hexer = Backbone.Hexer = Backbone.HexGridView = Backbone.View.extend({

    tagName: "div",
    className: "bbh-container",

    defaults: {
      depth: 2,
      color: '#999999',
      size: '6em',
      spacing: '0.5em',
      center: {x: 0, y: 0}
    },

    events: {},

    hexes: [],

    animateTimeout: null,

    initialize: function(options) {
      // Default options
      this.options = _.extend({}, this.defaults, options);

      // Split convenient notations (ie '5em') into their value and unit
      this.options.unit     = this.options.size.replace( /^\d+/g, '');
      if (this.options.unit == '') this.options.unit = 'em'; // Default to em
      // Parse the numeric values into floats
      this.options.size     = parseFloatIfString(this.options.size);
      this.options.spacing  = parseFloatIfString(this.options.spacing);
      this.options.center.x = parseFloatIfString(this.options.center.x);
      this.options.center.y = parseFloatIfString(this.options.center.y);

      _.bindAll(this, 'addAdjacentHexes');

      // Add the hex clip svg to the document so it can be used in the
      // clip-path: url(...); format in firefox
      // This is a hack so the developer doesm't need to include the svg in
      // every document
      var $div = $('<svg width="0" height="0"><defs><clipPath id="bbh-hexclip" clipPathUnits="objectBoundingBox"><polygon points="0.5 0 1 0.25 1 0.75 0.5 1 0 0.75 0 0.25"/></clipPath></defs></svg>');
      document.body.insertBefore($div[0], document.body.childNodes[0]);

      // Create all the Hexes
      this.createHexViews();
    },

    render: function() {
      // Allow each hex to re-render if necessary
      _.each(this.hexes, function (hex, i) {
        hex.render();
      });
      return this;
    },

    /**
     * Create the individual Hexes that will comrprise the grid.
     */
    createHexViews: function() {
      var fillDepth = (this.options.depth == 'fill') ? 10 : this.options.depth;

      for (var i = 0; i < fillDepth; i++) {
        switch (i) {
          // No Hexes have been created yet, make the first
          case 0:
            this.addHex({
              distance: 0,
              x: this.options.center.x,
              y: this.options.center.y
            });
            break;

          // Find every Hex at the current depth and add Hexes around it!
          default:
            // This is complicated!
            var allEdgeHexes = getHexesAtDistance(i - 1, this.hexes);
            _.each(allEdgeHexes, function (hex, index) {
              this.addAdjacentHexes(hex, 0, 6);
            }.bind(this));
            break;
        }
      }
    },

    /**
     * Helper function to create a single Hex with the specified options, and
     * add its el to the DOM.
     *
     * @param options
     *   Parameters to pass to the constructor of the new Hex
     * @returns {Hex}
     */
    addHex: function(options) {
      options = _.extend({
          size: this.options.size + this.options.unit,
          color: this.options.color
      }, options);
      var newHex = new Hex(options);
      this.hexes.push(newHex);
      this.$el.append(newHex.$el);

      return newHex;
    },

    /**
     * Add a single adjacent hex to the origin hex, at one of the edges
     * specified by the position.
     *
     * @param originHex
     *   The Hex that will have new Hexes added around its edges.
     * @param position
     *   The position of the edge where the new hex should be drawn
     *    0
     * 5 / \ 1
     * 4 \_/ 2
     *    3
     * @param hexParams
     *   The options to be passed to the new Hex
     */
    addAdjacentHex: function (originHex, position, hexParams) {
      // Calculate the angle between the originHex and the new adjacent Hex
      var angle = (position == 0) ? 0 : (2.0 * Math.PI / 6) * position,

          // Distance of the new Hex from the originHex
          scale = this.options.size + this.options.spacing,

          // Position of the new Hex
          x = originHex.options.x + (Math.cos(angle) * scale),
          y = originHex.options.y + (Math.sin(angle) * scale),

          // Store the distance from the original Hex
          distance = originHex.options.distance + 1,

          // Keep a reference to the originHex
          originPosition = oppositePosition(position),
          neighbors = {};

      // Since they are adjacent, the originHex will occupy the opposite edge
      neighbors[originPosition] = originHex;

      // Add a new Hex with the supplied parameters, at the new coordinates
      var newHex = this.addHex(_.extend({
        x: x,
        y: y,
        distance: distance,
        neighbors: neighbors
      }, hexParams));

      // Store a reference to the originHex's new neighbor
      originHex.addNeighbor(position, newHex, true);

      // If the originHex has neighbors adjacent to the new Hex, pass the
      // references so the Hex grid has a more complete set of relationships
      var prevPosition = (position - 1 >= 0) ? position - 1 : position + 5,
          nextPosition = (position + 1 < 6)  ? position + 1 : position - 5;
      if (_.has(originHex.options.neighbors, prevPosition)) {
        newHex.addNeighbor(prevPosition - 1, originHex.options.neighbors[prevPosition], true);
      }
      if (_.has(originHex.options.neighbors, nextPosition)) {
        newHex.addNeighbor(nextPosition + 1, originHex.options.neighbors[nextPosition], true);
      }
    },

    /**
     * Add new Hexes adjacent to the originHex, starting at the specified
     * startPosition.  Any positions that are already filled with a Hex will
     * be skipped.
     *
     * @param originHex
     *   The Hex to add adjacent Hexes to.
     * @param startPosition
     *   The position of the edge where the first Hex should be added.
     * @param count
     *   The number of Hexes to be added.
     */
    addAdjacentHexes: function(originHex, startPosition, count) {
      // Reset values back within legal bounds
      if (count > 6)
        count = 6;
      if (startPosition > 5) {
        startPosition -= 6;
      }
      // Add a new Hex for each edge until we reach the supplied count
      for (var i = startPosition; i < startPosition + count; i++) {
        // Don't try to add a new Hex where there is one already
        if (!_.isUndefined(originHex.options.neighbors[i]) && !_.isNull(originHex.options.neighbors[i])) {
          continue;
        }

        // Add the new Hex
        this.addAdjacentHex(originHex, i, {
          // Just an example, print the hex number inside each hex
//          content: _.partial(function(count) { return count; }, this.hexes.length)
        });
      }
    },

    /**
     * A function that allows an animation to be run across a set of Hexes.
     *
     * @param options
     *   An object which specifies how to animate the Hexes.  Valid keys are:
     *   animateQueue: a priority queue (array of arrays) of Hexes, with the
     *     top-level array determining the order of animation.  All hexes in
     *     the first
     *   animateFunction: a function with a single argument for a Hex.  This
     *     function will be called once on each Hex provided in order.
     *   delay: the number of ms to delay in between animating each Hex.
     */
    animate: function(options) {
      // Set some sane defaults for the animation
      var params = _.extend({
        animateFunction: function(hex) { /* Do something! */ },
        animateQueue: [this.hexes],
        delay: 50
      }, options);

      // Create a helper function that will help us execute a single animation
      // and then set a timeout for the next animation
      var animateHelper = function (animateQueue, animateFunction, delay) {
        // Execute the animation on the current Hex
        var animationTargets = animateQueue.shift();
        for (var i = 0; i < animationTargets.length; i++) {
          animateFunction(animationTargets[i]);
        }

        // If we haven't gotten to the end of the list, set a timer for the
        // next animation to occur
        if (animateQueue.length) {
          // Store a reference to the timeout in case we want to end early
          this.animateTimeout = setTimeout(function() {
            animateHelper(animateQueue, animateFunction, delay);
          }, params.delay);
        }
      }

      // Kick off the first animation straight away
      animateHelper(_.clone(params.animateQueue), params.animateFunction, params.delay);
    }

  });

  // a Hexer is a Backbone View
  var Hex = Backbone.View.extend({
    tagName: "div",
    className: "bbh-hex",

    defaults: {
      x: 0, y: 0,
      size: '3em',
      color: '#999999',
      content: '',
      neighbors: {}
    },

    neighbors: {},

    initialize: function(options) {
      // Default options
      this.options = _.extend({}, this.defaults, options);

      this.options.unit = this.options.size.replace( /^\d+/g, '');
      this.options.size = parseFloatIfString(this.options.size);

      // Allow content to be defined by a function, simply replace the
      // default function, which just returns this.options.content
      if (_.isFunction(this.options.content)) {
        this.content = this.options.content;
      }
    },

    render: function() {
      var cssProps = {
        clipPath: "url(#bbh-hexclip)",
        webkitClipPath: "url(#bbh-hexclip)",
        transform: 'translateX(' + this.options.x + this.options.unit + ') translateY(' + this.options.y + this.options.unit + ')',
        webkitTransform: 'translateX(' + this.options.x + this.options.unit + ' translateY(' + this.options.y + this.options.unit + ')',
        width:  (Math.sqrt(3)/2 * this.options.size) + this.options.unit, // width is smaller than height
        height: this.options.size + this.options.unit
      }

      if (_.isNull(this.options.color)) {
        cssProps.background = this.options.color;
      }

      // Set the css properties of the Hex to display in the right place
      this.$el.css(cssProps);

      // Set the inner content of the Hex if available
      this.$el.html('
' + this.content.call(this) + '
');

      return this;
    },

    /**
     * Default content function, just returns the content string.
     * @returns string
     */
    content: function() {
      return this.options.content;
    },

    /**
     * Add a reference to a neighboring Hex.
     * @param position
     *   The position of the neighbor.
     * @param hex
     *   The reference to the neighbor Hex.
     * @param exchange
     *   If true, a reference to this Hex will be passed to the neighboring Hex.
     */
    addNeighbor: function(position, hex, exchange) {
      exchange = (!_.isUndefined(exchange)) ? exchange : false;

      // Normalise position
      position = (position > 5) ? position - 6 : position;
      position = (position < 0) ? position + 6 : position;

      // Store a reference at the specified position to the new neighbor
      this.options.neighbors[position] = hex;

      // If Hexes are exchanging neighbors, tell the neighbor to store a
      // reference to this Hex in the opposite position
      if (exchange === true) {
        // For the neighbor Hex, this will occupy the opposite position
        hex.addNeighbor(oppositePosition(position), this, false);
      }
    }

  });

  /**
   * Privately scoped helper functions
   */

  // Remove CSS units (eg, 'px') and return the numeric value as a float
  function parseFloatIfString(value) {
    if (_.isString(value)) {
      return parseFloat(value.replace( /\D+$/g, ''));
    }
    else {
      return value * 1.0;
    }
  }

  // Gets the position on the opposite side of a Hex
  function oppositePosition(position) {
    return (position + 3 > 5) ? position - 3 : position + 3;
  }

  // This assumes that hexList is ordered by distance.
  function getHexesAtDistance(distance, hexList) {
    var first = null,
        last;
    _.each(hexList, function (hex, index) {
      if (_.isNull(first) && hex.options.distance == distance) {
        first = index;
      }
      if (_.isNull(last) && !_.isNull(first) && hex.options.distance > distance) {
        last = index;
      }
    });

    return hexList.slice(first, last);
  }

  // Current version of the library. Keep in sync with `package.json`.
  Hexer.VERSION = '0.0.1';

  return Hexer;
}));


text:
class CreateRankingCollection < ActiveRecord::Migration
  def change
    create_table :ranking_collections do |t|
      t.string :format, null: false
      t.integer :week, null: false

      t.timestamps null: false
    end

    add_index :ranking_collections, :format
    add_index :ranking_collections, :week
  end
end


text:
package edas

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// DataInInsertSwimmingLaneGroup is a nested struct in edas response
type DataInInsertSwimmingLaneGroup struct {
	NamespaceId      string                                   `json:"NamespaceId" xml:"NamespaceId"`
	Name             string                                   `json:"Name" xml:"Name"`
	Id               int64                                    `json:"Id" xml:"Id"`
	EntryApplication EntryApplication                         `json:"EntryApplication" xml:"EntryApplication"`
	ApplicationList  ApplicationListInInsertSwimmingLaneGroup `json:"ApplicationList" xml:"ApplicationList"`
}


text:
package com.media.yanhaolu.utils.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Created by yanhaolu on 2017/8/25.
 */

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ViewInject {
    int value();
}


text:
/**
 * For Skip Nav in Morpheus
 */

var setupSkipNav = function(){
  // function called from site.vm to enable skip links for all browsers
   $PBJQ('#skipNav a.Mrphs-skipNav__link').click(function(){
     var target = $PBJQ(this).attr('href');
    $PBJQ(target).attr('tabindex','-1').focus();
   });
};

$PBJQ( document ).ready(function() {

	var lastScrollTop = 0;

	$PBJQ(document).scroll(function(event){
	   var st = $PBJQ(this).scrollTop();
	   if (st > lastScrollTop && st > 90 ){
	   	   $PBJQ(".Mrphs-topHeader").addClass('moving');
	   	   $PBJQ(".Mrphs-siteHierarchy").addClass('moving');
	   	   $PBJQ(".Mrphs-toolsNav__title--current-site").addClass('moving');
	   	   $PBJQ(".Mrphs-skipNav__menu").addClass('moving');
	   	   $PBJQ(".Mrphs-sitesNav__menuitem--myworkspace").addClass('moving');
	   } else if( st > 90 ) {
	   	    $PBJQ(".Mrphs-topHeader").removeClass('moving');
	   	   	$PBJQ(".Mrphs-siteHierarchy").removeClass('moving');
	   	   	$PBJQ(".Mrphs-toolsNav__title--current-site").removeClass('moving');
	   	   	$PBJQ(".Mrphs-skipNav__menu").removeClass('moving');
	   	   	$PBJQ(".Mrphs-sitesNav__menuitem--myworkspace").removeClass('moving');
	   }
	   lastScrollTop = st;
	});

});


text:
import os
import sys

from pyymir import *

DIRNAME = os.path.dirname(sys.argv[0])
DIRNAME = DIRNAME if DIRNAME else "./"

if __name__ == "__main__":
    ap = default_ymir_ap()
    ap.add_argument("-w", "--workmode", help = "either add computed probabilities to the input file ('add', default), or print them to the separated output file as a vector ('sep')", default = "add", type = str)
    ap.add_argument("-o", "--output", help = "path to the output folder for output files (default is './ymir_genprob/')", type = str, default = "./ymir_genprob/")
    ap.add_argument("-p", "--predefined", help = "recompute or use predefined model's gene usage (default is to recompute, to change it add '-p' to your script call)", action = "store_true")
    ap.add_argument("-l", "--leave", help = "add this to leave converted files (default is to remove converted files)", action = "store_true")
    ap.add_argument("-e", "--error", help = "error rate in the input data (default 0)", type = float, default = 0)
    ap.add_argument("-n", "--nuc", help = "compute nucleotide sequence probabilities (by default)", default = True, action = "store_true")
    ap.add_argument("-a", "--aa", help = "compute amino acid sequence probabilities", action = "store_true")
    ap = add_prealign(ap)
    args = ap.parse_args()

    files, input_check = parse_input(args)
    model, model_check = parse_model(args)
    converter, format_check = parse_format(args)
    out_files, out_check = parse_output_files(files, args, "n" if not args.aa else "a")

    print()
    if model_check and input_check and format_check and out_check:
        for i in range(len(files)):
            print(i + 1, " / ", len(files), ":")
            conv_file, convert_flag = convert(files[i], converter)
            if convert_flag:
                print()
                os.system(" ".join([DIRNAME + "/build/scripts/Compute", conv_file, model, out_files[i], "0" if args.predefined else "1", "n" if not args.aa else "a"]))

                if not args.leave and args.format != 'ymir':
                    os.remove(conv_file)
            print()
    else:
        print("Can't process further, too many errors for me! T_T")