text:
// Copyright © 2018 Wave Engine S.L. All rights reserved. Use is subject to license terms.

#region Using Statements
using System;
using System.Collections.Generic;
using System.Text;
using WaveEngine.Common.Media;
using WaveEngine.Framework;
using WaveEngine.Framework.Animation;
using WaveEngine.Framework.Services;
using WaveEngine.Framework.Sound;
#endregion

namespace WaveEngine.Components.GameActions
{
    /// <summary>
    /// A game action to play a sound
    /// </summary>
    public class SingleAnimationGameAction : GameAction
    {
        /// <summary>
        /// Number of instances
        /// </summary>
        private static int instances;

        /// <summary>
        /// The single animation
        /// </summary>
        private SingleAnimation singleAnimation;

        /// <summary>
        /// The animation
        /// </summary>
        private AnimationUI animation;

        /// <summary>
        /// The dependency property
        /// </summary>
        private DependencyProperty dependencyProperty;

        #region Public Methods

        /// <summary>
        /// Initializes a new instance of the <see cref="SingleAnimationGameAction" /> class.
        /// </summary>
        /// <param name="singleAnimation">The single animation.</param>
        /// <param name="animation">The AnimationUI component.</param>
        /// <param name="dependencyProperty">The dependency property to animate.</param>
        /// <param name="scene">The associated scene.</param>
        public SingleAnimationGameAction(SingleAnimation singleAnimation, AnimationUI animation, DependencyProperty dependencyProperty, Scene scene = null)
            : base("SingleAnimationGameAction" + instances++, scene)
        {
            this.animation = animation;
            this.singleAnimation = singleAnimation;
            this.dependencyProperty = dependencyProperty;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SingleAnimationGameAction" /> class.
        /// </summary>
        /// <param name="parent">The parent task.</param>
        /// <param name="singleAnimation">The single animation.</param>
        /// <param name="animation">The AnimationUI component.</param>
        /// <param name="dependencyProperty">The dependency property to animate.</param>
        public SingleAnimationGameAction(IGameAction parent, SingleAnimation singleAnimation, AnimationUI animation, DependencyProperty dependencyProperty)
             : base(parent, "SingleAnimationGameAction" + instances++)
        {
            this.animation = animation;
            this.singleAnimation = singleAnimation;
            this.dependencyProperty = dependencyProperty;
        }
        #endregion

        #region Private Methods

        /// <summary>
        /// Perform Run actions
        /// </summary>
        protected override void PerformRun()
        {
            this.singleAnimation.Completed += this.OnAnimationCompleted;
            this.singleAnimation.Cancelled += this.OnAnimationCompleted;

            this.animation.BeginAnimation(this.dependencyProperty, this.singleAnimation);
        }

        /// <summary>
        /// Handles the Completed event of the singleAnimation control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs" /> instance containing the event data.</param>
        private void OnAnimationCompleted(object sender, EventArgs e)
        {
            this.PerformCompleted();
            this.singleAnimation.Completed -= this.OnAnimationCompleted;
            this.singleAnimation.Cancelled -= this.OnAnimationCompleted;
        }

        /// <summary>
        /// Notifies the cancelled.
        /// </summary>
        protected override void PerformCancel()
        {
            this.singleAnimation.Completed -= this.OnAnimationCompleted;
            this.singleAnimation.Cancelled -= this.OnAnimationCompleted;
            this.singleAnimation.CancelCompletedEvent();
            this.singleAnimation.Stop();
            base.PerformCancel();
        }

        /// <summary>
        /// Skip the action
        /// </summary>
        /// <returns>A value indicating it the game action is susscessfully skipped</returns>
        protected override bool PerformSkip()
        {
            if (this.IsSkippable)
            {
                this.Cancel();
                return base.PerformSkip();
            }
            else
            {
                return false;
            }
        }
        #endregion
    }
}


text:
<!doctype html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <title>{{$title or '后台管理'}}</title>
    <link rel="stylesheet" href="{{url('styles/css/bootstrap.min.css')}}"/>
    <link rel="stylesheet" href="{{url('styles/css/admin/reset.css')}}"/>
    @section('extend_styles')

    @show
    <link rel="stylesheet" href="{{url('styles/css/admin/app.css')}}"/>

                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>

                    @foreach(Menu::navLinks() as $menu)
                    @if(empty($menu['children']))

{{$menu['title']}}

                    @else

                        {{$menu['title']}}

                            @foreach($menu['children'] as $childMenu)

{{$childMenu['title']}}

                            @endforeach

                    @endif
                    @endforeach

                        {{$user->first_name}}

登出

            @section('content')
            @show

@section('extend_scripts')
@show

@section('script')

@show

redpajama_set_name: RedPajamaGithub


text:
<?php namespace Torann\Duct;

use Illuminate\Support\Facades\HTML;

use Torann\Duct\Utilities\PathStack;
use Torann\Duct\Utilities\Path;

class Manager implements \ArrayAccess
{
    /**
     * Stack of Load Paths for Assets
     *
     * @var \Torann\Duct\Utilities\PathStack
     */
    public $loadPaths;

    /**
     * Map of file extensions to types
     *
     * @var array
     */
    public $contentTypes;

    /**
     * Processors are like engines, but are associated with
     * a mime type
     */
    public $preProcessors;
    public $postProcessors;
    public $bundleProcessors;

    /**
     * Package Config
     *
     * @var array
     */
    protected $config = array();

    /**
     * Assets manifest instance.
     *
     * @var \Torann\Duct\Manifest
     */
    protected $manifest;

	/**
	 * Environment
     *
	 * @var string
	 */
	protected $environment = 'local';

	/**
	 * Class constructor.
	 *
	 * @param  array     $config
     * @param  Manifest  $manifest
     * @param  string    $environment
	 */
	function __construct(array $config, Manifest $manifest, $environment = 'local')
	{
        // Set config
        $this->config      = $config;
        $this->manifest    = $manifest;

        // Set environment
        $this->setEnvironment($environment);

        // Set contact types
        $this->contentTypes = $config['contentTypes'];

        // Set paths
        $this->loadPaths = new PathStack($this->config['paths']);

        // Enable resolving logical paths without extension.
        $this->loadPaths->appendExtensions(array_keys($this->contentTypes));

        $this->preProcessors    = new ProcessorRegistry;
        $this->postProcessors   = new ProcessorRegistry;
        $this->bundleProcessors = new ProcessorRegistry;

        // Register default preprocessors
        $this->preProcessors->register('text/css', '\\Torann\\Duct\\Processors\\Import');
        $this->preProcessors->register('text/css', '\\Torann\\Duct\\Processors\\Directive');
        $this->preProcessors->register('application/javascript', '\\Torann\\Duct\\Processors\\Directive');

        // Register default preprocessors
        $this->postProcessors->register('application/javascript', '\\Torann\\Duct\\Processors\\SafetyColons');

        // Register third-party post processors
        foreach ($this->getConfig('postprocessors') as $id=>$class) {
            $this->postProcessors->register($id, $class);
        }

        // Register compressors
        foreach ($this->getConfig('compressors') as $id=>$class) {
            $this->bundleProcessors->register($id, $class);
        }
	}

    /**
     * Return manifest instance.
     *
     * @return Manifest
     */
    public function getManifest()
    {
        return $this->manifest;
    }

    /**
     * Get a config value.
     *
     * @param  string  $key
     * @param  mixed   $default
     * @return mixed
     */
    public function getConfig($key, $default = null)
    {
        return isset($this->config[$key]) ? $this->config[$key] : $default;
    }

    /**
     * Get processed asset directory.
     *
     * @return string
     */
    public function getAssetDir()
    {
        $asset_dir = $this->getConfig('asset_dir');

        return $this->inProduction() ? $asset_dir['production'] : $asset_dir['local'];
    }

    /**
     * Set as production environment.
     *
     * @param string $env
     */
    private function setEnvironment($env = 'local')
    {
        // Set to production
        $this->environment = $env;

        // Reload manifest
        $this->manifest->load($this->getAssetDir());
    }

    /**
     * Set as production environment.
     */
    public function setProduction()
    {
        $this->setEnvironment('production');
    }

    /**
     * Is in production mode.
     *
     * @return bool
     */
    public function inProduction()
    {
        return ($this->environment === 'production');
    }

    /**
     * Is in environment provided.
     *
     * @return bool
     */
    public function inDevelopment()
    {
        return ($this->environment !== 'staging' && $this->environment !== 'production');
    }

    /**
     * Return assets target path.
     *
     * @return string
     */
    public function getTargetPath()
    {
        return join(DIRECTORY_SEPARATOR, array(public_path(), $this->getAssetDir()));
    }

    /**
     * Returns the content type for the extension, .e.g. "application/javascript"
     * for ".js".
     *
     * @param  string $extension
     * @return string
     */
    public function contentType($extension)
    {
        $extension = Path::normalizeExtension($extension);

        return isset($this->contentTypes[$extension]) ? $this->contentTypes[$extension] : null;
    }

    /**
     * Finds the logical path in the stack of load paths
     * and returns the Asset.
     *
     * @param  string $logicalPath - path relative to the load path.
     * @return Asset
     */
    public function find($logicalPath)
    {
        if (Path::isAbsolute($logicalPath))
        {
            $realPath = $logicalPath;
        }
        else {
            $realPath = $this->loadPaths->find($logicalPath);
        }

        if (!is_file($realPath) || null === $realPath) {
            return;
        }

        return new Asset($this, $realPath, $logicalPath);
    }

    /**
     * Add from on of more collections
     *
     * @param  string   $logicalPath
     * @return string
     */
    public function render($logicalPath)
    {
        // Get asset
        if ($asset = $this->find($logicalPath))
        {
            // Build
            if ($relative = $asset->write())
            {
                // Non-development environments renders the content once
                if ($this->inProduction())
                {
                    switch ($asset->getContentType())
                    {
                        case 'text/css':
                            return "<?php echo HTML::style('{$relative}'); ?>";
                            break;
                        case 'application/javascript':
                            return "<?php echo HTML::script('{$relative}'); ?>";
                            break;
                    }
                }

                // Development environments assets are created on each page load
                else {
                    switch ($asset->getContentType())
                    {
                        case 'text/css':
                            return HTML::style($relative);
                            break;
                        case 'application/javascript':
                            return HTML::script($relative);
                            break;
                    }
                }

                return "<!-- torann\duct:: Content type for '{$logicalPath}' not found -->\n";
            }
        }

        return "<!-- torann\duct:: '{$logicalPath}' not found -->\n";
    }

    /**
     * Create the blade call for non-production environments
     *
     * @param  string   $path
     * @return string
     */
    public function bladeHtml($path)
    {
        return $this->inDevelopment() ? "<?php echo Duct::render('{$path}'); ?>" : $this->render($path);
    }

    /**
     * Create the blade call for non-production environments
     *
     * @param  string   $logicalPath
     * @return string
     */
    public function bladeImage($logicalPath)
    {
        // Production environments
        if(! $this->inDevelopment()) {
            return $this->getAsset($logicalPath);
        }

        return "<?php echo Duct::getAsset('{$logicalPath}'); ?>";
    }

