text:
define([
  'dcl',
  'frozen/ResourceManager',
  'frozen/sounds/Sound'
], function(dcl, ResourceManager, Sound){

  'use strict';

  describe('ResourceManager', function(){
    var rm;

    beforeEach(function(){
      rm = new ResourceManager();
    });

    afterEach(function(){
      for(var res in rm.resourceList){
        delete rm.resourceList[res];
      }
    });

    it('should default to allLoaded as false', function(){
      expect(rm.allLoaded).toBe(false);
    });

    it('should not have an imageDir as default', function(){
      expect(rm.imageDir).toBeNull();
    });

    it('should not have a soundDir as default', function(){
      expect(rm.soundDir).toBeNull();
    });

    // TODO: deal with async issues and shared resourceList
    xit('should have an empty resourceList as default', function(){
      expect(rm.resourceList).toEqual({});
    });

    // TODO: should these be split out into their own tests?
    it('should have functions defined', function(){
      expect(rm.loadImage).toBeDefined();
      expect(rm.loadSound).toBeDefined();
      expect(rm.flipImage).toBeDefined();
      expect(rm.flipImageX).toBeDefined();
      expect(rm.flipImageY).toBeDefined();
      expect(rm.resourcesReady).toBeDefined();
      expect(rm.getPercentComplete).toBeDefined();
    });

    it('should share the resourceList between ResourceManager instances', function(){
      var rm2 = new ResourceManager();

      expect(rm.resourceList).toBe(rm2.resourceList);
    });

    describe('ResourceManager.loadImage()', function(){
      var image;

      beforeEach(function(){
        image = rm.loadImage('specs/fixtures/luis_gangnam.jpg');
      });

      it('should take a string filename and return a single image', function(){
        var origin = window.location.toString().replace(window.location.pathname, '');
        expect(image instanceof Image).toBe(true);
        expect(image.src).toEqual(origin + '/specs/fixtures/luis_gangnam.jpg');
      });

      it('should take an array of filenames and return an array of images', function(){
        var filenames = [
          'specs/fixtures/luis_gangnam.jpg',
          'specs/fixtures/luis_gangnam.jpg',
          'specs/fixtures/luis_gangnam.jpg'
        ];
        var images = rm.loadImage(filenames);

        expect(Array.isArray(images)).toBe(true);
        expect(images.length).toBe(3);
        images.forEach(function(image){
          expect(image instanceof Image).toBe(true);
        });
      });

      it('should take an object of filenames and return an object of images mapped to the same keys', function(){
        var filenames = {
          file1: 'specs/fixtures/luis_gangnam.jpg',
          file2: 'specs/fixtures/luis_gangnam.jpg',
          file3: 'specs/fixtures/luis_gangnam.jpg'
        };
        var images = rm.loadImage(filenames);

        expect(images).toBeDefined();
        expect(images).not.toBeNull();
        Object.keys(filenames).forEach(function(filename){
          expect(Object.keys(images)).toContain(filename);
        });
        for(var key in images){
          var image = images[key];
          expect(image instanceof Image).toBe(true);
        }
      });

      it('should mark allLoaded as false when called', function(){
        expect(rm.allLoaded).toBe(false);

        rm.allLoaded = true;
        rm.resourceList = {};

        expect(rm.allLoaded).toBe(true);

        var image = rm.loadImage('specs/fixtures/luis_gangnam.jpg');

        expect(rm.allLoaded).toBe(false);
      });

      it('should not mark allLoaded as false when called but resource is already cached', function(){
        expect(rm.allLoaded).toBe(false);

        rm.allLoaded = true;

        expect(rm.allLoaded).toBe(true);

        var image = rm.loadImage('specs/fixtures/luis_gangnam.jpg');

        expect(rm.allLoaded).toBe(true);
      });

      it('should add the image into resourceList', function(){
        expect(rm.resourceList['specs/fixtures/luis_gangnam.jpg']).toBeDefined();
        expect(rm.resourceList['specs/fixtures/luis_gangnam.jpg'].img).toBe(image);
      });

      it('should mark image as complete when finished loading', function(){
        waitsFor(function(){
          return rm.resourceList['specs/fixtures/luis_gangnam.jpg'].complete;
        }, 'should have complete downloading and flagged as complete', 500); // TODO: might need to change timeout if image loads slow
      });

    });

    // Only use these tests in browsers, PhantomJS blows up due to no HTML5 Audio support
    describe('ResourceManager.loadSound()', function(){
      var sound;

      beforeEach(function(){
        sound = rm.loadSound('specs/fixtures/yipee.wav');
      });

      it('should take a string filename and return a single sound', function(){
        var origin = window.location.toString().replace(window.location.pathname, '');
        expect(dcl.isInstanceOf(sound, Sound)).toBe(true);
      });

      it('should take an array of filenames and return an array of sounds', function(){
        var filenames = [
          'specs/fixtures/yipee.wav',
          'specs/fixtures/yipee.wav',
          'specs/fixtures/yipee.wav'
        ];
        var sounds = rm.loadSound(filenames);

        expect(Array.isArray(sounds)).toBe(true);
        expect(sounds.length).toBe(3);
        sounds.forEach(function(sound){
          expect(dcl.isInstanceOf(sound, Sound)).toBe(true);
        });
      });

      it('should take an object of filenames and return an object of sounds mapped to the same keys', function(){
        var filenames = {
          file1: 'specs/fixtures/yipee.wav',
          file2: 'specs/fixtures/yipee.wav',
          file3: 'specs/fixtures/yipee.wav'
        };
        var sounds = rm.loadSound(filenames);

        expect(sounds).toBeDefined();
        expect(sounds).not.toBeNull();
        Object.keys(filenames).forEach(function(filename){
          expect(Object.keys(sounds)).toContain(filename);
        });
        for(var key in sounds){
          var sound = sounds[key];
          expect(dcl.isInstanceOf(sound, Sound)).toBe(true);
        }
      });

      it('should mark allLoaded as false when called', function(){
        expect(rm.allLoaded).toBe(false);

        rm.allLoaded = true;
        rm.resourceList = {};

        expect(rm.allLoaded).toBe(true);

        var sound = rm.loadSound('specs/fixtures/yipee.wav');

        expect(rm.allLoaded).toBe(false);
      });

      it('should not mark allLoaded as false when called but resource is already cached', function(){
        expect(rm.allLoaded).toBe(false);

        rm.allLoaded = true;

        expect(rm.allLoaded).toBe(true);

        var sound = rm.loadSound('specs/fixtures/yipee.wav');

        expect(rm.allLoaded).toBe(true);
      });

      it('should add the sound into resourceList', function(){
        expect(rm.resourceList['specs/fixtures/yipee.wav']).toBeDefined();
      });

      it('should mark sound as complete when finished loading', function(){
        waitsFor(function(){
          return rm.resourceList['specs/fixtures/yipee.wav'].complete;
        }, 'should have complete downloading and flagged as complete', 500); // TODO: might need to change timeout if image loads slow
      });

    });

    describe('ResourceManager.flipImage()', function(){
      var image;
      var imgUrl = 'specs/fixtures/flipXY.png';
      var canvas;
      var ctx;
      var flipped;

      function customFlip(image){
        var offscreenCanvas = document.createElement('canvas');
        offscreenCanvas.height = image.height;
        offscreenCanvas.width = image.width;
        var ctx = offscreenCanvas.getContext('2d');

        ctx.translate(offscreenCanvas.width, offscreenCanvas.height);
        ctx.scale(-1, -1);
        ctx.drawImage(image, 0, 0);
        return offscreenCanvas.toDataURL();
      }

      beforeEach(function(){
        image = rm.loadImage(imgUrl);
        canvas = document.createElement('canvas');
        ctx = canvas.getContext('2d');
        flipped = rm.flipImage('flippedXY', image, customFlip);
      });

      afterEach(function(){
        canvas = null;
      });

      it('should cache the flipped image in the resourceList with the named passed in', function(){
        expect(rm.resourceList.flippedXY).toBeDefined();
      });

      it('should mark the flipped image as complete when finished flipping', function(){
        waitsFor(function(){
          return rm.resourceList.flippedXY.complete;
        }, 'should have flipped the image', 500);
      });

      it('should take a custom function and return the flipped image', function(){
        waitsFor(function(){
          return rm.resourceList.flippedXY.complete;
        }, 'should have flipped the image', 500);

        runs(function(){
          ctx.drawImage(flipped, 0, 0);
          var pixel = ctx.getImageData(0, 0, 1, 1);
          var r = pixel.data[0];
          var g = pixel.data[1];
          var b = pixel.data[2];
          var a = pixel.data[3];
          expect(r).toBe(0);
          expect(g).toBe(0);
          expect(b).toBe(0);
          expect(a).toBe(255);
        });
      });
    });

    describe('ResourceManager.flipImageX()', function(){
      var image;
      var imgUrl = 'specs/fixtures/flipX.png';
      var canvas;
      var ctx;
      var flipped;

      beforeEach(function(){
        image = rm.loadImage(imgUrl);
        canvas = document.createElement('canvas');
        ctx = canvas.getContext('2d');
        flipped = rm.flipImageX('flippedX', image);
      });

      afterEach(function(){
        canvas = null;
      });

      it('should cache the flipped image in the resourceList with the named passed in', function(){
        expect(rm.resourceList.flippedX).toBeDefined();
      });

      it('should mark the flipped image as complete when finished flipping', function(){
        waitsFor(function(){
          return rm.resourceList.flippedX.complete;
        }, 'should have flipped the image', 500);
      });

      it('should take a custom function and return the flipped image', function(){
        waitsFor(function(){
          return rm.resourceList.flippedX.complete;
        }, 'should have flipped the image', 500);

        runs(function(){
          ctx.drawImage(flipped, 0, 0);
          var pixel = ctx.getImageData(0, 0, 1, 1);
          var r = pixel.data[0];
          var g = pixel.data[1];
          var b = pixel.data[2];
          var a = pixel.data[3];
          expect(r).toBe(0);
          expect(g).toBe(0);
          expect(b).toBe(0);
          expect(a).toBe(255);
        });
      });
    });

    describe('ResourceManager.flipImageY()', function(){
      var image;
      var imgUrl = 'specs/fixtures/flipY.png';
      var canvas;
      var ctx;
      var flipped;

      beforeEach(function(){
        image = rm.loadImage(imgUrl);
        canvas = document.createElement('canvas');
        ctx = canvas.getContext('2d');
        flipped = rm.flipImageY('flippedY', image);
      });

      afterEach(function(){
        canvas = null;
      });

      it('should cache the flipped image in the resourceList with the named passed in', function(){
        expect(rm.resourceList.flippedY).toBeDefined();
      });

      it('should mark the flipped image as complete when finished flipping', function(){
        waitsFor(function(){
          return rm.resourceList.flippedY.complete;
        }, 'should have flipped the image', 500);
      });

      it('should take a custom function and return the flipped image', function(){
        waitsFor(function(){
          return rm.resourceList.flippedY.complete;
        }, 'should have flipped the image', 500);

        runs(function(){
          ctx.drawImage(flipped, 0, 0);
          var pixel = ctx.getImageData(0, 0, 1, 1);
          var r = pixel.data[0];
          var g = pixel.data[1];
          var b = pixel.data[2];
          var a = pixel.data[3];
          expect(r).toBe(0);
          expect(g).toBe(0);
          expect(b).toBe(0);
          expect(a).toBe(255);
        });
      });
    });

    describe('ResourceManager.resourcesReady()', function(){

      it('should return true if no resources are loaded', function(){
        var ready = rm.resourcesReady();

        expect(ready).toBe(true);
      });

      it('should return false if a resource is not complete', function(){
        rm.resourceList.mock = {
          complete: false
        };

        var ready = rm.resourcesReady();

        expect(ready).toBe(false);

        rm.resourceList.mock.complete = true;
      });

      it('should return true if all resources are complete', function(){
        rm.resourceList.mock = {
          complete: true
        };

        var ready = rm.resourcesReady();

        expect(ready).toBe(true);
      });

    });

    describe('ResourceManager.getPercentComplete()', function(){

      it('should return the percent of complete resources', function(){
        rm.resourceList = {
          mock: {
            complete: true
          },
          mock2: {
            complete: false
          }
        };

        var percent = rm.getPercentComplete();

        expect(percent).toEqual(50);
      });

      it('should return 0 if no resources exist in cache', function(){
        rm.resourceList = {};

        var percent = rm.getPercentComplete();

        expect(percent).toEqual(0);
      });

    });

  });

});


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<title>Source: src/input/Key.js · Phaser CE</title>

	<link type="text/css" rel="stylesheet" href="styles/default.css">

	<link type="text/css" rel="stylesheet" href="styles/sunlight.default.css">

	<link type="text/css" rel="stylesheet" href="styles/site.cerulean.css">

			Phaser API

						Read Me

						Change Log

					Namespaces

							Phaser

							PIXI

					Classes

							CreatureShader

							EarCut

							Event

							EventTarget

							Animation

							AnimationManager

							AnimationParser

							ArraySet

							ArrayUtils

							AudioSprite

							BitmapData

							BitmapText

							Bullet

							Button

							Cache

							Camera

							Canvas

							CanvasPool

							Circle

							Color

							Angle

							Animation

							AutoCull

							Bounds

							BringToTop

							Core

							Crop

							Delta

							Destroy

							FixedToCamera

							Health

							InCamera

							InputEnabled

							InWorld

							LifeSpan

							LoadTexture

							Overlap

							PhysicsBody

							Reset

							ScaleMinMax

							Smoothed

							Create

							Creature

							Device

							DeviceButton

							DOM

							Easing

							Back

							Bounce

							Circular

							Cubic

							Elastic

							Exponential

							Linear

							Quadratic

							Quartic

							Quintic

							Sinusoidal

							Ellipse

							Events

							Filter

							FlexGrid

							FlexLayer

							Frame

							FrameData

							Game

							GameObjectCreator

							GameObjectFactory

							Gamepad

							Graphics

							Group

							Hermite

							Image

							ImageCollection

							Input

							InputHandler

							Key

							Keyboard

							KeyCode

							Line

							LinkedList

							Loader

							LoaderParser

							Math

							Matrix

							Mouse

							MSPointer

							Net

							Particle

							Particles

							Arcade

							Emitter

							Path

							PathFollower

							PathPoint

							Physics

							Arcade

							Body

							TilemapCollision

							Ninja

							AABB

							Body

							Circle

							Tile

							P2

							Body

							BodyDebug

							CollisionGroup

							ContactMaterial

							DistanceConstraint

							FixtureList

							GearConstraint

							InversePointProxy

							LockConstraint

							Material

							PointProxy

							PrismaticConstraint

							RevoluteConstraint

							RotationalSpring

							Spring

							Plugin

							AStar

							AStarNode

							AStarPath

							ColorHarmony

							CSS3Filters

							Juicy

							ScreenFlash

							Trail

							KineticScrolling

							PathManager

							SamplePlugin

							TilemapWalker

							VirtualJoystick

							Webcam

							PluginManager

							Point

							Pointer

							PointerMode

							Polygon

							QuadTree

							RandomDataGenerator

							Rectangle

							RenderTexture

							RequestAnimationFrame

							RetroFont

							Rope

							RoundedRectangle

							ScaleManager

							Signal

							SignalBinding

							SinglePad

							Sound

							SoundManager

							Sprite

							SpriteBatch

							Stage

							State

							StateManager

							Text

							Tile

							Tilemap

							TilemapLayer

							TilemapParser

							Tileset

							TileSprite

							Time

							Timer

							TimerEvent

							Touch

							Tween

							TweenData

							TweenManager

							Utils

							Debug

							Video

							Weapon

							World

							BaseTexture

							CanvasBuffer

							CanvasGraphics

							CanvasMaskManager

							CanvasRenderer

							CanvasTinter

							ComplexPrimitiveShader

							DisplayObject

							DisplayObjectContainer

							FilterTexture

							Phaser.GraphicsData

							PIXI

							PixiFastShader

							PixiShader

							PrimitiveShader

							Sprite

							StripShader

							Texture

							WebGLBlendModeManager

							WebGLFastSpriteBatch

							WebGLFilterManager

							WebGLRenderer

					Global

							destroy

							init

							set

					Core