    /**
     * Return the matching asset from the manifest
     *
     * @param  string  $path
     * @return array
     */
	public function getAsset($path)
	{
        $asset_dir = $this->getAssetDir();

        // Remove query string
        $path = preg_replace('/\?.*/', '', $path);

        // Must be absolute
        if ($path[0] !== '/') {
            $path = "/{$path}";
        }

        // Ignore assets from packages...for now
        if (substr($path, 0, 9) === '/packages') {
            return $path;
        }

        // Check manifest for production fingerprints
        if (! $this->inDevelopment() && $this->getConfig('enable_static_file_fingerprint')) {
            $path = $this->manifest->get($path) ?: $path;
        }

        return "/{$asset_dir}{$path}";
    }

    /**
     * Return the source asset for file
     *
     * @param  string  $path
     * @param  string  $asset_dir
     * @return array
     */
    public function getAssetSource($path, $asset_dir = null)
    {
        $asset_dir    = $asset_dir ? $asset_dir : $this->getAssetDir();
        $static_files = $this->getConfig('static_files');
        $path         = preg_replace("#^{$asset_dir}/?#", '', $path);

        foreach ($static_files as $destination=>$sources)
        {
            foreach ($sources as $source)
            {
                $source_path = join(DIRECTORY_SEPARATOR, array(
                    base_path(),
                    $source,
                    preg_replace("#^{$destination}/?#", '', $path)
                ));

                if (file_exists($source_path))
                {
                    return $source_path;
                }
            }
        }

        return false;
    }

    /**
     * Sugar for find()
     *
     * @param  string $logicalPath
     * @return Asset
     */
    function offsetGet($logicalPath)
    {
        return $this->find($logicalPath);
    }

    function offsetSet($offset, $value) {}
    function offsetExists($offset) {}
    function offsetUnset($offset) {}
}


text:
package com.geewhiz.pacify.checks.impl;

import java.util.LinkedHashSet;

import com.geewhiz.pacify.checks.PMarkerCheck;
import com.geewhiz.pacify.defect.Defect;
import com.geewhiz.pacify.defect.DefectException;
import com.geewhiz.pacify.defect.FilterNotFoundDefect;
import com.geewhiz.pacify.managers.EntityManager;
import com.geewhiz.pacify.model.PFile;
import com.geewhiz.pacify.model.PMarker;
import com.geewhiz.pacify.utils.Utils;

public class CheckCorrectPacifyFilter implements PMarkerCheck {

    public LinkedHashSet<Defect> checkForErrors(EntityManager entityManager, PMarker pMarker) {
        LinkedHashSet<Defect> defects = new LinkedHashSet<Defect>();

        for (PFile pFile : entityManager.getPFilesFrom(pMarker)) {
            try {
                Utils.getPacifyFilter(pFile);
            } catch (DefectException e) {
                defects.add(new FilterNotFoundDefect(pFile));
            }

        }
        return defects;
    }
}


text:
module ServerProcessModule {

    "use strict";

    class RunningServerProcessListItem {

        public $inject: string[] = ["serverProcessUow"];

        constructor(private serverProcessUow) {

        }

        public static componentId: string = "runningServerProcessListItem";

        public restrict: string = "E";

        public replace: boolean = true;

		public scope = {
		    entity:"="
		};

        public templateUrl: string = "/app/serverProcess/components/runningServerProcessListItem/runningServerProcessListItem.html";

        public link = (scope, element, attributes) => {

            scope.$on("runningServerProcessUpdate",(event, object) => {
                if (object.guid == scope.entity.guid) {
                    scope.entity.executionState = object.executionState;
                    scope.$digest();
                }
            });
        }

    }

    angular.module("serverProcess").directive(RunningServerProcessListItem.componentId,(serverProcessUow) => new RunningServerProcessListItem(serverProcessUow));

}


text:
package net.coobird.paint.layer;

import java.awt.AlphaComposite;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import net.coobird.paint.BlendingMode;
import net.coobird.paint.image.Canvas;
import net.coobird.paint.image.ImageRenderer;
import net.coobird.paint.layer.event.LayerChangeEventType;
import net.coobird.paint.layer.event.LayerChangeListener;

/*************************
 * TODO Clean up this class!!
 */

/**
 * Represents a image layer within the Untitled Image Manipulation Application.
 *
 * @author coobird
 *
 */
public class ImageLayer implements Serializable
{

	/**
	 *
	 */
	private static final long serialVersionUID = -6993626021146695425L;

	/**
	 * The scaling factor to shrink the actual image of the layer by when the
	 * thumbnail is displayed. The scaling factor of 8 means that the thumbnail
	 * is 1/8 the size of the actual image in the image layer.
	 */
	protected static final int THUMBNAIL_SCALE = 8;

	/**
	 * The default image type used for the BufferedImage which contains the
	 * image information for this image layer.
	 */
	protected static final int DEFAULT_IMAGE_TYPE = BufferedImage.TYPE_INT_ARGB;

	protected transient BufferedImage image;
	protected transient BufferedImage thumbImage;
	protected transient Graphics2D g;
	protected String caption;
	protected boolean visible = true;
	protected boolean locked = false;

	protected int x;
	protected int y;
	protected int width;
	protected int height;

	protected float alpha = 1.0f;
	protected BlendingMode.Layer mode = BlendingMode.Layer.NORMAL;

	protected List<LayerChangeListener> listeners;

	private static enum EventType
	{
		LAYER_CHANGED,
		LAYER_UPDATED;
	};

	/**
	 * Initializes the instance.
	 */
	{
		listeners = new ArrayList<LayerChangeListener>();
	}

	/**
	 * {@code ImageLayer} must be constructed with the width and height
	 * parameters specified.
	 *
	 * @see ImageLayer(int,int)
	 */
	@SuppressWarnings("unused")
	private ImageLayer() {};

	/**
	 * Instantiate a new {@code ImageLayer}.
	 *
	 * @param width		The width of the ImageLayer.
	 * @param height	The height of the ImageLayer.
	 */
	public ImageLayer(BufferedImage image)
	{
		initInstance();
		setImage(image);

		renderThumbnail();
	}

	/**
	 * Instantiate a new {@code ImageLayer} from an existing image.
	 *
	 * @param width		The width of the ImageLayer.
	 * @param height	The height of the ImageLayer.
	 */
	public ImageLayer(int width, int height)
	{
		initInstance();

		image = new BufferedImage(
				width,
				height,
				DEFAULT_IMAGE_TYPE
		);

		setImage(image);

		renderThumbnail();
	}

	/**
	 * Initializes the instance of {@code ImageLayer}.
	 */
	private void initInstance()
	{
		this.x = 0;
		this.y = 0;
		this.setCaption("Untitled Layer");
	}

	/**
	 * Creates a thumbnail image.
	 */
	protected void renderThumbnail()
	{
		int thumbWidth = this.width / THUMBNAIL_SCALE;
		int thumbHeight = this.height / THUMBNAIL_SCALE;

		/*
		 * If either the thumbnail width or height is 0, then upon rendering
		 * the thumbnail, a IllegalArgumentException will be thrown by trying
		 * to instantiate a BufferedImage with any dimension that is 0.
		 * This check will prevent illegal sized images.
		 */
		if (thumbWidth == 0 || thumbHeight == 0)
		{
			thumbWidth = this.width;
			thumbHeight = this.height;
		}

		thumbImage = new BufferedImage(
				thumbWidth,
				thumbHeight,
				DEFAULT_IMAGE_TYPE
		);

		Graphics2D g = thumbImage.createGraphics();

		/*
		 *  Use AlphaComposite.Src as the Composite mode to draw source image
		 *  directly onto thumbImage.
		 *  Else, the original image will not be overwritten, and if there was
		 *  change in alpha, it may not show up.
		 */
		g.setComposite(AlphaComposite.Src);

		g.drawImage(
				image,
				0,
				0,
				thumbImage.getWidth(),
				thumbImage.getHeight(),
				null
		);

		g.dispose();
	}

	/**
	 * Updates the state of the ImageLayer.
	 */
	public void update()
	{
		// Perform action to keep imagelayer up to date
		// Here, renderThumbnail to synch the image and thumbImage representation
		renderThumbnail();
		changeOccured(EventType.LAYER_UPDATED);
	}

	/**
	 * Returns the {@link Graphics2D} object associated with the image contained
	 * in the {@code ImageLayer} object.
	 *
	 * @return				The {@code Graphics2D} object associated with the
	 * 						image contained in the {@code ImageLayer} object.
	 */
	public Graphics2D getGraphics()
	{
		return g;
	}

	/**
	 *
	 * @param listener
	 */
	public void addLayerChangeListener(LayerChangeListener listener)
	{
		listeners.add(listener);
	}

	/**
	 *
	 * @param listener
	 */
	public void removeLayerChangeListener(LayerChangeListener listener)
	{
		listeners.remove(listener);
	}

	/**
	 *
	 * @param il
	 */
	protected void changeOccured(EventType type)
	{
		for (LayerChangeListener listener : listeners)
		{
			if (type == EventType.LAYER_CHANGED)
			{
				listener.layerChanged(this, LayerChangeEventType.LAYER_CHANGED);
			}
			else
			{
				listener.layerChanged(this, LayerChangeEventType.LAYER_CHANGED);
			}
		}
	}

	/**
	 * TODO
	 * @return the image
	 */
	public BufferedImage getImage()
	{
		return image;
	}

	/**
	 * TODO
	 * @param image the image to set
	 */
	public void setImage(BufferedImage image)
	{
		/*
		 * If the type of the given BufferedImage is not the DEFAULT_IMAGE_TYPE,
		 * then create a new BufferedImage with the DEFAULT_IMAGE_TYPE, and
		 * draw the given image onto the new BufferedImage.
		 */
		if (image.getType() == DEFAULT_IMAGE_TYPE)
		{
			this.image = image;
			this.width = image.getWidth();
			this.height = image.getHeight();
			this.g = image.createGraphics();

			renderThumbnail();
		}
		else
		{
			this.width = image.getWidth();
			this.height = image.getHeight();

			this.image = new BufferedImage(
					this.width,
					this.height,
					DEFAULT_IMAGE_TYPE
			);
			this.g = this.image.createGraphics();

			g.drawImage(image, 0, 0, null);

			renderThumbnail();
		}
	}

	/**
	 * TODO
	 * @return the thumbImage
	 */
	public BufferedImage getThumbImage()
	{
		return thumbImage;
	}

	/**
	 * TODO
	 * @param thumbImage the thumbImage to set
	 */
	public void setThumbImage(BufferedImage thumbImage)
	{
		this.thumbImage = thumbImage;
	}

	/**
	 * Checks if this {@code ImageLayer} is set as visible.
	 *
	 * When an {@code ImageLayer} object is marked as visible, the image layer
	 * will be rendered when it is included in a {@link Canvas} object which is
	 * being rendered by an {@link ImageRenderer}.
	 *
	 * @return				{@code true} if the {@code ImageLayer} object is
	 * 						visible, {@code false} otherwise.
	 */
	public boolean isVisible()
	{
		return visible;
	}

	/**
	 * Sets the visibility of this ImageLayer.
	 *
	 * @param visible	The visibility of this ImageLayer.
	 */
	public void setVisible(boolean visible)
	{
		this.visible = visible;
	}