Game

Group

World

Loader

Cache

Time

Camera

State Manager

Tween Manager

Sound Manager

Input Manager

Scale Manager

					Game Objects

Factory (game.add)

Creator (game.make)

Sprite

Image

Sound

Video

Particle Emitter

Particle

Text

Tween

BitmapText

Tilemap

BitmapData

RetroFont

Button

Animation

Graphics

RenderTexture

TileSprite

					Geometry

Circle

Ellipse

Line

Matrix

Point

Polygon

Rectangle

Rounded Rectangle

					Physics

Arcade Physics

Body

Weapon

P2 Physics

Body

Spring

CollisionGroup

ContactMaterial

Ninja Physics

Body

					Input

Input Handler

Pointer

Device Button

Mouse

Keyboard

Key

Key Codes

Gamepad

					 Community

Phaser Web Site

Phaser CE Github

Phaser Examples

Phaser Plugins

Forum

Stack Overflow

Tutorials

Newsletter

Twitter

Slack

Donate

Texture Packer

Source: src/input/Key.js

/**
* If you need more fine-grained control over the handling of specific keys you can create and use Phaser.Key objects.
*
* @class Phaser.Key
* @constructor
* @param {Phaser.Game} game - Current game instance.
* @param {integer} keycode - The key code this Key is responsible for. See {@link Phaser.KeyCode}.
*/
Phaser.Key = function (game, keycode) {

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

    /**
    * The enabled state of the key - see `enabled`.
    * @property {boolean} _enabled
    * @private
    */
    this._enabled = true;

    /**
    * @property {object} event - Stores the most recent DOM event.
    * @readonly
    */
    this.event = null;

    /**
    * @property {boolean} isDown - The "down" state of the key. This will remain `true` for as long as the keyboard thinks this key is held down.
    * @default
    */
    this.isDown = false;

    /**
    * @property {boolean} isUp - The "up" state of the key. This will remain `true` for as long as the keyboard thinks this key is up.
    * @default
    */
    this.isUp = true;

    /**
    * @property {boolean} altKey - The down state of the ALT key, if pressed at the same time as this key.
    * @default
    */
    this.altKey = false;

    /**
    * @property {boolean} ctrlKey - The down state of the CTRL key, if pressed at the same time as this key.
    * @default
    */
    this.ctrlKey = false;

    /**
    * @property {boolean} shiftKey - The down state of the SHIFT key, if pressed at the same time as this key.
    * @default
    */
    this.shiftKey = false;

    /**
    * @property {number} timeDown - The timestamp when the key was last pressed down. This is based on Game.time.now.
    */
    this.timeDown = 0;

    /**
    * If the key is down this value holds the duration of that key press and is constantly updated.
    * If the key is up it holds the duration of the previous down session.
    * @property {number} duration - The number of milliseconds this key has been held down for.
    * @default
    */
    this.duration = 0;

    /**
    * @property {number} timeUp - The timestamp when the key was last released. This is based on Game.time.now.
    * @default
    */
    this.timeUp = -2500;

    /**
    * If the key is up this value holds the duration of that key release and is constantly updated.
    * If the key is down it holds the duration of the previous up session.
    * @property {number} duration - The number of milliseconds this key has been up for.
    * @default
    */
    this.durationUp = -2500;

    /**
    * @property {number} repeats - If a key is held down this holds down the number of times the key has 'repeated'.
    * @default
    */
    this.repeats = 0;

    /**
    * @property {number} keyCode - The keycode of this key.
    */
    this.keyCode = keycode;

    /**
    * @property {Phaser.Signal} onDown - This Signal is dispatched every time this Key is pressed down. It is only dispatched once (until the key is released again).
    */
    this.onDown = new Phaser.Signal();

    /**
    * @property {function} onHoldCallback - A callback that is called while this Key is held down. Warning: Depending on refresh rate that could be 60+ times per second.
    */
    this.onHoldCallback = null;

    /**
    * @property {object} onHoldContext - The context under which the onHoldCallback will be called.
    */
    this.onHoldContext = null;

    /**
    * @property {Phaser.Signal} onUp - This Signal is dispatched every time this Key is released. It is only dispatched once (until the key is pressed and released again).
    */
    this.onUp = new Phaser.Signal();

    /**
     * @property {boolean} _justDown - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
     * @private
     */
    this._justDown = false;

    /**
     * @property {boolean} _justUp - True if the key has just been pressed (NOTE: requires to be reset, see justDown getter)
     * @private
     */
    this._justUp = false;

};

Phaser.Key.prototype = {

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

        if (!this._enabled) { return; }

        if (this.isDown)
        {
            this.duration = this.game.time.time - this.timeDown;
            this.repeats++;

            if (this.onHoldCallback)
            {
                this.onHoldCallback.call(this.onHoldContext, this);
            }
        }
        else
        {
            this.durationUp = this.game.time.time - this.timeUp;
        }

    },

    /**
    * Called automatically by Phaser.Keyboard.
    *
    * @method Phaser.Key#processKeyDown
    * @param {KeyboardEvent} event - The DOM event that triggered this.
    * @protected
    */
    processKeyDown: function (event) {

        if (!this._enabled) { return; }

        this.event = event;

        // exit if this key down is from auto-repeat
        if (this.isDown)
        {
            return;
        }

        this.altKey = event.altKey;
        this.ctrlKey = event.ctrlKey;
        this.shiftKey = event.shiftKey;

        this.isDown = true;
        this.isUp = false;
        this.timeDown = this.game.time.time;
        this.duration = 0;
        this.durationUp = this.game.time.time - this.timeUp;
        this.repeats = 0;

        // _justDown will remain true until it is read via the justDown Getter
        // this enables the game to poll for past presses, or reset it at the start of a new game state
        this._justDown = true;

        this.onDown.dispatch(this);

    },

    /**
    * Called automatically by Phaser.Keyboard.
    *
    * @method Phaser.Key#processKeyUp
    * @param {KeyboardEvent} event - The DOM event that triggered this.
    * @protected
    */
    processKeyUp: function (event) {

        if (!this._enabled) { return; }

        this.event = event;

        if (this.isUp)
        {
            return;
        }

        this.isDown = false;
        this.isUp = true;
        this.timeUp = this.game.time.time;
        this.duration = this.game.time.time - this.timeDown;
        this.durationUp = 0;

        // _justUp will remain true until it is read via the justUp Getter
        // this enables the game to poll for past presses, or reset it at the start of a new game state
        this._justUp = true;

        this.onUp.dispatch(this);

    },

    /**
    * Resets the state of this Key.
    *
    * This sets isDown to false, isUp to true, resets the time to be the current time, and _enables_ the key.
    * In addition, if it is a "hard reset", it clears clears any callbacks associated with the onDown and onUp events and removes the onHoldCallback.
    *
    * @method Phaser.Key#reset
    * @param {boolean} [hard=true] - A soft reset won't reset any events or callbacks; a hard reset will.
    */
    reset: function (hard) {

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

        this.isDown = false;
        this.isUp = true;
        this.timeUp = this.game.time.time;
        this.duration = 0;
        this.durationUp = -2500;
        this._enabled = true; // .enabled causes reset(false)
        this._justDown = false;
        this._justUp = false;

        if (hard)
        {
            this.onDown.removeAll();
            this.onUp.removeAll();
            this.onHoldCallback = null;
            this.onHoldContext = null;
        }

    },

    /**
    * Returns `true` if the Key was pressed down within the `duration` value given, or `false` if it either isn't down,
    * or was pressed down longer ago than then given duration.
    *
    * @method Phaser.Key#downDuration
    * @param {number} [duration=50] - The duration within which the key is considered as being just pressed. Given in ms.
    * @return {boolean} True if the key was pressed down within the given duration.
    */
    downDuration: function (duration) {

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

        return (this.isDown && this.duration < duration);

    },

    /**
    * Returns `true` if the Key was pressed down within the `duration` value given, or `false` if it either isn't down,
    * or was pressed down longer ago than then given duration.
    *
    * @method Phaser.Key#upDuration
    * @param {number} [duration=50] - The duration within which the key is considered as being just released. Given in ms.
    * @return {boolean} True if the key was released within the given duration.
    */
    upDuration: function (duration) {

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

        return (!this.isDown && ((this.game.time.time - this.timeUp) < duration));

    },

    /**
    * Returns `true` if the Key was just pressed down this update tick, or `false` if it either isn't down,
    * or was pressed down on a previous update tick.
    *
    * @method Phaser.Key#justPressed
    * @return {boolean} True if the key was just pressed down this update tick.
    */
    justPressed: function () {

        return (this.isDown && this.duration === 0);

    },

    /**
    * Returns `true` if the Key was just released this update tick, or `false` if it either isn't up,
    * or was released on a previous update tick.
    *
    * @method Phaser.Key#justReleased
    * @return {boolean} True if the key was just released this update tick.
    */
    justReleased: function () {

        return (!this.isDown && this.durationUp === 0);

    }

};

/**
* The justDown value allows you to test if this Key has just been pressed down or not.
* When you check this value it will return `true` if the Key is down, otherwise `false`.
* You can only call justDown once per key press. It will only return `true` once, until the Key is released and pressed down again.
* This allows you to use it in situations where you want to check if this key is down without using a Signal, such as in a core game loop.
*
* @name Phaser.Key#justDown
* @property {boolean} justDown
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justDown", {

    get: function () {

        var current = this._justDown;
        this._justDown = false;
        return current;

    }

});

/**
* The justUp value allows you to test if this Key has just been released or not.
* When you check this value it will return `true` if the Key is up, otherwise `false`.
* You can only call justUp once per key release. It will only return `true` once, until the Key is pressed down and released again.
* This allows you to use it in situations where you want to check if this key is up without using a Signal, such as in a core game loop.
*
* @name Phaser.Key#justUp
* @property {boolean} justUp
* @memberof Phaser.Key
* @default false
*/
Object.defineProperty(Phaser.Key.prototype, "justUp", {

    get: function () {

        var current = this._justUp;
        this._justUp = false;
        return current;

    }

});