	/**
	 * Returns the caption of the ImageLayer.
	 *
	 * @return	The caption of the ImageLayer.
	 */
	public String getCaption()
	{
		return caption;
	}

	/**
	 * Sets the caption of the ImageLayer.
	 *
	 * @param caption	The caption to set the ImageLayer to.
	 */
	public void setCaption(String caption)
	{
		this.caption = caption;
	}

	/**
	 * Returns the width of the ImageLayer.
	 *
	 * @return	The width of the ImageLayer.
	 */
	public int getWidth()
	{
		return image.getWidth();
	}

	/**
	 * Returns the height of the ImageLayer.
	 *
	 * @return	The height of the ImageLayer.
	 */
	public int getHeight()
	{
		return image.getHeight();
	}

	/**
	 * @return the x
	 */
	public int getX()
	{
		return x;
	}

	/**
	 * @param x the x to set
	 */
	public void setX(int x)
	{
		this.x = x;
	}

	/**
	 * @return the y
	 */
	public int getY()
	{
		return y;
	}

	/**
	 * @param y the y to set
	 */
	public void setY(int y)
	{
		this.y = y;
	}

	/**
	 * Sets the ImageLayer offset.
	 * @param x
	 * @param y
	 */
	public void setLocation(int x, int y)
	{
		this.x = x;
		this.y = y;
	}

	/**
	 * @return the alpha
	 */
	public float getAlpha()
	{
		return alpha;
	}

	/**
	 *

	 * Sets the transparency of his image layer.
	 *

	 *

	 * The value for transparency must be in the range of {@code 0.0f} to
	 * {@code 1.0f}, where {@code 0.0f} is completely transparent, and
	 * {@code 1.0f} is completely opaque.
	 *

	 *
	 * @param alpha 	The transparency level to set the layer to, in the range
	 * 					of {@code 0.0f} to {@code 1.0f}, where {@code 0.0f} is
	 * 					completely transparent, and {@code 1.0f} is completely
	 * 					opaque.
	 * @throws IllegalArgumentException		Thrown when the {@code alpha} is
	 * 										specified outside the range of
	 * 										{@code 0.0f} to {@code 1.0f}.
	 */
	public void setAlpha(float alpha)
	{
		if (alpha > 1.0f || alpha < 0.0f)
		{
			throw new IllegalArgumentException(
					"Alpha must be in the range of 0.0f to 1.0f."
			);
		}

		this.alpha = alpha;
	}

	/**
	 * Returns the blending {@link AlphaComposite} used for this layer.
	 * @return
	 */
	public AlphaComposite getAlphaComposite()
	{
		return AlphaComposite.getInstance(
				mode.getComposite().getRule(),
				alpha
		);
	}

	/**
	 * Returns the blending mode for this layer.
	 *
	 * @return the mode
	 */
	public BlendingMode.Layer getMode()
	{
		return mode;
	}

	/**
	 * Sets the blending mode for this layer.
	 *
	 * @param mode the mode to set
	 */
	public void setMode(BlendingMode.Layer mode)
	{
		this.mode = mode;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString()
	{
		String msg = "Image Layer: " + this.caption +
			", x: " + this.x + ", y: " + this.y +
			", width: " + this.width + ", height: " + this.height;

		return msg;
	}

	/**
	 *

	 * Returns the default image type of layers of this class.
	 *

	 *

	 * The value returned is a class constant from the {@link BufferedImage}
	 * class which defines the type of an image.
	 *

	 *
	 * @return			The default image type of this class.
	 */
	public static int getDefaultType()
	{
		return DEFAULT_IMAGE_TYPE;
	}

	/**
	 * Sets whether the layer is to be locked from editing.
	 *
	 * @param locked	When {@code true}, the layer will be locked from
	 * 					editing.
	 */
	public void setLocked(boolean locked)
	{
		this.locked = locked;
	}

	/**
	 * Returns whether the layer is locked from editing.
	 *
	 * @return			{@code true} if the layer is locked, {@code false}
	 * 					if not.
	 */
	public boolean isLocked()
	{
		return locked;
	}
}


text:
<!DOCTYPE html>

    <title>Angular Material - Starter App</title>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />

    <link rel='stylesheet' href='http://fonts.googleapis.com/css?family=Roboto:400,500,700,400italic'>
    <link rel="stylesheet" href="./bower_components/angular-material/angular-material.css"/>
    <link rel="stylesheet" href="assets/app.css"/>

    <md-toolbar layout="row">
      <md-button class="menu" hide-gt-sm ng-click="ul.toggleList()" aria-label="Show User List">
        <md-icon md-svg-icon="menu" ></md-icon>
      </md-button>

Angular Material - Starter App

    </md-toolbar>

        <md-sidenav md-is-locked-open="$mdMedia('gt-sm')" class="md-whiteframe-z2" md-component-id="left">
          <md-list>
            <md-item ng-repeat="it in ul.users">
                <md-button ng-click="ul.selectUser(it)" ng-class="{'selected' : it === ul.selected }">
                  <md-icon md-svg-icon="{{it.avatar}}" class="avatar"></md-icon>
                  {{it.name}}
                </md-button>
            </md-item>
          </md-list>
        </md-sidenav>

        <md-content flex id="content">
          <md-icon md-svg-icon="{{ul.selected.avatar}}" class="avatar"></md-icon>

{{ul.selected.name}}

{{ul.selected.content}}

          <md-button class="share" md-no-ink ng-click="ul.share($event)" aria-label="Share">
            <md-icon md-svg-icon="share"></md-icon>
          </md-button>
        </md-content>


text:
@interface BOXCollaborationTests : BOXModelTestCase
@end

@implementation BOXCollaborationTests

- (void)test_that_collaboration_with_all_fields_is_parsed_correctly_from_json
{
    NSDictionary *dictionary = [self dictionaryFromCannedJSON:@"collaboration"];
    BOXCollaboration *collaboration = [[BOXCollaboration alloc] initWithJSON:dictionary];

    XCTAssertEqualObjects(@"791293", collaboration.modelID);

    BOXUserMini *creator = [[BOXUserMini alloc] initWithJSON:dictionary[BOXAPIObjectKeyCreatedBy]];

    [self assertModel:creator isEquivalentTo:collaboration.creator];
    XCTAssertEqualObjects(@"17738362", collaboration.creator.modelID);

    XCTAssertEqualObjects([NSDate box_dateWithISO8601String:@"2012-12-12T10:54:37-08:00"], collaboration.createdDate);
    XCTAssertEqualObjects([NSDate box_dateWithISO8601String:@"2012-12-12T11:30:43-08:00"], collaboration.modificationDate);
    XCTAssertEqualObjects([NSDate box_dateWithISO8601String:@"2013-12-12T11:30:43-08:00"], collaboration.expirationDate);
    XCTAssertEqualObjects(@"accepted", collaboration.status);
    XCTAssertEqualObjects(@"editor", collaboration.role);
    XCTAssertEqualObjects([NSDate box_dateWithISO8601String:@"2012-12-12T11:30:43-08:00"], collaboration.acknowledgedDate);
    BOXUserMini *user = [[BOXUserMini alloc] initWithJSON:dictionary[BOXAPIObjectKeyAccessibleBy]];
    [self assertModel:user isEquivalentTo:collaboration.accessibleBy];

    BOXFolderMini *folder = [[BOXFolderMini alloc] initWithJSON:dictionary[BOXAPIObjectKeyItem]];

    [self assertModel:folder isEquivalentTo:collaboration.folder];
    XCTAssertEqualObjects(@"11446500", collaboration.folder.modelID);
}

@end


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MobileOfflineMock = void 0;
var MobileOfflineMock = /** @class */ (function () {
    function MobileOfflineMock() {
    }
    MobileOfflineMock.prototype.isOfflineEnabled = function (entityType) {
        throw new Error(("not implemented"));
    };
    MobileOfflineMock.prototype.createRecord = function (entityType, data) {
        throw new Error(("not implemented"));
    };
    MobileOfflineMock.prototype.retrieveRecord = function (entityType, id, options) {
        throw new Error(("not implemented"));
    };
    MobileOfflineMock.prototype.retrieveMultipleRecords = function (entityType, options, maxPageSize) {
        throw new Error(("not implemented"));
    };
    MobileOfflineMock.prototype.updateRecord = function (entityType, id, data) {
        throw new Error(("not implemented"));
    };
    MobileOfflineMock.prototype.deleteRecord = function (entityType, id) {
        throw new Error(("not implemented"));
    };
    return MobileOfflineMock;
}());
exports.MobileOfflineMock = MobileOfflineMock;
//# sourceMappingURL=mobileoffline.mock.js.map


text:
<?php

namespace MD\Rule;

use MD\Testing\RuleTestCase;

class DebugFunctionTest extends RuleTestCase
{
    protected function getRule()
    {
        return new DebugFunction();
    }
}


text:
<?php

class ParallaxSliderWidget extends CWidget
{
    public function init() {
		$this->render('view');
    }

}


text:
find . -name cmake_install.cmake -exec rm {} \;
find . -name CMakeCache.txt -exec rm {} \;
find . -name CMakeFiles -exec rm -rf {} \;


text:
/************************************************************************
*
*
*************************************************************************
*
*  Steve York
*  Spectroscopy Imaging Systems Corporation
*  Fremont, CA  94538
*
*************************************************************************/

#ifndef contrast_h
#define contrast_h

/* This function create the contrast command frame, panel and canvas, */
/* initialized to the variables indicated by the user. */
void
contrast_win_create(Frame owner,
		    int x,          	/* x location of window */
                    int y,              /* y location of window */
		    int wd,		/* width of canvas */
		    int ht,		/* height of canvas */
		    Siscms *siscms,     /* SIS color map */
                    int gs_start,       /* start index of greyscale map */
                    int gs_num);        /* end index of greyscale map */

/* This function registers the contrast function in the contrast module. */
/* This is the function that gets called when the user changes the */
/* contrast in the window */
void
contrast_notify_func(long addr_contrast_func);
/* The function would expect the calling prototype */
/* addr_contrast_func(  Siscms *siscms,	SIS color map
		  	int gs_start,	start index of greyscale map
			int gs_num);	size of greyscale map
*/

/* This function is registered as the PANEL_NOTIFY_PROC with the button which */
/* calls up the contrast tool. */

/* This function registers the solarization function in the contrast module. */
/* This is the function that gets called when the user changes the */
/* solarization value in the window */
void
solarization_notify_func(long solar_proc);
/* The function would expect the calling prototype */
/* addr_solar_func(int);	TRUE if solarization is displayed
*/

void
contrast_win_show(void);

void
contrast_mask_on(int min_active, int min, int max_active, int max);

void
contrast_mask_off(void);

void
solarization(int flag);

void
set_contrast(float, float, float, float);

void
save_colormap();

void
restore_colormap(float xmin, float xmax);

#endif /* contrast_h */


text:
using System;
using Xunit;

namespace TictailSharp.Api.Test
{
    public class CardResourceTest
    {
        [Fact(Skip = "Not implemented")]
        public void Get_Ok_Card()
        {
            // Arrange
            // Act
            // Assert
            throw new NotImplementedException();
        }