/**
* An enabled key processes its update and dispatches events.
* A key can be disabled momentarily at runtime instead of deleting it.
* @name Phaser.Key#enabled
* @property {boolean} enabled
* @memberof Phaser.Key
* @default true
*/
Object.defineProperty(Phaser.Key.prototype, "enabled", {

    get: function () {

        return this._enabled;

    },

    set: function (value) {

        value = !!value;

        if (value !== this._enabled)
        {
            if (!value)
            {
                this.reset(false);
            }

            this._enabled = value;
        }
    }

});

Phaser.Key.prototype.constructor = Phaser.Key;

		Phaser Copyright © 2012-2016 Photon Storm Ltd.

		Documentation generated by JSDoc 3.4.3
		on Tue Jun 20 2017 19:07:38 GMT-0700 (PDT) using the DocStrap template.

redpajama_set_name: RedPajamaGithub


text:
package com.amazonaws.services.mediaconvert.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * These settings apply to a specific graphic overlay. You can include multiple overlays in your job.
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class InsertableImage implements Serializable, Cloneable, StructuredPojo {

    /**
     * Specify the time, in milliseconds, for the image to remain on the output video. This duration includes fade-in
     * time but not fade-out time.
     */
    private Integer duration;
    /**
     * Specify the length of time, in milliseconds, between the Start time that you specify for the image insertion and
     * the time that the image appears at full opacity. Full opacity is the level that you specify for the opacity
     * setting. If you don't specify a value for Fade-in, the image will appear abruptly at the overlay start time.
     */
    private Integer fadeIn;
    /**
     * Specify the length of time, in milliseconds, between the end of the time that you have specified for the image
     * overlay Duration and when the overlaid image has faded to total transparency. If you don't specify a value for
     * Fade-out, the image will disappear abruptly at the end of the inserted image duration.
     */
    private Integer fadeOut;
    /**
     * Specify the height of the inserted image in pixels. If you specify a value that's larger than the video
     * resolution height, the service will crop your overlaid image to fit. To use the native height of the image, keep
     * this setting blank.
     */
    private Integer height;
    /**
     * Specify the HTTP, HTTPS, or Amazon S3 location of the image that you want to overlay on the video. Use a PNG or
     * TGA file.
     */
    private String imageInserterInput;
    /**
     * Specify the distance, in pixels, between the inserted image and the left edge of the video frame. Required for
     * any image overlay that you specify.
     */
    private Integer imageX;
    /**
     * Specify the distance, in pixels, between the overlaid image and the top edge of the video frame. Required for any
     * image overlay that you specify.
     */
    private Integer imageY;
    /**
     * Specify how overlapping inserted images appear. Images with higher values for Layer appear on top of images with
     * lower values for Layer.
     */
    private Integer layer;
    /**
     * Use Opacity (Opacity) to specify how much of the underlying video shows through the inserted image. 0 is
     * transparent and 100 is fully opaque. Default is 50.
     */
    private Integer opacity;
    /**
     * Specify the timecode of the frame that you want the overlay to first appear on. This must be in timecode
     * (HH:MM:SS:FF or HH:MM:SS;FF) format. Remember to take into account your timecode source settings.
     */
    private String startTime;
    /**
     * Specify the width of the inserted image in pixels. If you specify a value that's larger than the video resolution
     * width, the service will crop your overlaid image to fit. To use the native width of the image, keep this setting
     * blank.
     */
    private Integer width;

    /**
     * Specify the time, in milliseconds, for the image to remain on the output video. This duration includes fade-in
     * time but not fade-out time.
     *
     * @param duration
     *        Specify the time, in milliseconds, for the image to remain on the output video. This duration includes
     *        fade-in time but not fade-out time.
     */

    public void setDuration(Integer duration) {
        this.duration = duration;
    }

    /**
     * Specify the time, in milliseconds, for the image to remain on the output video. This duration includes fade-in
     * time but not fade-out time.
     *
     * @return Specify the time, in milliseconds, for the image to remain on the output video. This duration includes
     *         fade-in time but not fade-out time.
     */

    public Integer getDuration() {
        return this.duration;
    }

    /**
     * Specify the time, in milliseconds, for the image to remain on the output video. This duration includes fade-in
     * time but not fade-out time.
     *
     * @param duration
     *        Specify the time, in milliseconds, for the image to remain on the output video. This duration includes
     *        fade-in time but not fade-out time.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withDuration(Integer duration) {
        setDuration(duration);
        return this;
    }

    /**
     * Specify the length of time, in milliseconds, between the Start time that you specify for the image insertion and
     * the time that the image appears at full opacity. Full opacity is the level that you specify for the opacity
     * setting. If you don't specify a value for Fade-in, the image will appear abruptly at the overlay start time.
     *
     * @param fadeIn
     *        Specify the length of time, in milliseconds, between the Start time that you specify for the image
     *        insertion and the time that the image appears at full opacity. Full opacity is the level that you specify
     *        for the opacity setting. If you don't specify a value for Fade-in, the image will appear abruptly at the
     *        overlay start time.
     */

    public void setFadeIn(Integer fadeIn) {
        this.fadeIn = fadeIn;
    }

    /**
     * Specify the length of time, in milliseconds, between the Start time that you specify for the image insertion and
     * the time that the image appears at full opacity. Full opacity is the level that you specify for the opacity
     * setting. If you don't specify a value for Fade-in, the image will appear abruptly at the overlay start time.
     *
     * @return Specify the length of time, in milliseconds, between the Start time that you specify for the image
     *         insertion and the time that the image appears at full opacity. Full opacity is the level that you specify
     *         for the opacity setting. If you don't specify a value for Fade-in, the image will appear abruptly at the
     *         overlay start time.
     */

    public Integer getFadeIn() {
        return this.fadeIn;
    }

    /**
     * Specify the length of time, in milliseconds, between the Start time that you specify for the image insertion and
     * the time that the image appears at full opacity. Full opacity is the level that you specify for the opacity
     * setting. If you don't specify a value for Fade-in, the image will appear abruptly at the overlay start time.
     *
     * @param fadeIn
     *        Specify the length of time, in milliseconds, between the Start time that you specify for the image
     *        insertion and the time that the image appears at full opacity. Full opacity is the level that you specify
     *        for the opacity setting. If you don't specify a value for Fade-in, the image will appear abruptly at the
     *        overlay start time.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withFadeIn(Integer fadeIn) {
        setFadeIn(fadeIn);
        return this;
    }

    /**
     * Specify the length of time, in milliseconds, between the end of the time that you have specified for the image
     * overlay Duration and when the overlaid image has faded to total transparency. If you don't specify a value for
     * Fade-out, the image will disappear abruptly at the end of the inserted image duration.
     *
     * @param fadeOut
     *        Specify the length of time, in milliseconds, between the end of the time that you have specified for the
     *        image overlay Duration and when the overlaid image has faded to total transparency. If you don't specify a
     *        value for Fade-out, the image will disappear abruptly at the end of the inserted image duration.
     */

    public void setFadeOut(Integer fadeOut) {
        this.fadeOut = fadeOut;
    }

    /**
     * Specify the length of time, in milliseconds, between the end of the time that you have specified for the image
     * overlay Duration and when the overlaid image has faded to total transparency. If you don't specify a value for
     * Fade-out, the image will disappear abruptly at the end of the inserted image duration.
     *
     * @return Specify the length of time, in milliseconds, between the end of the time that you have specified for the
     *         image overlay Duration and when the overlaid image has faded to total transparency. If you don't specify
     *         a value for Fade-out, the image will disappear abruptly at the end of the inserted image duration.
     */

    public Integer getFadeOut() {
        return this.fadeOut;
    }

    /**
     * Specify the length of time, in milliseconds, between the end of the time that you have specified for the image
     * overlay Duration and when the overlaid image has faded to total transparency. If you don't specify a value for
     * Fade-out, the image will disappear abruptly at the end of the inserted image duration.
     *
     * @param fadeOut
     *        Specify the length of time, in milliseconds, between the end of the time that you have specified for the
     *        image overlay Duration and when the overlaid image has faded to total transparency. If you don't specify a
     *        value for Fade-out, the image will disappear abruptly at the end of the inserted image duration.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withFadeOut(Integer fadeOut) {
        setFadeOut(fadeOut);
        return this;
    }

    /**
     * Specify the height of the inserted image in pixels. If you specify a value that's larger than the video
     * resolution height, the service will crop your overlaid image to fit. To use the native height of the image, keep
     * this setting blank.
     *
     * @param height
     *        Specify the height of the inserted image in pixels. If you specify a value that's larger than the video
     *        resolution height, the service will crop your overlaid image to fit. To use the native height of the
     *        image, keep this setting blank.
     */

    public void setHeight(Integer height) {
        this.height = height;
    }

    /**
     * Specify the height of the inserted image in pixels. If you specify a value that's larger than the video
     * resolution height, the service will crop your overlaid image to fit. To use the native height of the image, keep
     * this setting blank.
     *
     * @return Specify the height of the inserted image in pixels. If you specify a value that's larger than the video
     *         resolution height, the service will crop your overlaid image to fit. To use the native height of the
     *         image, keep this setting blank.
     */

    public Integer getHeight() {
        return this.height;
    }

    /**
     * Specify the height of the inserted image in pixels. If you specify a value that's larger than the video
     * resolution height, the service will crop your overlaid image to fit. To use the native height of the image, keep
     * this setting blank.
     *
     * @param height
     *        Specify the height of the inserted image in pixels. If you specify a value that's larger than the video
     *        resolution height, the service will crop your overlaid image to fit. To use the native height of the
     *        image, keep this setting blank.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withHeight(Integer height) {
        setHeight(height);
        return this;
    }

    /**
     * Specify the HTTP, HTTPS, or Amazon S3 location of the image that you want to overlay on the video. Use a PNG or
     * TGA file.
     *
     * @param imageInserterInput
     *        Specify the HTTP, HTTPS, or Amazon S3 location of the image that you want to overlay on the video. Use a
     *        PNG or TGA file.
     */

    public void setImageInserterInput(String imageInserterInput) {
        this.imageInserterInput = imageInserterInput;
    }

    /**
     * Specify the HTTP, HTTPS, or Amazon S3 location of the image that you want to overlay on the video. Use a PNG or
     * TGA file.
     *
     * @return Specify the HTTP, HTTPS, or Amazon S3 location of the image that you want to overlay on the video. Use a
     *         PNG or TGA file.
     */

    public String getImageInserterInput() {
        return this.imageInserterInput;
    }

    /**
     * Specify the HTTP, HTTPS, or Amazon S3 location of the image that you want to overlay on the video. Use a PNG or
     * TGA file.
     *
     * @param imageInserterInput
     *        Specify the HTTP, HTTPS, or Amazon S3 location of the image that you want to overlay on the video. Use a
     *        PNG or TGA file.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withImageInserterInput(String imageInserterInput) {
        setImageInserterInput(imageInserterInput);
        return this;
    }

    /**
     * Specify the distance, in pixels, between the inserted image and the left edge of the video frame. Required for
     * any image overlay that you specify.
     *
     * @param imageX
     *        Specify the distance, in pixels, between the inserted image and the left edge of the video frame. Required
     *        for any image overlay that you specify.
     */

    public void setImageX(Integer imageX) {
        this.imageX = imageX;
    }

    /**
     * Specify the distance, in pixels, between the inserted image and the left edge of the video frame. Required for
     * any image overlay that you specify.
     *
     * @return Specify the distance, in pixels, between the inserted image and the left edge of the video frame.
     *         Required for any image overlay that you specify.
     */

    public Integer getImageX() {
        return this.imageX;
    }

    /**
     * Specify the distance, in pixels, between the inserted image and the left edge of the video frame. Required for
     * any image overlay that you specify.
     *
     * @param imageX
     *        Specify the distance, in pixels, between the inserted image and the left edge of the video frame. Required
     *        for any image overlay that you specify.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withImageX(Integer imageX) {
        setImageX(imageX);
        return this;
    }

    /**
     * Specify the distance, in pixels, between the overlaid image and the top edge of the video frame. Required for any
     * image overlay that you specify.
     *
     * @param imageY
     *        Specify the distance, in pixels, between the overlaid image and the top edge of the video frame. Required
     *        for any image overlay that you specify.
     */

    public void setImageY(Integer imageY) {
        this.imageY = imageY;
    }

    /**
     * Specify the distance, in pixels, between the overlaid image and the top edge of the video frame. Required for any
     * image overlay that you specify.
     *
     * @return Specify the distance, in pixels, between the overlaid image and the top edge of the video frame. Required
     *         for any image overlay that you specify.
     */

    public Integer getImageY() {
        return this.imageY;
    }

    /**
     * Specify the distance, in pixels, between the overlaid image and the top edge of the video frame. Required for any
     * image overlay that you specify.
     *
     * @param imageY
     *        Specify the distance, in pixels, between the overlaid image and the top edge of the video frame. Required
     *        for any image overlay that you specify.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withImageY(Integer imageY) {
        setImageY(imageY);
        return this;
    }

    /**
     * Specify how overlapping inserted images appear. Images with higher values for Layer appear on top of images with
     * lower values for Layer.
     *
     * @param layer
     *        Specify how overlapping inserted images appear. Images with higher values for Layer appear on top of
     *        images with lower values for Layer.
     */

    public void setLayer(Integer layer) {
        this.layer = layer;
    }

    /**
     * Specify how overlapping inserted images appear. Images with higher values for Layer appear on top of images with
     * lower values for Layer.
     *
     * @return Specify how overlapping inserted images appear. Images with higher values for Layer appear on top of
     *         images with lower values for Layer.
     */

    public Integer getLayer() {
        return this.layer;
    }

    /**
     * Specify how overlapping inserted images appear. Images with higher values for Layer appear on top of images with
     * lower values for Layer.
     *
     * @param layer
     *        Specify how overlapping inserted images appear. Images with higher values for Layer appear on top of
     *        images with lower values for Layer.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withLayer(Integer layer) {
        setLayer(layer);
        return this;
    }

    /**
     * Use Opacity (Opacity) to specify how much of the underlying video shows through the inserted image. 0 is
     * transparent and 100 is fully opaque. Default is 50.
     *
     * @param opacity
     *        Use Opacity (Opacity) to specify how much of the underlying video shows through the inserted image. 0 is
     *        transparent and 100 is fully opaque. Default is 50.
     */

    public void setOpacity(Integer opacity) {
        this.opacity = opacity;
    }

    /**
     * Use Opacity (Opacity) to specify how much of the underlying video shows through the inserted image. 0 is
     * transparent and 100 is fully opaque. Default is 50.
     *
     * @return Use Opacity (Opacity) to specify how much of the underlying video shows through the inserted image. 0 is
     *         transparent and 100 is fully opaque. Default is 50.
     */

    public Integer getOpacity() {
        return this.opacity;
    }

    /**
     * Use Opacity (Opacity) to specify how much of the underlying video shows through the inserted image. 0 is
     * transparent and 100 is fully opaque. Default is 50.
     *
     * @param opacity
     *        Use Opacity (Opacity) to specify how much of the underlying video shows through the inserted image. 0 is
     *        transparent and 100 is fully opaque. Default is 50.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withOpacity(Integer opacity) {
        setOpacity(opacity);
        return this;
    }

    /**
     * Specify the timecode of the frame that you want the overlay to first appear on. This must be in timecode
     * (HH:MM:SS:FF or HH:MM:SS;FF) format. Remember to take into account your timecode source settings.
     *
     * @param startTime
     *        Specify the timecode of the frame that you want the overlay to first appear on. This must be in timecode
     *        (HH:MM:SS:FF or HH:MM:SS;FF) format. Remember to take into account your timecode source settings.
     */

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    /**
     * Specify the timecode of the frame that you want the overlay to first appear on. This must be in timecode
     * (HH:MM:SS:FF or HH:MM:SS;FF) format. Remember to take into account your timecode source settings.
     *
     * @return Specify the timecode of the frame that you want the overlay to first appear on. This must be in timecode
     *         (HH:MM:SS:FF or HH:MM:SS;FF) format. Remember to take into account your timecode source settings.
     */

    public String getStartTime() {
        return this.startTime;
    }

    /**
     * Specify the timecode of the frame that you want the overlay to first appear on. This must be in timecode
     * (HH:MM:SS:FF or HH:MM:SS;FF) format. Remember to take into account your timecode source settings.
     *
     * @param startTime
     *        Specify the timecode of the frame that you want the overlay to first appear on. This must be in timecode
     *        (HH:MM:SS:FF or HH:MM:SS;FF) format. Remember to take into account your timecode source settings.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withStartTime(String startTime) {
        setStartTime(startTime);
        return this;
    }

    /**
     * Specify the width of the inserted image in pixels. If you specify a value that's larger than the video resolution
     * width, the service will crop your overlaid image to fit. To use the native width of the image, keep this setting
     * blank.
     *
     * @param width
     *        Specify the width of the inserted image in pixels. If you specify a value that's larger than the video
     *        resolution width, the service will crop your overlaid image to fit. To use the native width of the image,
     *        keep this setting blank.
     */

    public void setWidth(Integer width) {
        this.width = width;
    }

    /**
     * Specify the width of the inserted image in pixels. If you specify a value that's larger than the video resolution
     * width, the service will crop your overlaid image to fit. To use the native width of the image, keep this setting
     * blank.
     *
     * @return Specify the width of the inserted image in pixels. If you specify a value that's larger than the video
     *         resolution width, the service will crop your overlaid image to fit. To use the native width of the image,
     *         keep this setting blank.
     */

    public Integer getWidth() {
        return this.width;
    }

    /**
     * Specify the width of the inserted image in pixels. If you specify a value that's larger than the video resolution
     * width, the service will crop your overlaid image to fit. To use the native width of the image, keep this setting
     * blank.
     *
     * @param width
     *        Specify the width of the inserted image in pixels. If you specify a value that's larger than the video
     *        resolution width, the service will crop your overlaid image to fit. To use the native width of the image,
     *        keep this setting blank.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public InsertableImage withWidth(Integer width) {
        setWidth(width);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getDuration() != null)
            sb.append("Duration: ").append(getDuration()).append(",");
        if (getFadeIn() != null)
            sb.append("FadeIn: ").append(getFadeIn()).append(",");
        if (getFadeOut() != null)
            sb.append("FadeOut: ").append(getFadeOut()).append(",");
        if (getHeight() != null)
            sb.append("Height: ").append(getHeight()).append(",");
        if (getImageInserterInput() != null)
            sb.append("ImageInserterInput: ").append(getImageInserterInput()).append(",");
        if (getImageX() != null)
            sb.append("ImageX: ").append(getImageX()).append(",");
        if (getImageY() != null)
            sb.append("ImageY: ").append(getImageY()).append(",");
        if (getLayer() != null)
            sb.append("Layer: ").append(getLayer()).append(",");
        if (getOpacity() != null)
            sb.append("Opacity: ").append(getOpacity()).append(",");
        if (getStartTime() != null)
            sb.append("StartTime: ").append(getStartTime()).append(",");
        if (getWidth() != null)
            sb.append("Width: ").append(getWidth());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof InsertableImage == false)
            return false;
        InsertableImage other = (InsertableImage) obj;
        if (other.getDuration() == null ^ this.getDuration() == null)
            return false;
        if (other.getDuration() != null && other.getDuration().equals(this.getDuration()) == false)
            return false;
        if (other.getFadeIn() == null ^ this.getFadeIn() == null)
            return false;
        if (other.getFadeIn() != null && other.getFadeIn().equals(this.getFadeIn()) == false)
            return false;
        if (other.getFadeOut() == null ^ this.getFadeOut() == null)
            return false;
        if (other.getFadeOut() != null && other.getFadeOut().equals(this.getFadeOut()) == false)
            return false;
        if (other.getHeight() == null ^ this.getHeight() == null)
            return false;
        if (other.getHeight() != null && other.getHeight().equals(this.getHeight()) == false)
            return false;
        if (other.getImageInserterInput() == null ^ this.getImageInserterInput() == null)
            return false;
        if (other.getImageInserterInput() != null && other.getImageInserterInput().equals(this.getImageInserterInput()) == false)
            return false;
        if (other.getImageX() == null ^ this.getImageX() == null)
            return false;
        if (other.getImageX() != null && other.getImageX().equals(this.getImageX()) == false)
            return false;
        if (other.getImageY() == null ^ this.getImageY() == null)
            return false;
        if (other.getImageY() != null && other.getImageY().equals(this.getImageY()) == false)
            return false;
        if (other.getLayer() == null ^ this.getLayer() == null)
            return false;
        if (other.getLayer() != null && other.getLayer().equals(this.getLayer()) == false)
            return false;
        if (other.getOpacity() == null ^ this.getOpacity() == null)
            return false;
        if (other.getOpacity() != null && other.getOpacity().equals(this.getOpacity()) == false)
            return false;
        if (other.getStartTime() == null ^ this.getStartTime() == null)
            return false;
        if (other.getStartTime() != null && other.getStartTime().equals(this.getStartTime()) == false)
            return false;
        if (other.getWidth() == null ^ this.getWidth() == null)
            return false;
        if (other.getWidth() != null && other.getWidth().equals(this.getWidth()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getDuration() == null) ? 0 : getDuration().hashCode());
        hashCode = prime * hashCode + ((getFadeIn() == null) ? 0 : getFadeIn().hashCode());
        hashCode = prime * hashCode + ((getFadeOut() == null) ? 0 : getFadeOut().hashCode());
        hashCode = prime * hashCode + ((getHeight() == null) ? 0 : getHeight().hashCode());
        hashCode = prime * hashCode + ((getImageInserterInput() == null) ? 0 : getImageInserterInput().hashCode());
        hashCode = prime * hashCode + ((getImageX() == null) ? 0 : getImageX().hashCode());
        hashCode = prime * hashCode + ((getImageY() == null) ? 0 : getImageY().hashCode());
        hashCode = prime * hashCode + ((getLayer() == null) ? 0 : getLayer().hashCode());
        hashCode = prime * hashCode + ((getOpacity() == null) ? 0 : getOpacity().hashCode());
        hashCode = prime * hashCode + ((getStartTime() == null) ? 0 : getStartTime().hashCode());
        hashCode = prime * hashCode + ((getWidth() == null) ? 0 : getWidth().hashCode());
        return hashCode;
    }

    @Override
    public InsertableImage clone() {
        try {
            return (InsertableImage) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.mediaconvert.model.transform.InsertableImageMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
package service

import model._
import scala.slick.driver.H2Driver.simple._
import Database.threadLocalSession
import service.SystemSettingsService.SystemSettings
import util.StringUtil._
import model.GroupMember
import scala.Some
import model.Account
import util.LDAPUtil
import org.slf4j.LoggerFactory

trait AccountService {

  private val logger = LoggerFactory.getLogger(classOf[AccountService])

  def authenticate(settings: SystemSettings, userName: String, password: String): Option[Account] =
    if(settings.ldapAuthentication){
      ldapAuthentication(settings, userName, password)
    } else {
      defaultAuthentication(userName, password)
    }

  /**
   * Authenticate by internal database.
   */
  private def defaultAuthentication(userName: String, password: String) = {
    getAccountByUserName(userName).collect {
      case account if(!account.isGroupAccount && account.password == sha1(password)) => Some(account)
    } getOrElse None
  }

  /**
   * Authenticate by LDAP.
   */
  private def ldapAuthentication(settings: SystemSettings, userName: String, password: String) = {
    LDAPUtil.authenticate(settings.ldap.get, userName, password) match {
      case Right(mailAddress) => {
        // Create or update account by LDAP information
        getAccountByUserName(userName) match {
          case Some(x) => updateAccount(x.copy(mailAddress = mailAddress))
          case None    => createAccount(userName, "", mailAddress, false, None)
        }
        getAccountByUserName(userName)
      }
      case Left(errorMessage) => {
        logger.info(s"LDAP Authentication Failed: ${errorMessage}")
        defaultAuthentication(userName, password)
      }
    }
  }

  def getAccountByUserName(userName: String): Option[Account] =
    Query(Accounts) filter(_.userName is userName.bind) firstOption

  def getAccountByMailAddress(mailAddress: String): Option[Account] =
    Query(Accounts) filter(_.mailAddress is mailAddress.bind) firstOption

  def getAllUsers(): List[Account] = Query(Accounts) sortBy(_.userName) list

  def createAccount(userName: String, password: String, mailAddress: String, isAdmin: Boolean, url: Option[String]): Unit =
    Accounts insert Account(
      userName       = userName,
      password       = password,
      mailAddress    = mailAddress,
      isAdmin        = isAdmin,
      url            = url,
      registeredDate = currentDate,
      updatedDate    = currentDate,
      lastLoginDate  = None,
      image          = None,
      isGroupAccount = false)

  def updateAccount(account: Account): Unit =
    Accounts
      .filter { a => a.userName is account.userName.bind }
      .map    { a => a.password ~ a.mailAddress ~ a.isAdmin ~ a.url.? ~ a.registeredDate ~ a.updatedDate ~ a.lastLoginDate.? }
      .update (
        account.password,
        account.mailAddress,
        account.isAdmin,
        account.url,
        account.registeredDate,
        currentDate,
        account.lastLoginDate)

  def updateAvatarImage(userName: String, image: Option[String]): Unit =
    Accounts.filter(_.userName is userName.bind).map(_.image.?).update(image)

  def updateLastLoginDate(userName: String): Unit =
    Accounts.filter(_.userName is userName.bind).map(_.lastLoginDate).update(currentDate)

  def createGroup(groupName: String, url: Option[String]): Unit =
    Accounts insert Account(
      userName       = groupName,
      password       = "",
      mailAddress    = groupName + "@devnull",
      isAdmin        = false,
      url            = url,
      registeredDate = currentDate,
      updatedDate    = currentDate,
      lastLoginDate  = None,
      image          = None,
      isGroupAccount = true)

  def updateGroup(groupName: String, url: Option[String]): Unit =
    Accounts.filter(_.userName is groupName.bind).map(_.url.?).update(url)

  def updateGroupMembers(groupName: String, members: List[String]): Unit = {
    Query(GroupMembers).filter(_.groupName is groupName.bind).delete
    members.foreach { userName =>
      GroupMembers insert GroupMember (groupName, userName)
    }
  }

  def getGroupMembers(groupName: String): List[String] =
    Query(GroupMembers)
      .filter(_.groupName is groupName.bind)
      .sortBy(_.userName)
      .map(_.userName)
      .list

  def getGroupsByUserName(userName: String): List[String] =
    Query(GroupMembers)
      .filter(_.userName is userName.bind)
      .sortBy(_.groupName)
      .map(_.groupName)
      .list

}