        [Fact(Skip = "Not implemented")]
        public void DeserializeGet_Ok_Card()
        {
            throw new NotImplementedException();
        }
    }
}


text:
<!DOCTYPE html>

<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<title>Textredux</title>
<link href='http://fonts.googleapis.com/css?family=Bowlby+One+SC' rel='stylesheet' type='text/css'>
<link href="ldoc.css" rel="stylesheet">

Textredux

Installation

Usage

Code

Contribute

Changelog

Screen Shots

API Docs

Screen Shots

Above you can see the open file screen for the Textadept directory, displaying a
normal directory listing. To narrow the file list just type some characters.
To change to the parent directory either select the ".." entry or press
Backspace.

Here is the same directory, but in snapopen mode. You can quickly toggle between
normal listing and snapopen mode by pressing Ctrl+S.
Pressing Backspace to
go to the parent directory works fine when in snapopen mode as well.

Here you can see fuzzy matching in action. Just type whatever you remember and
see what pops up. Should you get to many matching entries and need to narrow
further by matching on earlier parts of the paths, just add a space and type
some additional search text.

The replacement buffer list. As the status bar says, you can close buffers or
all files in a directory from within the list by pressing Ctrl+D
or Ctrl+Shift+D (Meta+D in the terminal).
As opposed to the stock buffer list you can also narrow entries by the directory name.

The above image shows nothing new interface-wise, but illustrates the use of
the Textredux hijack function. When using the hijack function, Textredux
replaces whatever it can of traditional interfaces with text based counterparts.

Textredux' ctags-based symbol list running in a terminal session of Textadept.


text:
//copyright(c) 2016 Alberto Rodriguez

//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:

//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.

//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.

using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using LiveCharts.Definitions.Charts;

namespace LiveCharts.Wpf
{
    /// <summary>
    /// An Axis section highlights values or ranges in a chart.
    /// </summary>
    public class AxisSection : FrameworkElement, IAxisSectionView
    {
        private readonly Rectangle _rectangle;
        private readonly TextBlock _label;

        /// <summary>
        /// Initializes a new instance of AxisSection class
        /// </summary>
        public AxisSection()
        {
            _rectangle = new Rectangle();
            _label = new TextBlock();

            SetCurrentValue(StrokeProperty, new SolidColorBrush(Color.FromRgb(131, 172, 191)));
            SetCurrentValue(FillProperty, new SolidColorBrush(Color.FromRgb(131, 172, 191)) {Opacity = .35});
            SetCurrentValue(StrokeThicknessProperty, 0d);
            SetCurrentValue(FromValueProperty, 0d);
            SetCurrentValue(ToValueProperty, 0d);

            BindingOperations.SetBinding(_rectangle, Shape.FillProperty,
                    new Binding { Path = new PropertyPath(FillProperty), Source = this });
            BindingOperations.SetBinding(_rectangle, Shape.StrokeProperty,
                    new Binding { Path = new PropertyPath(StrokeProperty), Source = this });
            BindingOperations.SetBinding(_rectangle, Shape.StrokeDashArrayProperty,
                    new Binding { Path = new PropertyPath(StrokeDashArrayProperty), Source = this });
            BindingOperations.SetBinding(_rectangle, Shape.StrokeThicknessProperty,
                    new Binding { Path = new PropertyPath(StrokeThicknessProperty), Source = this });

            BindingOperations.SetBinding(_label, TextBlock.TextProperty,
                new Binding {Path = new PropertyPath(LabelProperty), Source = this});

            Panel.SetZIndex(_rectangle, -1);
        }

        public AxisSectionCore Model { get; set; }

        public static readonly DependencyProperty LabelProperty = DependencyProperty.Register(
            "Label", typeof (string), typeof (AxisSection), new PropertyMetadata(default(string)));
        /// <summary>
        /// Gets or sets the name, the title of the section, a visual element will be added to the chart if this property is not null.
        /// </summary>
        public string Label
        {
            get { return (string) GetValue(LabelProperty); }
            set { SetValue(LabelProperty, value); }
        }

        public static readonly DependencyProperty FromValueProperty = DependencyProperty.Register(
            "FromValue", typeof (double), typeof (AxisSection),
            new PropertyMetadata(default(double), CallChartUpdater));
        /// <summary>
        /// Gets or sets the value where the section starts
        /// </summary>
        public double FromValue
        {
            get { return (double) GetValue(FromValueProperty); }
            set { SetValue(FromValueProperty, value); }
        }

        public static readonly DependencyProperty ToValueProperty = DependencyProperty.Register(
            "ToValue", typeof (double), typeof (AxisSection),
            new PropertyMetadata(default(double), CallChartUpdater));
        /// <summary>
        /// Gets or sets the value where the section ends
        /// </summary>
        public double ToValue
        {
            get { return (double) GetValue(ToValueProperty); }
            set { SetValue(ToValueProperty, value); }
        }

        public static readonly DependencyProperty StrokeProperty = DependencyProperty.Register(
            "Stroke", typeof (Brush), typeof (AxisSection), new PropertyMetadata(default(Brush)));
        /// <summary>
        /// Gets o sets the section stroke, the stroke brush will be used to draw the border of the section
        /// </summary>
        public Brush Stroke
        {
            get { return (Brush) GetValue(StrokeProperty); }
            set { SetValue(StrokeProperty, value); }
        }

        public static readonly DependencyProperty FillProperty = DependencyProperty.Register(
            "Fill", typeof (Brush), typeof (AxisSection), new PropertyMetadata(default(Brush)));
        /// <summary>
        /// Gets or sets the section fill brush.
        /// </summary>
        public Brush Fill
        {
            get { return (Brush) GetValue(FillProperty); }
            set { SetValue(FillProperty, value); }
        }

        public static readonly DependencyProperty StrokeThicknessProperty = DependencyProperty.Register(
            "StrokeThickness", typeof (double), typeof (AxisSection), new PropertyMetadata(default(double)));
        /// <summary>
        /// Gets or sets the stroke thickness.
        /// </summary>
        public double StrokeThickness
        {
            get { return (double) GetValue(StrokeThicknessProperty); }
            set { SetValue(StrokeThicknessProperty, value); }
        }

        public static readonly DependencyProperty StrokeDashArrayProperty = DependencyProperty.Register(
            "StrokeDashArray", typeof (DoubleCollection), typeof (AxisSection), new PropertyMetadata(default(DoubleCollection)));
        /// <summary>
        /// Gets or sets the stroke dash array collection, use this property to create dashed stroke sections
        /// </summary>
        public DoubleCollection StrokeDashArray
        {
            get { return (DoubleCollection) GetValue(StrokeDashArrayProperty); }
            set { SetValue(StrokeDashArrayProperty, value); }
        }

        public void DrawOrMove(AxisOrientation source, int axis)
        {
            if (Parent == null)
            {
                Model.Chart.View.AddToView(this);
                Model.Chart.View.AddToDrawMargin(_rectangle);
                Model.Chart.View.AddToDrawMargin(_label);
                _rectangle.Height = 0;
                _rectangle.Width = 0;
                Canvas.SetLeft(_rectangle, 0d);
                Canvas.SetTop(_rectangle, Model.Chart.DrawMargin.Height);
                Canvas.SetTop(_label, Model.Chart.DrawMargin.Height);
                Canvas.SetLeft(_label, 0d);
            }

            var from = ChartFunctions.ToDrawMargin(FromValue, source, Model.Chart, axis);
            var to = ChartFunctions.ToDrawMargin(ToValue, source, Model.Chart, axis);

            if (from > to)
            {
                var temp = to;
                to = from;
                from = temp;
            }

            var anSpeed = Model.Chart.View.AnimationsSpeed;
            _label.UpdateLayout();

            if (source == AxisOrientation.X)
            {
                var w = to - from;
                w = StrokeThickness > w ? StrokeThickness : w;

                Canvas.SetTop(_rectangle, 0);
                _rectangle.Height = Model.Chart.DrawMargin.Height;

                if (Model.Chart.View.DisableAnimations)
                {
                    _rectangle.Width = w > 0 ? w : 0;
                    Canvas.SetLeft(_rectangle, from);
                    Canvas.SetLeft(_label, (from + to)/2 - _label.ActualWidth/2);
                }
                else
                {
                    _rectangle.BeginAnimation(WidthProperty, new DoubleAnimation(w > 0 ? w : 0, anSpeed));
                    _rectangle.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation(from, anSpeed));
                    _label.BeginAnimation(Canvas.LeftProperty,
                        new DoubleAnimation((from + to)/2 - _label.ActualWidth/2, anSpeed));
                }
                return;
            }

            var h = to - from;
            h = StrokeThickness > h ? StrokeThickness : h;

            Canvas.SetLeft(_rectangle, 0d);
            _rectangle.Width = Model.Chart.DrawMargin.Width;

            if (Model.Chart.View.DisableAnimations)
            {
                Canvas.SetTop(_rectangle, from);
                _rectangle.Height = h > 0 ? h : 0;
                Canvas.SetTop(_label, (from + to)/2 - _label.ActualHeight/2);
            }
            else
            {
                _rectangle.BeginAnimation(Canvas.TopProperty, new DoubleAnimation(from, anSpeed));
                _rectangle.BeginAnimation(HeightProperty, new DoubleAnimation(h, anSpeed));
                _label.BeginAnimation(Canvas.TopProperty,
                    new DoubleAnimation((from + to)/2 - _label.ActualHeight/2, anSpeed));
            }
        }

        public void Remove()
        {
            Model.Chart.View.RemoveFromView(this);
            Model.Chart.View.RemoveFromDrawMargin(_rectangle);
            Model.Chart.View.RemoveFromDrawMargin(_label);
        }

        public AxisSectionCore AsCoreElement(AxisCore axis, AxisOrientation source)
        {
            var model = new AxisSectionCore(this, axis.Chart);
            model.View.Model = model;
            return model;
        }

        private static void CallChartUpdater(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
        {
            var section = (AxisSection) dependencyObject;

            if (section.Model != null && section.Model.Chart != null) section.Model.Chart.Updater.Run();
        }
    }
}


text:
#include "config.h"
#include "LocalizedStrings.h"

#include "IntSize.h"
#include "NotImplemented.h"
#include "TextBreakIterator.h"
#include <wtf/MathExtras.h>
#include <wtf/UnusedParam.h>
#include <wtf/unicode/CharacterNames.h>

#if USE(CF)
#include <wtf/RetainPtr.h>
#endif

#if PLATFORM(MAC)
#include "WebCoreSystemInterface.h"
#endif

namespace WebCore {

// We can't use String::format for two reasons:
//  1) It doesn't handle non-ASCII characters in the format string.
//  2) It doesn't handle the %2$d syntax.
// Note that because |format| is used as the second parameter to va_start, it cannot be a reference
// type according to section 18.7/3 of the C++ N1905 standard.
static String formatLocalizedString(String format, ...)
{
#if USE(CF)
    va_list arguments;
    va_start(arguments, format);

#if COMPILER(CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wformat-nonliteral"
#endif
    RetainPtr<CFStringRef> result = adoptCF(CFStringCreateWithFormatAndArguments(0, 0, format.createCFString().get(), arguments));
#if COMPILER(CLANG)
#pragma clang diagnostic pop
#endif

    va_end(arguments);
    return result.get();
#else
    notImplemented();
    return format;
#endif
}

#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070
static String truncatedStringForLookupMenuItem(const String& original)
{
    if (original.isEmpty())
        return original;

    // Truncate the string if it's too long. This is in consistency with AppKit.
    unsigned maxNumberOfGraphemeClustersInLookupMenuItem = 24;
    DEFINE_STATIC_LOCAL(String, ellipsis, (&horizontalEllipsis, 1));

    String trimmed = original.stripWhiteSpace();
    unsigned numberOfCharacters = numCharactersInGraphemeClusters(trimmed, maxNumberOfGraphemeClustersInLookupMenuItem);
    return numberOfCharacters == trimmed.length() ? trimmed : trimmed.left(numberOfCharacters) + ellipsis;
}
#endif

String inputElementAltText()
{
    return WEB_UI_STRING_KEY("Submit", "Submit (input element)", "alt text for <input> elements with no alt, title, or value");
}

String resetButtonDefaultLabel()
{
    return WEB_UI_STRING("Reset", "default label for Reset buttons in forms on web pages");
}

String searchableIndexIntroduction()
{
    return WEB_UI_STRING("This is a searchable index. Enter search keywords: ",
                         "text that appears at the start of nearly-obsolete web pages in the form of a 'searchable index'");
}

String submitButtonDefaultLabel()
{
    return WEB_UI_STRING("Submit", "default label for Submit buttons in forms on web pages");
}

String fileButtonChooseFileLabel()
{
    return WEB_UI_STRING("Choose File", "title for a single file chooser button used in HTML forms");
}

String fileButtonChooseMultipleFilesLabel()
{
    return WEB_UI_STRING("Choose Files", "title for a multiple file chooser button used in HTML forms. This title should be as short as possible.");
}

String fileButtonNoFileSelectedLabel()
{
    return WEB_UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
}

String fileButtonNoFilesSelectedLabel()
{
    return WEB_UI_STRING("no files selected", "text to display in file button used in HTML forms when no files are selected and the button allows multiple files to be selected");
}

String defaultDetailsSummaryText()
{
    return WEB_UI_STRING("Details", "text to display in <details> tag when it has no <summary> child");
}

#if PLATFORM(MAC)
String copyImageUnknownFileLabel()
{
    return WEB_UI_STRING("unknown", "Unknown filename");
}
#endif

#if ENABLE(CONTEXT_MENUS)
String contextMenuItemTagOpenLinkInNewWindow()
{
    return WEB_UI_STRING("Open Link in New Window", "Open in New Window context menu item");
}

String contextMenuItemTagDownloadLinkToDisk()
{
    return WEB_UI_STRING("Download Linked File", "Download Linked File context menu item");
}

String contextMenuItemTagCopyLinkToClipboard()
{
    return WEB_UI_STRING("Copy Link", "Copy Link context menu item");
}

String contextMenuItemTagOpenImageInNewWindow()
{
    return WEB_UI_STRING("Open Image in New Window", "Open Image in New Window context menu item");
}

String contextMenuItemTagDownloadImageToDisk()
{
    return WEB_UI_STRING("Download Image", "Download Image context menu item");
}

String contextMenuItemTagCopyImageToClipboard()
{
    return WEB_UI_STRING("Copy Image", "Copy Image context menu item");
}

String contextMenuItemTagOpenFrameInNewWindow()
{
    return WEB_UI_STRING("Open Frame in New Window", "Open Frame in New Window context menu item");
}

String contextMenuItemTagCopy()
{
    return WEB_UI_STRING("Copy", "Copy context menu item");
}

String contextMenuItemTagGoBack()
{
    return WEB_UI_STRING("Back", "Back context menu item");
}

String contextMenuItemTagGoForward()
{
    return WEB_UI_STRING("Forward", "Forward context menu item");
}

String contextMenuItemTagStop()
{
    return WEB_UI_STRING("Stop", "Stop context menu item");
}

String contextMenuItemTagReload()
{
    return WEB_UI_STRING("Reload", "Reload context menu item");
}

String contextMenuItemTagCut()
{
    return WEB_UI_STRING("Cut", "Cut context menu item");
}

String contextMenuItemTagPaste()
{
    return WEB_UI_STRING("Paste", "Paste context menu item");
}

#if PLATFORM(QT)
String contextMenuItemTagSelectAll()
{
    notImplemented();
    return "Select All";
}
#endif

String contextMenuItemTagNoGuessesFound()
{
    return WEB_UI_STRING("No Guesses Found", "No Guesses Found context menu item");
}

String contextMenuItemTagIgnoreSpelling()
{
    return WEB_UI_STRING("Ignore Spelling", "Ignore Spelling context menu item");
}

String contextMenuItemTagLearnSpelling()
{
    return WEB_UI_STRING("Learn Spelling", "Learn Spelling context menu item");
}

#if PLATFORM(MAC)
String contextMenuItemTagSearchInSpotlight()
{
    return WEB_UI_STRING("Search in Spotlight", "Search in Spotlight context menu item");
}
#endif

String contextMenuItemTagSearchWeb()
{
#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)
    RetainPtr<CFStringRef> searchProviderName(AdoptCF, wkCopyDefaultSearchProviderDisplayName());
    return formatLocalizedString(WEB_UI_STRING("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get());
#else
    return WEB_UI_STRING("Search with Google", "Search with Google context menu item");
#endif
}

String contextMenuItemTagLookUpInDictionary(const String& selectedString)
{
#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060
    UNUSED_PARAM(selectedString);
    return WEB_UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item");
#else
#if USE(CF)
    RetainPtr<CFStringRef> selectedCFString = truncatedStringForLookupMenuItem(selectedString).createCFString();
    return formatLocalizedString(WEB_UI_STRING("Look Up "%@"", "Look Up context menu item with selected word"), selectedCFString.get());
#else
    return WEB_UI_STRING("Look Up "<selection>"", "Look Up context menu item with selected word").replace("<selection>", truncatedStringForLookupMenuItem(selectedString));
#endif
#endif
}

String contextMenuItemTagOpenLink()
{
    return WEB_UI_STRING("Open Link", "Open Link context menu item");
}

String contextMenuItemTagIgnoreGrammar()
{
    return WEB_UI_STRING("Ignore Grammar", "Ignore Grammar context menu item");
}

String contextMenuItemTagSpellingMenu()
{
    return WEB_UI_STRING("Spelling and Grammar", "Spelling and Grammar context sub-menu item");
}

String contextMenuItemTagShowSpellingPanel(bool show)
{
    if (show)
        return WEB_UI_STRING("Show Spelling and Grammar", "menu item title");
    return WEB_UI_STRING("Hide Spelling and Grammar", "menu item title");
}

String contextMenuItemTagCheckSpelling()
{
    return WEB_UI_STRING("Check Document Now", "Check spelling context menu item");
}

String contextMenuItemTagCheckSpellingWhileTyping()
{
    return WEB_UI_STRING("Check Spelling While Typing", "Check spelling while typing context menu item");
}

String contextMenuItemTagCheckGrammarWithSpelling()
{
    return WEB_UI_STRING("Check Grammar With Spelling", "Check grammar with spelling context menu item");
}

String contextMenuItemTagFontMenu()
{
    return WEB_UI_STRING("Font", "Font context sub-menu item");
}

#if PLATFORM(MAC)
String contextMenuItemTagShowFonts()
{
    return WEB_UI_STRING("Show Fonts", "Show fonts context menu item");
}
#endif

String contextMenuItemTagBold()
{
    return WEB_UI_STRING("Bold", "Bold context menu item");
}

String contextMenuItemTagItalic()
{
    return WEB_UI_STRING("Italic", "Italic context menu item");
}

String contextMenuItemTagUnderline()
{
    return WEB_UI_STRING("Underline", "Underline context menu item");
}

String contextMenuItemTagOutline()
{
    return WEB_UI_STRING("Outline", "Outline context menu item");
}

#if PLATFORM(MAC)
String contextMenuItemTagStyles()
{
    return WEB_UI_STRING("Styles...", "Styles context menu item");
}

String contextMenuItemTagShowColors()
{
    return WEB_UI_STRING("Show Colors", "Show colors context menu item");
}

String contextMenuItemTagSpeechMenu()
{
    return WEB_UI_STRING("Speech", "Speech context sub-menu item");
}

String contextMenuItemTagStartSpeaking()
{
    return WEB_UI_STRING("Start Speaking", "Start speaking context menu item");
}

String contextMenuItemTagStopSpeaking()
{
    return WEB_UI_STRING("Stop Speaking", "Stop speaking context menu item");
}
#endif

String contextMenuItemTagWritingDirectionMenu()
{
    return WEB_UI_STRING("Paragraph Direction", "Paragraph direction context sub-menu item");
}

String contextMenuItemTagTextDirectionMenu()
{
    return WEB_UI_STRING("Selection Direction", "Selection direction context sub-menu item");
}

String contextMenuItemTagDefaultDirection()
{
    return WEB_UI_STRING("Default", "Default writing direction context menu item");
}

String contextMenuItemTagLeftToRight()
{
    return WEB_UI_STRING("Left to Right", "Left to Right context menu item");
}

String contextMenuItemTagRightToLeft()
{
    return WEB_UI_STRING("Right to Left", "Right to Left context menu item");
}

#if PLATFORM(MAC)

String contextMenuItemTagCorrectSpellingAutomatically()
{
    return WEB_UI_STRING("Correct Spelling Automatically", "Correct Spelling Automatically context menu item");
}

String contextMenuItemTagSubstitutionsMenu()
{
    return WEB_UI_STRING("Substitutions", "Substitutions context sub-menu item");
}

String contextMenuItemTagShowSubstitutions(bool show)
{
    if (show)
        return WEB_UI_STRING("Show Substitutions", "menu item title");
    return WEB_UI_STRING("Hide Substitutions", "menu item title");
}

String contextMenuItemTagSmartCopyPaste()
{
    return WEB_UI_STRING("Smart Copy/Paste", "Smart Copy/Paste context menu item");
}

String contextMenuItemTagSmartQuotes()
{
    return WEB_UI_STRING("Smart Quotes", "Smart Quotes context menu item");
}

String contextMenuItemTagSmartDashes()
{
    return WEB_UI_STRING("Smart Dashes", "Smart Dashes context menu item");
}

String contextMenuItemTagSmartLinks()
{
    return WEB_UI_STRING("Smart Links", "Smart Links context menu item");
}

String contextMenuItemTagTextReplacement()
{
    return WEB_UI_STRING("Text Replacement", "Text Replacement context menu item");
}

String contextMenuItemTagTransformationsMenu()
{
    return WEB_UI_STRING("Transformations", "Transformations context sub-menu item");
}

String contextMenuItemTagMakeUpperCase()
{
    return WEB_UI_STRING("Make Upper Case", "Make Upper Case context menu item");
}

String contextMenuItemTagMakeLowerCase()
{
    return WEB_UI_STRING("Make Lower Case", "Make Lower Case context menu item");
}

String contextMenuItemTagCapitalize()
{
    return WEB_UI_STRING("Capitalize", "Capitalize context menu item");
}

String contextMenuItemTagChangeBack(const String& replacedString)
{
    notImplemented();
    return replacedString;
}

#endif // PLATFORM(MAC)

String contextMenuItemTagOpenVideoInNewWindow()
{
    return WEB_UI_STRING("Open Video in New Window", "Open Video in New Window context menu item");
}

String contextMenuItemTagOpenAudioInNewWindow()
{
    return WEB_UI_STRING("Open Audio in New Window", "Open Audio in New Window context menu item");
}

String contextMenuItemTagCopyVideoLinkToClipboard()
{
    return WEB_UI_STRING("Copy Video Address", "Copy Video Address Location context menu item");
}

String contextMenuItemTagCopyAudioLinkToClipboard()
{
    return WEB_UI_STRING("Copy Audio Address", "Copy Audio Address Location context menu item");
}

String contextMenuItemTagToggleMediaControls()
{
    return WEB_UI_STRING("Controls", "Media Controls context menu item");
}

String contextMenuItemTagToggleMediaLoop()
{
    return WEB_UI_STRING("Loop", "Media Loop context menu item");
}

String contextMenuItemTagEnterVideoFullscreen()
{
    return WEB_UI_STRING("Enter Fullscreen", "Video Enter Fullscreen context menu item");
}

String contextMenuItemTagMediaPlay()
{
    return WEB_UI_STRING("Play", "Media Play context menu item");
}

String contextMenuItemTagMediaPause()
{
    return WEB_UI_STRING("Pause", "Media Pause context menu item");
}

String contextMenuItemTagMediaMute()
{
    return WEB_UI_STRING("Mute", "Media Mute context menu item");
}

String contextMenuItemTagInspectElement()
{
    return WEB_UI_STRING("Inspect Element", "Inspect Element context menu item");
}

#endif // ENABLE(CONTEXT_MENUS)

String searchMenuNoRecentSearchesText()
{
    return WEB_UI_STRING("No recent searches", "Label for only item in menu that appears when clicking on the search field image, when no searches have been performed");
}

String searchMenuRecentSearchesText()
{
    return WEB_UI_STRING("Recent Searches", "label for first item in the menu that appears when clicking on the search field image, used as embedded menu title");
}

String searchMenuClearRecentSearchesText()
{
    return WEB_UI_STRING("Clear Recent Searches", "menu item in Recent Searches menu that empties menu's contents");
}

String AXWebAreaText()
{
    return WEB_UI_STRING("HTML content", "accessibility role description for web area");
}

String AXLinkText()
{
    return WEB_UI_STRING("link", "accessibility role description for link");
}

String AXListMarkerText()
{
    return WEB_UI_STRING("list marker", "accessibility role description for list marker");
}

String AXImageMapText()
{
    return WEB_UI_STRING("image map", "accessibility role description for image map");
}

String AXHeadingText()
{
    return WEB_UI_STRING("heading", "accessibility role description for headings");
}

String AXDefinitionListTermText()
{
    return WEB_UI_STRING("term", "term word of a definition");
}

String AXDefinitionListDefinitionText()
{
    return WEB_UI_STRING("definition", "definition phrase");
}

String AXFooterRoleDescriptionText()
{
    return WEB_UI_STRING("footer", "accessibility role description for a footer");
}

String AXFileUploadButtonText()
{
    return WEB_UI_STRING("file upload", "accessibility role description for a file upload button");
}

#if PLATFORM(MAC)
String AXARIAContentGroupText(const String& ariaType)
{
    if (ariaType == "ARIAApplicationAlert")
        return WEB_UI_STRING("alert", "An ARIA accessibility group that acts as an alert.");
    if (ariaType == "ARIAApplicationAlertDialog")
        return WEB_UI_STRING("alert dialog", "An ARIA accessibility group that acts as an alert dialog.");
    if (ariaType == "ARIAApplicationDialog")
        return WEB_UI_STRING("dialog", "An ARIA accessibility group that acts as an dialog.");
    if (ariaType == "ARIAApplicationLog")
        return WEB_UI_STRING("log", "An ARIA accessibility group that acts as a console log.");
    if (ariaType == "ARIAApplicationMarquee")
        return WEB_UI_STRING("marquee", "An ARIA accessibility group that acts as a marquee.");
    if (ariaType == "ARIAApplicationStatus")
        return WEB_UI_STRING("application status", "An ARIA accessibility group that acts as a status update.");
    if (ariaType == "ARIAApplicationTimer")
        return WEB_UI_STRING("timer", "An ARIA accessibility group that acts as an updating timer.");
    if (ariaType == "ARIADocument")
        return WEB_UI_STRING("document", "An ARIA accessibility group that acts as a document.");
    if (ariaType == "ARIADocumentArticle")
        return WEB_UI_STRING("article", "An ARIA accessibility group that acts as an article.");
    if (ariaType == "ARIADocumentNote")
        return WEB_UI_STRING("note", "An ARIA accessibility group that acts as a note in a document.");
    if (ariaType == "ARIADocumentRegion")
        return WEB_UI_STRING("region", "An ARIA accessibility group that acts as a distinct region in a document.");
    if (ariaType == "ARIALandmarkApplication")
        return WEB_UI_STRING("application", "An ARIA accessibility group that acts as an application.");
    if (ariaType == "ARIALandmarkBanner")
        return WEB_UI_STRING("banner", "An ARIA accessibility group that acts as a banner.");
    if (ariaType == "ARIALandmarkComplementary")
        return WEB_UI_STRING("complementary", "An ARIA accessibility group that acts as a region of complementary information.");
    if (ariaType == "ARIALandmarkContentInfo")
        return WEB_UI_STRING("content information", "An ARIA accessibility group that contains content.");
    if (ariaType == "ARIALandmarkMain")
        return WEB_UI_STRING("main", "An ARIA accessibility group that is the main portion of the website.");
    if (ariaType == "ARIALandmarkNavigation")
        return WEB_UI_STRING("navigation", "An ARIA accessibility group that contains the main navigation elements of a website.");
    if (ariaType == "ARIALandmarkSearch")
        return WEB_UI_STRING("search", "An ARIA accessibility group that contains a search feature of a website.");
    if (ariaType == "ARIAUserInterfaceTooltip")
        return WEB_UI_STRING("tooltip", "An ARIA accessibility group that acts as a tooltip.");
    if (ariaType == "ARIATabPanel")
        return WEB_UI_STRING("tab panel", "An ARIA accessibility group that contains the content of a tab.");
    if (ariaType == "ARIADocumentMath")
        return WEB_UI_STRING("math", "An ARIA accessibility group that contains mathematical symbols.");
    return String();
}
#endif

String AXButtonActionVerb()
{
    return WEB_UI_STRING("press", "Verb stating the action that will occur when a button is pressed, as used by accessibility");
}

String AXRadioButtonActionVerb()
{
    return WEB_UI_STRING("select", "Verb stating the action that will occur when a radio button is clicked, as used by accessibility");
}

String AXTextFieldActionVerb()
{
    return WEB_UI_STRING("activate", "Verb stating the action that will occur when a text field is selected, as used by accessibility");
}

String AXCheckedCheckBoxActionVerb()
{
    return WEB_UI_STRING("uncheck", "Verb stating the action that will occur when a checked checkbox is clicked, as used by accessibility");
}

String AXUncheckedCheckBoxActionVerb()
{
    return WEB_UI_STRING("check", "Verb stating the action that will occur when an unchecked checkbox is clicked, as used by accessibility");
}

String AXLinkActionVerb()
{
    return WEB_UI_STRING("jump", "Verb stating the action that will occur when a link is clicked, as used by accessibility");
}

String AXMenuListPopupActionVerb()
{
    notImplemented();
    return "select";
}

String AXMenuListActionVerb()
{
    notImplemented();
    return "select";
}

String missingPluginText()
{
    return WEB_UI_STRING("Missing Plug-in", "Label text to be used when a plugin is missing");
}

String crashedPluginText()
{
    return WEB_UI_STRING("Plug-in Failure", "Label text to be used if plugin host process has crashed");
}

String blockedPluginByContentSecurityPolicyText()
{
    return WEB_UI_STRING_KEY("Blocked Plug-in", "Blocked Plug-In (Blocked by page's Content Security Policy)", "Label text to be used if plugin is blocked by a page's Content Security Policy");
}

String insecurePluginVersionText()
{
    return WEB_UI_STRING_KEY("Blocked Plug-in", "Blocked Plug-In (Insecure plug-in)", "Label text to be used when an insecure plug-in version was blocked from loading");
}

String inactivePluginText()
{
    return WEB_UI_STRING("Inactive Plug-in", "Label text to be used when a plugin has not been loaded for some time");
}

String multipleFileUploadText(unsigned numberOfFiles)
{
    return formatLocalizedString(WEB_UI_STRING("%d files", "Label to describe the number of files selected in a file upload control that allows multiple files"), numberOfFiles);
}

String unknownFileSizeText()
{
    return WEB_UI_STRING("Unknown", "Unknown filesize FTP directory listing item");
}

#if PLATFORM(WIN)
String uploadFileText()
{
    notImplemented();
    return "upload";
}

String allFilesText()
{
    notImplemented();
    return "all files";
}
#endif

#if PLATFORM(MAC)
String builtInPDFPluginName()
{
    // Also exposed to DOM.
    return WEB_UI_STRING("WebKit built-in PDF", "Pseudo plug-in name, visible in Installed Plug-ins page in Safari.");
}

String pdfDocumentTypeDescription()
{
    // Also exposed to DOM.
    return WEB_UI_STRING("Portable Document Format", "Description of the (only) type supported by PDF pseudo plug-in. Visible in Installed Plug-ins page in Safari.");
}

String keygenMenuItem512()
{
    return WEB_UI_STRING("512 (Low Grade)", "Menu item title for KEYGEN pop-up menu");
}

String keygenMenuItem1024()
{
    return WEB_UI_STRING("1024 (Medium Grade)", "Menu item title for KEYGEN pop-up menu");
}

String keygenMenuItem2048()
{
    return WEB_UI_STRING("2048 (High Grade)", "Menu item title for KEYGEN pop-up menu");
}

String keygenKeychainItemName(const String& host)
{
    return formatLocalizedString(WEB_UI_STRING("Key from %@", "Name of keychain key generated by the KEYGEN tag"), host.createCFString().get());
}

#endif

#if PLATFORM(IOS)
String htmlSelectMultipleItems(size_t count)
{
    switch (count) {
    case 0:
        return WEB_UI_STRING("0 Items", "Present the element <select multiple> when no <option> items are selected (iOS only)");
    case 1:
        return WEB_UI_STRING("1 Item", "Present the element <select multiple> when a single <option> is selected (iOS only)");
    default:
        return formatLocalizedString(WEB_UI_STRING("%zu Items", "Present the number of selected <option> items in a <select multiple> element (iOS only)"), count);
    }
}
#endif

String imageTitle(const String& filename, const IntSize& size)
{
#if USE(CF)
#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
    RetainPtr<CFLocaleRef> locale = adoptCF(CFLocaleCopyCurrent());
    RetainPtr<CFNumberFormatterRef> formatter(AdoptCF, CFNumberFormatterCreate(0, locale.get(), kCFNumberFormatterDecimalStyle));

    int widthInt = size.width();
    RetainPtr<CFNumberRef> width(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &widthInt));
    RetainPtr<CFStringRef> widthString(AdoptCF, CFNumberFormatterCreateStringWithNumber(0, formatter.get(), width.get()));

    int heightInt = size.height();
    RetainPtr<CFNumberRef> height(AdoptCF, CFNumberCreate(0, kCFNumberIntType, &heightInt));
    RetainPtr<CFStringRef> heightString(AdoptCF, CFNumberFormatterCreateStringWithNumber(0, formatter.get(), height.get()));

    return formatLocalizedString(WEB_UI_STRING("%@ %@×%@ pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filename.createCFString().get(), widthString.get(), heightString.get());
#else
    RetainPtr<CFStringRef> filenameCFString(AdoptCF, filename.createCFString());
    return formatLocalizedString(WEB_UI_STRING("%@ %d×%d pixels", "window title for a standalone image (uses multiplication symbol, not x)"), filenameCFString.get(), size.width(), size.height());
#endif
#else
    return formatLocalizedString(WEB_UI_STRING("<filename> %d×%d pixels", "window title for a standalone image (uses multiplication symbol, not x)"), size.width(), size.height()).replace("<filename>", filename);
#endif
}

String mediaElementLoadingStateText()
{
    return WEB_UI_STRING("Loading...", "Media controller status message when the media is loading");
}

String mediaElementLiveBroadcastStateText()
{
    return WEB_UI_STRING("Live Broadcast", "Media controller status message when watching a live broadcast");
}

String localizedMediaControlElementString(const String& name)
{
    if (name == "AudioElement")
        return WEB_UI_STRING("audio element controller", "accessibility role description for audio element controller");
    if (name == "VideoElement")
        return WEB_UI_STRING("video element controller", "accessibility role description for video element controller");
    if (name == "MuteButton")
        return WEB_UI_STRING("mute", "accessibility role description for mute button");
    if (name == "UnMuteButton")
        return WEB_UI_STRING("unmute", "accessibility role description for turn mute off button");
    if (name == "PlayButton")
        return WEB_UI_STRING("play", "accessibility role description for play button");
    if (name == "PauseButton")
        return WEB_UI_STRING("pause", "accessibility role description for pause button");
    if (name == "Slider")
        return WEB_UI_STRING("movie time", "accessibility role description for timeline slider");
    if (name == "SliderThumb")
        return WEB_UI_STRING("timeline slider thumb", "accessibility role description for timeline thumb");
    if (name == "RewindButton")
        return WEB_UI_STRING("back 30 seconds", "accessibility role description for seek back 30 seconds button");
    if (name == "ReturnToRealtimeButton")
        return WEB_UI_STRING("return to realtime", "accessibility role description for return to real time button");
    if (name == "CurrentTimeDisplay")
        return WEB_UI_STRING("elapsed time", "accessibility role description for elapsed time display");
    if (name == "TimeRemainingDisplay")
        return WEB_UI_STRING("remaining time", "accessibility role description for time remaining display");
    if (name == "StatusDisplay")
        return WEB_UI_STRING("status", "accessibility role description for movie status");
    if (name == "EnterFullscreenButton")
        return WEB_UI_STRING("enter fullscreen", "accessibility role description for enter fullscreen button");
    if (name == "ExitFullscreenButton")
        return WEB_UI_STRING("exit fullscreen", "accessibility role description for exit fullscreen button");
    if (name == "SeekForwardButton")
        return WEB_UI_STRING("fast forward", "accessibility role description for fast forward button");
    if (name == "SeekBackButton")
        return WEB_UI_STRING("fast reverse", "accessibility role description for fast reverse button");
    if (name == "ShowClosedCaptionsButton")
        return WEB_UI_STRING("show closed captions", "accessibility role description for show closed captions button");
    if (name == "HideClosedCaptionsButton")
        return WEB_UI_STRING("hide closed captions", "accessibility role description for hide closed captions button");

    // FIXME: the ControlsPanel container should never be visible in the accessibility hierarchy.
    if (name == "ControlsPanel")
        return String();

    ASSERT_NOT_REACHED();
    return String();
}

String localizedMediaControlElementHelpText(const String& name)
{
    if (name == "AudioElement")
        return WEB_UI_STRING("audio element playback controls and status display", "accessibility role description for audio element controller");
    if (name == "VideoElement")
        return WEB_UI_STRING("video element playback controls and status display", "accessibility role description for video element controller");
    if (name == "MuteButton")
        return WEB_UI_STRING("mute audio tracks", "accessibility help text for mute button");
    if (name == "UnMuteButton")
        return WEB_UI_STRING("unmute audio tracks", "accessibility help text for un mute button");
    if (name == "PlayButton")
        return WEB_UI_STRING("begin playback", "accessibility help text for play button");
    if (name == "PauseButton")
        return WEB_UI_STRING("pause playback", "accessibility help text for pause button");
    if (name == "Slider")
        return WEB_UI_STRING("movie time scrubber", "accessibility help text for timeline slider");
    if (name == "SliderThumb")
        return WEB_UI_STRING("movie time scrubber thumb", "accessibility help text for timeline slider thumb");
    if (name == "RewindButton")
        return WEB_UI_STRING("seek movie back 30 seconds", "accessibility help text for jump back 30 seconds button");
    if (name == "ReturnToRealtimeButton")
        return WEB_UI_STRING("return streaming movie to real time", "accessibility help text for return streaming movie to real time button");
    if (name == "CurrentTimeDisplay")
        return WEB_UI_STRING("current movie time in seconds", "accessibility help text for elapsed time display");
    if (name == "TimeRemainingDisplay")
        return WEB_UI_STRING("number of seconds of movie remaining", "accessibility help text for remaining time display");
    if (name == "StatusDisplay")
        return WEB_UI_STRING("current movie status", "accessibility help text for movie status display");
    if (name == "SeekBackButton")
        return WEB_UI_STRING("seek quickly back", "accessibility help text for fast rewind button");
    if (name == "SeekForwardButton")
        return WEB_UI_STRING("seek quickly forward", "accessibility help text for fast forward button");
    if (name == "FullscreenButton")
        return WEB_UI_STRING("Play movie in fullscreen mode", "accessibility help text for enter fullscreen button");
    if (name == "ShowClosedCaptionsButton")
        return WEB_UI_STRING("start displaying closed captions", "accessibility help text for show closed captions button");
    if (name == "HideClosedCaptionsButton")
        return WEB_UI_STRING("stop displaying closed captions", "accessibility help text for hide closed captions button");

    // The description of this button is descriptive enough that it doesn't require help text.
    if (name == "EnterFullscreenButton")
        return String();

    ASSERT_NOT_REACHED();
    return String();
}

String localizedMediaTimeDescription(float time)
{
    if (!isfinite(time))
        return WEB_UI_STRING("indefinite time", "accessibility help text for an indefinite media controller time value");

    int seconds = static_cast<int>(fabsf(time));
    int days = seconds / (60 * 60 * 24);
    int hours = seconds / (60 * 60);
    int minutes = (seconds / 60) % 60;
    seconds %= 60;

    if (days)
        return formatLocalizedString(WEB_UI_STRING("%1$d days %2$d hours %3$d minutes %4$d seconds", "accessibility help text for media controller time value >= 1 day"), days, hours, minutes, seconds);
    if (hours)
        return formatLocalizedString(WEB_UI_STRING("%1$d hours %2$d minutes %3$d seconds", "accessibility help text for media controller time value >= 60 minutes"), hours, minutes, seconds);
    if (minutes)
        return formatLocalizedString(WEB_UI_STRING("%1$d minutes %2$d seconds", "accessibility help text for media controller time value >= 60 seconds"), minutes, seconds);
    return formatLocalizedString(WEB_UI_STRING("%1$d seconds", "accessibility help text for media controller time value < 60 seconds"), seconds);
}

String validationMessageValueMissingText()
{
    return WEB_UI_STRING("value missing", "Validation message for required form control elements that have no value");
}

String validationMessageValueMissingForCheckboxText()
{
    return validationMessageValueMissingText();
}

String validationMessageValueMissingForFileText()
{
    return validationMessageValueMissingText();
}

String validationMessageValueMissingForMultipleFileText()
{
    return validationMessageValueMissingText();
}

String validationMessageValueMissingForRadioText()
{
    return validationMessageValueMissingText();
}

String validationMessageValueMissingForSelectText()
{
    return validationMessageValueMissingText();
}

String validationMessageTypeMismatchText()
{
    return WEB_UI_STRING("type mismatch", "Validation message for input form controls with a value not matching type");
}

String validationMessageTypeMismatchForEmailText()
{
    return validationMessageTypeMismatchText();
}

String validationMessageTypeMismatchForMultipleEmailText()
{
    return validationMessageTypeMismatchText();
}

String validationMessageTypeMismatchForURLText()
{
    return validationMessageTypeMismatchText();
}

String validationMessagePatternMismatchText()
{
    return WEB_UI_STRING("pattern mismatch", "Validation message for input form controls requiring a constrained value according to pattern");
}

String validationMessageTooLongText(int, int)
{
    return WEB_UI_STRING("too long", "Validation message for form control elements with a value longer than maximum allowed length");
}

String validationMessageRangeUnderflowText(const String&)
{
    return WEB_UI_STRING("range underflow", "Validation message for input form controls with value lower than allowed minimum");
}

String validationMessageRangeOverflowText(const String&)
{
    return WEB_UI_STRING("range overflow", "Validation message for input form controls with value higher than allowed maximum");
}

String validationMessageStepMismatchText(const String&, const String&)
{
    return WEB_UI_STRING("step mismatch", "Validation message for input form controls with value not respecting the step attribute");
}

} // namespace WebCore


text:
/**
 * An enum that describes the strategies that rotation actions can use
 */
export declare enum RotationType {
    /**
     * Rotation via `ShortestPath` will use the smallest angle
     * between the starting and ending points. This strategy is the default behavior.
     */
    ShortestPath = 0,
    /**
     * Rotation via `LongestPath` will use the largest angle
     * between the starting and ending points.
     */
    LongestPath = 1,
    /**
     * Rotation via `Clockwise` will travel in a clockwise direction,
     * regardless of the starting and ending points.
     */
    Clockwise = 2,
    /**
     * Rotation via `CounterClockwise` will travel in a counterclockwise direction,
     * regardless of the starting and ending points.
     */
    CounterClockwise = 3
}


text:
import sys
import re
from config import *
from utils_dataSpine import *
import numpy as np
from PIL import Image
from shutil import copyfile
from skimage import data, segmentation, color
from skimage.future import graph
import caffe
import shutil

onlyTest=False

# Temporary Files
repSavePrediction = rep_dataset
nameTmpTrainFiles = rep_dataset + "/train_tmp_" +suffixe +".txt"

# Remplace the label file in a network prototxt, in order to update the ground truth for the unlabelled data file
def replace_labelFiles(prototxt, old_labelName, newLabelFileName):

	# Step 1 : read file and save the content
	train_prototxt = open(prototxt, "r")
	train_prototxt_lines = train_prototxt.readlines()

	# Step 2: rewrite it and replace the labelFileName
	train_prototxt = open(prototxt, "w")

	for line in train_prototxt_lines:
		if old_labelName in line:
			line = line.replace(old_labelName, newLabelFileName)

		train_prototxt.write(line)

	train_prototxt.close()

def getPrototxtFromSolver(solver_name):
	solver_file = open(solver_name, "r")
	lines = solver_file.readlines()

	for line in lines:
		split = line.split(":")
		if 'net' in split [0]: # if this line corresponds to the line give the network file
			solver_file.close()
			return split[1].replace("\"", "").replace(" ", "")[:-1] # we remove the "" and th \n

	solver_file.close()
	return None

# This function modify a parameter of the solver
# Certainly a better way to do that using protobuf, I didn't thought about that at the beggening :p
def modifyPrefixSolver(solver_name, lineToModify, newValue, isString=False):
	solver_file = open(solver_name, "r")
	lines = solver_file.readlines()

	newLines = []
	for line in lines:
		split = line.split(":")
		if lineToModify + ":" in line.replace(" ", ""): # if this line corresponds to the line give the network file
			split[1] = str(newValue)
			if isString:
				split[1] = "{}{}{}".format("\"", split[1], "\"")
			newLines.append(split[0] + " : " + split[1] + '\n')
		else:
			newLines.append(line)
	solver_file.close()

	#we rewrite the file
	solver_file = open(solver_name, "w")
	for line in newLines:
		solver_file.write(line)
	solver_file.close()

# #################### INITIALISATION ########################### #
print ("Initialisation ...")
caffe.set_device(0)
caffe.set_mode_gpu()

 # LOAD unlabelled data
num_patient_file_unlab = open(unlab_filename)
num_patient_file_test = open(test_filename)

hm3D_unlab = {}
result3D_unlab = {}
unlabelled_inputs_name = {}
unlabelled_output_name = {}

mri3D_unlab, gt3D_unlab = load_dataset(unlab_filename, rep_dataset)
for patientfile in num_patient_file_unlab.read().splitlines():
	split_line = patientfile.split("\t")
	inputs_name = split_line[0]
	output_name = split_line[1]
	basename = os.path.basename(inputs_name)
	patientNum = get_patient_num(basename)
	unlabelled_inputs_name[patientNum] = inputs_name
	unlabelled_output_name[patientNum] = output_name
	hm3D_unlab[patientNum] = np.zeros((mri3D_unlab[patientNum].shape[0], mri3D_unlab[patientNum].shape[1], 2, mri3D_unlab[patientNum].shape[2]))
	result3D_unlab[patientNum] = np.zeros(mri3D_unlab[patientNum].shape)
num_patient_file_unlab.close()

hm3D_test = {}
result3D_test = {}
test_inputs_name = {}
test_output_name = {}

mri3D_test, gt3D_test = load_dataset(test_filename, rep_dataset)
for patientfile in num_patient_file_test.read().splitlines():
	split_line = patientfile.split("\t")
	inputs_name = split_line[0]
	output_name = split_line[1]
	basename = os.path.basename(inputs_name)
	patientNum = get_patient_num(basename)
	test_inputs_name[patientNum] = os.path.basename(inputs_name)
	test_output_name[patientNum] = os.path.basename(output_name)
	hm3D_test[patientNum] = np.zeros((mri3D_test[patientNum].shape[0], mri3D_test[patientNum].shape[1], 2, mri3D_test[patientNum].shape[2]))
	result3D_test[patientNum] = np.zeros(mri3D_test[patientNum].shape)
num_patient_file_test.close()

if epoch_start != 0:
	weight_file = prefix_snapshot + "_iter_" + str((epoch_start-1) * k) + ".solverstate"
# else:
# 	dice_saveUnlab_file = open(dice_saveUnlab_filename, "w")
# 	dice_saveTest_file = open(dice_saveTest_filename, "w")

solver_name = original_solver_name.replace(".prototxt", "_loop.prototxt")
copyfile(original_train_filenames, nameTmpTrainFiles)
copyfile(original_solver_name, solver_name)

createDirectoryPath(dice_saveUnlab_filename)
dice_saveUnlab_file = open(dice_saveUnlab_filename, "a")
dice_saveTest_file = open(dice_saveTest_filename, "a")

# Copy the original file in a tmp file
# network_prototxt = getPrototxtFromSolver(solver_name)
network_prototxt = orginal_net_name.replace(".prototxt", "_loop.prototxt")
#modify the snapshot prefix to fit the parameters
createDirectoryPath(prefix_snapshot)
modifyPrefixSolver(solver_name, "snapshot_prefix", prefix_snapshot, isString=True)
modifyPrefixSolver(solver_name, "snapshot", k)
modifyPrefixSolver(solver_name, "net", network_prototxt, isString=True)
copyfile(orginal_net_name, network_prototxt)
replace_labelFiles (network_prototxt, original_train_filenames, nameTmpTrainFiles)
print ("end of initialisation")

# #################### TRAINING ########################### #
print ("Loop training...")
for num_epoch in range(epoch_start, number_epoch):

	if num_epoch == 0:
		new_weight_file = weight_file
	else:
		new_weight_file = prefix_snapshot + "_iter_" + str((num_epoch) * k) + ".caffemodel"
	solver = None # free memory

	# #################### PREDICTION ON UNLABALLED  data ########################### #
	# Use graph cut or trust region to improve the segmentation. save the results
	print ("\tPrediction using {} for unlabelled dataset at epoch {} ...".format(postProc, num_epoch))
	net_deploy = caffe.Net(net_deploy_name,      # defines the structure of the model
	                new_weight_file, caffe.TEST)

	copyfile(original_train_filenames, nameTmpTrainFiles)
	train_tmp_file = open(nameTmpTrainFiles, "a")

	dice_patients_W_unlab = {}
	dice_patients_Wo_unlab = {}
	dice_patients_W_test = {}
	dice_patients_Wo_test = {}

	for patientNum in mri3D_unlab.keys():
		for i in range(mri3D_unlab[patientNum].shape[2]):
			hm3D_unlab[patientNum][:,:,:, i] = get_heat_map(mri3D_unlab[patientNum][:,:, i], net_deploy)
			if postProc == "graphcut2D":
				result3D_unlab[patientNum][:,:,i] = graphcut3D(mri3D_unlab[patientNum][:,:,i,np.newaxis], hm3D_unlab[patientNum][:,:,:,i,np.newaxis], lamda=lamda, sigma=sigma, pWeightMax=pWeightMax)[:,:,0]

		predictions = hm3D_unlab[patientNum].argmax(2)

		if postProc == "graphcut3D":
			result3D_unlab[patientNum] = graphcut3D(mri3D_unlab[patientNum], hm3D_unlab[patientNum], lamda=lamda, sigma=sigma, pWeightMax=pWeightMax)
		elif postProc=="noPost":
			result3D_unlab[patientNum] = predictions.copy()

		dice_patients_W_unlab[patientNum] = np.mean(compute_dice_dataset(gt3D_unlab[patientNum], result3D_unlab[patientNum], countBgImgs=True))
		dice_patients_Wo_unlab[patientNum] = np.mean(compute_dice_dataset(gt3D_unlab[patientNum], predictions, countBgImgs=True))

		# print dice_patients_Wo_unlab

		# Save the result to a temporary file and reinject it as input of the CNN
		nameFileInput = unlabelled_inputs_name[patientNum]
		output_name = unlabelled_output_name[patientNum]
		nameFileOutput = "./prediction_tmp/" + suffixe +  "/" +  output_name + ".npy"
		nameFileWeight = "./prediction_tmp/" + suffixe + "/" +  output_name + "_weight.npy"

		createDirectoryPath(repSavePrediction + nameFileOutput)
		np.save(repSavePrediction + nameFileOutput, result3D_unlab[patientNum])

		size_image = (result3D_unlab[patientNum][:,:,i].shape)
		weight = alpha_fg * result3D_unlab[patientNum]+ alpha_bg * (1-result3D_unlab[patientNum])

		np.save(repSavePrediction + nameFileWeight, weight)
		train_tmp_file.write(nameFileInput + "\t" + nameFileOutput + "\t" + nameFileWeight +"\n")

	print ("\t\tMean dice CNN result {} ...".format(np.mean(dice_patients_Wo_unlab.values())))
	print("\t\tSaving dice for the unlabel images in {} ...".format(dice_saveUnlab_filename))
	dice_saveUnlab_file.write(str(num_epoch) + " : " + str(dice_patients_W_unlab) + "\t" + str(dice_patients_Wo_unlab) + "\n")
	dice_saveUnlab_file.close() # I close the file and open it, because i don't want to wait the end of the training to read the results :p I'm not a patient guy
	dice_saveUnlab_file = open(dice_saveUnlab_filename, "a")

	print ("\tPrediction using {} for test dataset at epoch {} ...".format(postProc, num_epoch))
	for patientNum in mri3D_test.keys():
		for i in range(mri3D_test[patientNum].shape[2]):
			hm3D_test[patientNum][:,:,:, i] = get_heat_map(mri3D_test[patientNum][:,:, i], net_deploy)
			if postProc == "graphcut2D":
				result3D_test[patientNum][:,:,i] = graphcut3D(mri3D_test[patientNum][:,:,i,np.newaxis], hm3D_test[patientNum][:,:,:,i,np.newaxis], lamda=lamda, sigma=sigma, pWeightMax=pWeightMax)[:,:,0]

		predictions_test = hm3D_test[patientNum].argmax(2)

		# if postProc == "graphcut3D":
		# 	result3D_test[patientNum] = graphcut3D(mri3D_test[patientNum], hm3D_test[patientNum], lamda=lamda, sigma=sigma, pWeightMax=pWeightMax)
		# elif postProc == "noPost":
		# 	result3D_test[patientNum] = predictions_test.copy()

		# dice_patients_W_test[patientNum] = np.mean(compute_dice_dataset(gt3D_test[patientNum], result3D_test[patientNum], countBgImgs=True))
		dice_patients_Wo_test[patientNum] = np.mean(compute_dice_dataset(gt3D_test[patientNum], predictions_test, countBgImgs=True))

	net_deploy = None
	train_tmp_file.close()

	print ("\t\tMean dice CNN result {} ...".format(np.mean(dice_patients_Wo_test.values())))
	print("\t \tSaving dice for the test images in {} ...".format(dice_saveUnlab_filename))
	dice_saveTest_file.write(str(num_epoch) + " : " + str(dice_patients_Wo_test) + "\t" + str(dice_patients_Wo_test) + "\n")
	dice_saveTest_file.close()
	dice_saveTest_file = open(dice_saveTest_filename, "a")

	if not onlyTest:
		solver = caffe.SGDSolver(solver_name)
		if num_epoch == 0:
			solver.net.copy_from(weight_file)
		else:
			solver.restore(new_weight_file.replace("caffemodel", 'solverstate'))

		if num_epoch != (number_epoch - 1):
			print ("Training for {} itterations".format(k))
			solver.step(k)

	if increment == 1:
		alpha_fg *= 1.1
		alpha_bg *= 1.1

# We remove temporary file
os.remove(nameTmpTrainFiles)
shutil.rmtree(repSavePrediction + "./prediction_tmp/", ignore_errors=True)

print ("end of training")