text:
title: Bingo
season: In House
period: Autumn
playwright: Edward Bond
season_sort: 110
venue: New Theatre

cast:
- role: Shakespeare
  name: Jim Cohen
- role: Judith
  name: Penn Smith
- role: Old Man
  name: Andrew Knee
- role: Young Woman
  name: Amanda Salt
- role: Old Woman
  name: Sarah Shorrocky
- role: Combe
  name: Graham Moff
- role: Son
  name: Nick Williams
- role: Jerome
  name: Simon Keating
- role: Joan
  name: Gio Marantano
- role: Wally
  name: Dave Anderson
- role: Jonson
  name: Jon Turner

crew:
- role: Director
  name: Charlie Dunnett
- role: Designer
  name: Charlie Dunnett
- role: Lighting Designer
  name: Clive Loughlin
- role: Stage Manager
  name: Simon Faeharty
- role: ASM
  name: Jane Wolfenden
- role: Props
  name: Anne Renwick
- role: Technician
  name: John Hughes
- role: Technician
  name: Sue Dunlop
- role: Technician
  name: Chris Jackson
- role: Technician
  name: Alan Jasper
- role: Technician
  name: Andrew Morseley

---


text:
function os::test::extended::focus () {
	if [[ $# -ne 0 ]]; then
		os::log::info "Running custom: $*"
		os::test::extended::test_list "$@"
		if [[ "${TEST_COUNT}" -eq 0 ]]; then
			os::log::error "No tests would be run"
			exit 1
		fi
		extended.test "$@"
		exit $?
	fi
}

# Launches an extended server for OpenShift
# TODO: this should be doing less, because clusters should be stood up outside
#		and then tests are executed.	Tests that depend on fine grained setup should
#		be done in other contexts.
function os::test::extended::setup () {
	# build binaries
	os::util::ensure::built_binary_exists 'ginkgo' 'vendor/github.com/onsi/ginkgo/ginkgo'
	os::util::ensure::built_binary_exists 'extended.test' 'test/extended/extended.test'
	os::util::ensure::built_binary_exists 'openshift'
	os::util::ensure::built_binary_exists 'oadm'
	os::util::ensure::built_binary_exists 'oc'
	os::util::ensure::built_binary_exists 'junitmerge'

	# ensure proper relative directories are set
	export EXTENDED_TEST_PATH="${OS_ROOT}/test/extended"
	export KUBE_REPO_ROOT="${OS_ROOT}/vendor/k8s.io/kubernetes"

	os::util::environment::setup_time_vars
	os::util::environment::use_sudo
	os::util::environment::setup_all_server_vars "test-extended/core"

	os::util::ensure::iptables_privileges_exist

	# Allow setting $JUNIT_REPORT to toggle output behavior
	if [[ -n "${JUNIT_REPORT:-}" ]]; then
		export JUNIT_REPORT_OUTPUT="${LOG_DIR}/raw_test_output.log"
		# the Ginkgo tests also generate jUnit but expect different envars
		export TEST_REPORT_DIR="${ARTIFACT_DIR}"
	fi

	function cleanup() {
		out=$?
		cleanup_openshift

		os::test::junit::generate_oscmd_report

		os::log::info "Exiting"
		return $out
	}

	trap "exit" INT TERM
	trap "cleanup" EXIT

	# allow setup to be skipped
	if [[ -n "${TEST_ONLY+x}" ]]; then
		export SKIP_TEARDOWN='true'
		# be sure to set VOLUME_DIR if you are running with TEST_ONLY
		os::log::info "Not starting server, VOLUME_DIR=${VOLUME_DIR:-}"
		return 0
	fi

	os::log::info "Starting server"

	os::util::environment::setup_images_vars

	local sudo=${USE_SUDO:+sudo}

	# If the current system has the XFS volume dir mount point we configure
	# in the test images, assume to use it which will allow the local storage
	# quota tests to pass.
	LOCAL_STORAGE_QUOTA=""
	if [[ -d "/mnt/openshift-xfs-vol-dir" ]] && ${sudo} lvs | grep -q "xfs"; then
		LOCAL_STORAGE_QUOTA="1"
		export VOLUME_DIR="/mnt/openshift-xfs-vol-dir"
	else
		os::log::warn "/mnt/openshift-xfs-vol-dir does not exist, local storage quota tests may fail."
	fi

	os::log::system::start

	if [[ -n "${SHOW_ALL:-}" ]]; then
		SKIP_NODE=1
	fi

	# when selinux is enforcing, the volume dir selinux label needs to be
	# svirt_sandbox_file_t
	#
	# TODO: fix the selinux policy to either allow openshift_var_lib_dir_t
	# or to default the volume dir to svirt_sandbox_file_t.
	if selinuxenabled; then
		${sudo} chcon -t svirt_sandbox_file_t ${VOLUME_DIR}
	fi
	CONFIG_VERSION=""
	if [[ -n "${API_SERVER_VERSION:-}" ]]; then
		CONFIG_VERSION="${API_SERVER_VERSION}"
	elif [[ -n "${CONTROLLER_VERSION:-}" ]]; then
		CONFIG_VERSION="${CONTROLLER_VERSION}"
	fi
	os::start::configure_server "${CONFIG_VERSION}"
	#turn on audit logging for extended tests ... mimic what is done in os::start::configure_server, but don't
	# put change there - only want this for extended tests
	os::log::info "Turn on audit logging"
	cp "${SERVER_CONFIG_DIR}/master/master-config.yaml" "${SERVER_CONFIG_DIR}/master/master-config.orig2.yaml"
	openshift ex config patch "${SERVER_CONFIG_DIR}/master/master-config.orig2.yaml" --patch="{\"auditConfig\": {\"enabled\": true}}"  > "${SERVER_CONFIG_DIR}/master/master-config.yaml"

	# If the XFS volume dir mount point exists enable local storage quota in node-config.yaml so these tests can pass:
	if [[ -n "${LOCAL_STORAGE_QUOTA}" ]]; then
		# The ec2 images usually have ~5Gi of space defined for the xfs vol for the registry; want to give /registry a good chunk of that
		# to store the images created when the extended tests run
		cp "${NODE_CONFIG_DIR}/node-config.yaml" "${NODE_CONFIG_DIR}/node-config.orig2.yaml"
		openshift ex config patch "${NODE_CONFIG_DIR}/node-config.orig2.yaml" --patch='{"volumeConfig":{"localQuota":{"perFSGroup":"4480Mi"}}}' > "${NODE_CONFIG_DIR}/node-config.yaml"
	fi
	os::log::info "Using VOLUME_DIR=${VOLUME_DIR}"

	# This is a bit hacky, but set the pod gc threshold appropriately for the garbage_collector test
	# and enable-hostpath-provisioner for StatefulSet tests
	cp "${SERVER_CONFIG_DIR}/master/master-config.yaml" "${SERVER_CONFIG_DIR}/master/master-config.orig3.yaml"
	openshift ex config patch "${SERVER_CONFIG_DIR}/master/master-config.orig3.yaml" --patch='{"kubernetesMasterConfig":{"controllerArguments":{"terminated-pod-gc-threshold":["100"], "enable-hostpath-provisioner":["true"]}}}' > "${SERVER_CONFIG_DIR}/master/master-config.yaml"

	os::start::server "${API_SERVER_VERSION:-}" "${CONTROLLER_VERSION:-}" "${SKIP_NODE:-}"

	export KUBECONFIG="${ADMIN_KUBECONFIG}"

	os::start::registry
	if [[ -z "${SKIP_NODE:-}" ]]; then
		oc rollout status dc/docker-registry
	fi
	DROP_SYN_DURING_RESTART=true CREATE_ROUTER_CERT=true os::start::router

	os::log::info "Creating image streams"
	oc create -n openshift -f "${OS_ROOT}/examples/image-streams/image-streams-centos7.json" --config="${ADMIN_KUBECONFIG}"
}

# Run extended tests or print out a list of tests that need to be run
# Input:
# - FOCUS - the extended test focus
# - SKIP - the tests to skip
# - TEST_EXTENDED_SKIP - a global filter that allows additional tests to be omitted, will
#     be joined with SKIP
# - SHOW_ALL - if set, then only print out tests to be run
# - TEST_PARALLEL - if set, run the tests in parallel with the specified number of nodes
# - Arguments - arguments to pass to ginkgo
function os::test::extended::run () {
	local listArgs=()
	local runArgs=()

	if [[ -n "${FOCUS-}" ]]; then
		listArgs+=("--ginkgo.focus=${FOCUS}")
		runArgs+=("-focus=${FOCUS}")
	fi

	local skip="${SKIP-}"
	# Allow additional skips to be provided on the command line
	if [[ -n "${TEST_EXTENDED_SKIP-}" ]]; then
		if [[ -n "${skip}" ]]; then
			skip="${skip}|${TEST_EXTENDED_SKIP}"
		else
			skip="${TEST_EXTENDED_SKIP}"
		fi
	fi
	if [[ -n "${skip}" ]]; then
		listArgs+=("--ginkgo.skip=${skip}")
		runArgs+=("-skip=${skip}")
	fi

	if [[ -n "${TEST_PARALLEL-}" ]]; then
		runArgs+=("-p" "-nodes=${TEST_PARALLEL}")
	fi

	if [[ -n "${SHOW_ALL-}" ]]; then
		PRINT_TESTS=1
		os::test::extended::test_list "${listArgs[@]}"
		return
	fi

	os::test::extended::test_list "${listArgs[@]}"

	if [[ "${TEST_COUNT}" -eq 0 ]]; then
		os::log::warn "No tests were selected"
		return
	fi

	ginkgo -v -noColor "${runArgs[@]}" "$( os::util::find::built_binary extended.test )" "$@"
}

# Create a list of extended tests to be run with the given arguments
# Input:
# - Arguments to pass to ginkgo
# - SKIP_ONLY - If set, only selects tests to be skipped
# - PRINT_TESTS - If set, print the list of tests
# Output:
# - TEST_COUNT - the number of tests selected by the arguments
function os::test::extended::test_list () {
	local full_test_list=()
	local selected_tests=()

	while IFS= read -r; do
		full_test_list+=( "${REPLY}" )
	done < <(TEST_OUTPUT_QUIET=true extended.test "$@" --ginkgo.dryRun --ginkgo.noColor )
	if [[ "{$REPLY}" ]]; then lines+=( "$REPLY" ); fi

	for test in "${full_test_list[@]}"; do
		if [[ -n "${SKIP_ONLY:-}" ]]; then
			if grep -q "35mskip" <<< "${test}"; then
				selected_tests+=( "${test}" )
			fi
		else
			if grep -q "1mok" <<< "${test}"; then
				selected_tests+=( "${test}" )
			fi
		fi
	done
	if [[ -n "${PRINT_TESTS:-}" ]]; then
		if [[ ${#selected_tests[@]} -eq 0 ]]; then
			os::log::warn "No tests were selected"
		else
			printf '%s\n' "${selected_tests[@]}" | sort
		fi
	fi
	export TEST_COUNT=${#selected_tests[@]}
}
readonly -f os::test::extended::test_list

# Merge all of the JUnit output files in the TEST_REPORT_DIR into a single file.
# This works around a gap in Jenkins JUnit reporter output that double counts skipped
# files until https://github.com/jenkinsci/junit-plugin/pull/54 is merged.
function os::test::extended::merge_junit () {
	if [[ -z "${JUNIT_REPORT:-}" ]]; then
		return
	fi
	local output
	output="$( mktemp )"
	"$( os::util::find::built_binary junitmerge )" "${TEST_REPORT_DIR}"/*.xml > "${output}"
	rm "${TEST_REPORT_DIR}"/*.xml
	mv "${output}" "${TEST_REPORT_DIR}/junit.xml"
}
readonly -f os::test::extended::merge_junit

# Not run by any suite
readonly EXCLUDED_TESTS=(
	"\[Skipped\]"
	"\[Disruptive\]"
	"\[Slow\]"
	"\[Flaky\]"
	"\[Compatibility\]"

	"\[Feature:Performance\]"

	# not enabled in Origin yet
	"\[Feature:GarbageCollector\]"

	# Depends on external components, may not need yet
	Monitoring              # Not installed, should be
	"Cluster level logging" # Not installed yet
	Kibana                  # Not installed
	Ubernetes               # Can't set zone labels today
	kube-ui                 # Not installed by default
	"^Kubernetes Dashboard"  # Not installed by default (also probably slow image pull)

	"\[Feature:Federation\]"   # Not enabled yet
	"\[Feature:Federation12\]"   # Not enabled yet
	Ingress                    # Not enabled yet
	"Cinder"                   # requires an OpenStack cluster
	"should support r/w"       # hostPath: This test expects that host's tmp dir is WRITABLE by a container.  That isn't something we need to guarantee for openshift.
	"should check that the kubernetes-dashboard instance is alive" # we don't create this
	"\[Feature:ManualPerformance\]" # requires /resetMetrics which we don't expose

	# See the CanSupport implementation in upstream to determine wether these work.
	"Ceph RBD"      # Works if ceph-common Binary installed (but we can't guarantee this on all clusters).
	"GlusterFS" # May work if /sbin/mount.glusterfs to be installed for plugin to work (also possibly blocked by serial pulling)
	"should support r/w" # hostPath: This test expects that host's tmp dir is WRITABLE by a container.  That isn't something we need to guarantee for openshift.

	# Failing because of https://github.com/openshift/origin/issues/12365 against a real cluster
	"should allow starting 95 pods per node"

	# Need fixing
	"Horizontal pod autoscaling" # needs heapster
	PersistentVolume           # https://github.com/openshift/origin/pull/6884 for recycler
	"mount an API token into pods" # We add 6 secrets, not 1
	"ServiceAccounts should ensure a single API token exists" # We create lots of secrets
	"Networking should function for intra-pod" # Needs two nodes, add equiv test for 1 node, then use networking suite
	"should test kube-proxy"     # needs 2 nodes
	"authentication: OpenLDAP"   # needs separate setup and bucketing for openldap bootstrapping
	"NFS"                      # no permissions https://github.com/openshift/origin/pull/6884
	"\[Feature:Example\]"      # may need to pre-pull images
	"NodeProblemDetector"        # requires a non-master node to run on
	"unchanging, static URL paths for kubernetes api services" # the test needs to exclude URLs that are not part of conformance (/logs)

	# Needs triage to determine why it is failing
	"Addon update"          # TRIAGE
	SSH                     # TRIAGE
	"\[Feature:Upgrade\]"   # TRIAGE
	"SELinux relabeling"    # started failing
	"openshift mongodb replication creating from a template" # flaking on deployment
	"Update Demo should do a rolling update of a replication controller" # this is flaky and needs triaging

	# Test will never work
	"should proxy to cadvisor" # we don't expose cAdvisor port directly for security reasons

	# Need to relax security restrictions
	"validates that InterPod Affinity and AntiAffinity is respected if matching" # this *may* now be safe

	# Requires too many pods per node for the per core defaults
	"should ensure that critical pod is scheduled in case there is no resources available"

	# Need multiple nodes
	"validates that InterPodAntiAffinity is respected if matching 2"

	# Inordinately slow tests
	"should create and stop a working application"
	"should always delete fast" # will be uncommented in etcd3

	# tested by networking.sh and requires the environment that script sets up
	"\[networking\] OVS"

	# We don't install KubeDNS
	"should check if Kubernetes master services is included in cluster-info"

	# this tests dns federation configuration via configmap, which we don't support yet
	"DNS config map"
)

readonly SERIAL_TESTS=(
	"\[Serial\]"
	"\[Feature:ManualPerformance\]" # requires isolation
	"Service endpoints latency" # requires low latency
	"\[Feature:HighDensityPerformance\]" # requires no other namespaces
	"Clean up pods on node" # schedules max pods per node
)

readonly CONFORMANCE_TESTS=(
	"\[Conformance\]"

	"Services.*NodePort"
	"ResourceQuota should"
	"\[networking\] basic openshift networking"
	"\[networking\]\[router\]"
	"Ensure supplemental groups propagate to docker"
	"EmptyDir"
	"StatefulSet"
	"Downward API"
	"DNS for ExternalName services"
	"DNS for pods for Hostname and Subdomain annotation"
	"PrivilegedPod should test privileged pod"
	"Pods should support remote command execution"
	"Pods should support retrieving logs from the container"
	"Kubectl client Simple pod should support"
	"Job should run a job to completion when tasks succeed"
	"\[images\]\[mongodb\] openshift mongodb replication"
	"\[job\] openshift can execute jobs controller"
	"\[volumes\] Test local storage quota FSGroup"
	"test deployment should run a deployment to completion"
	"Variable Expansion"
	"init containers"
	"Clean up pods on node kubelet"
	"\[Feature\:SecurityContext\]"
	"should create a LimitRange with defaults"
	"Generated release_1_2 clientset"
	"\[Feature\:PodDisruptionbudget\]"
	"should create a pod that reads a secret"
	"should create a pod that prints his name and namespace"
	"manifest migration from etcd to registry storage"
)