text:
/* -*- tab-width: 4; -*- */
/* vi: set sw=2 ts=4: */

#ifndef _KTX_H_
#define _KTX_H_

/**
 * @file
 * @~English
 *
 * @brief Declares the public functions and structures of the
 *        KTX API.
 *
 * @author Georg Kolling, Imagination Technology
 * @author with modifications by Mark Callow, HI Corporation
 *
 * $Revision: 21695 $
 * $Date:: 2013-05-23 12:45:33 +0900 #$
 *
 * @todo Find a way so that applications do not have to define KTX_OPENGL{,_ES*}
 *       when using the library.
 */

/*
 * This file copyright (c) 2010 The Khronos Group, Inc.
 */

/**
@~English
@page licensing Licensing

LibKTX contains code

@li (c) 2010 & (c) 2013 The Khronos Group Inc.
@li (c) 2008 and (c) 2010 HI Corporation
@li (c) 2005 Ericsson AB
@li (c) 2003-2010, Troy D. Hanson

A specific copyright is given in each source file.

@section default Default License

With the exception of the files listed explicitly below, the source
files are made available under the following BSD-like license.

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

The above copyright notice and this permission notice shall be included
unaltered in all copies or substantial portions of the Materials.
Any additions, deletions, or changes to the original source files
must be clearly indicated in accompanying documentation.

If only executable code is distributed, then the accompanying
documentation must state that "this software is based in part on the
work of the Khronos Group."

THE MATERIALS ARE 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
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.

@section hi_mark hi_mark{,_sq}.ktx

The HI logo textures are © & ™ HI Corporation and are
provided for use only in testing the KTX loader. Any other use requires
specific prior written permission from HI. Furthermore the name HI may
not be used to endorse or promote products derived from this software
without specific prior written permission.

@section uthash uthash.h

uthash.h is made available under the following revised BSD license.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/**
 * @~English
 * @mainpage The KTX Library
 *
 * @section intro_sec Introduction
 *
 * libktx is a small library of functions for creating KTX (Khronos
 * TeXture) files and instantiating OpenGL® and OpenGL® ES
 * textures from them.
 *
 * For information about the KTX format see the
 *
 * formal specification.
 *
 * The library is open source software. Most of the code is licensed under a
 * modified BSD license. The code for unpacking ETC1, ETC2 and EAC compressed
 * textures has a separate license that restricts it to uses associated with
 * Khronos Group APIs. See @ref licensing for more details.
 *
 * See @ref history for the list of changes.
 *
 * @author Mark Callow, HI Corporation
 * @author Georg Kolling, Imagination Technology
 * @author Jacob Ström, Ericsson AB
 *
 * @version 2.0
 *
 * $Date:: 2013-05-23 12:45:33 #$
 */

#include <stdio.h>

#include "KHR/khrplatform.h"

#if KTX_OPENGL

	#ifdef _WIN32
	  #include <windows.h>
	  #include <GL/glew.h>
    #else
      #define GLCOREARB_PROTOTYPES
      #include <GL/glcorearb.h>
	#endif

	#define GL_APIENTRY APIENTRY
    #define KTX_GLFUNCPTRS "gl_funcptrs.h"

#elif KTX_OPENGL_ES1

	#include <GLES/gl.h>
	#include <GLES/glext.h>

    #define KTX_GLFUNCPTRS "gles1_funcptrs.h"

#elif KTX_OPENGL_ES2

	#include <GLES2/gl2.h>
	#include <GLES2/gl2ext.h>

    #define KTX_GLFUNCPTRS "gles2_funcptrs.h"

#elif KTX_OPENGL_ES3

	#include <GLES3/gl3.h>
	#include <GLES3/gl3ext.h>

    #define KTX_GLFUNCPTRS "gles3_funcptrs.h"

#else
#error Please #define one of KTX_OPENGL, KTX_OPENGL_ES1, KTX_OPENGL_ES2 or KTX_OPENGL_ES3 as 1
#endif

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Key String for standard orientation value.
 */
#define KTX_ORIENTATION_KEY	"KTXorientation"
/**
 * @brief Standard format for 2D orientation value.
 */
#define KTX_ORIENTATION2_FMT "S=%c,T=%c"
/**
 * @brief Standard format for 3D orientation value.
 */
#define KTX_ORIENTATION3_FMT "S=%c,T=%c,R=%c"
/**
 * @brief Required unpack alignment
 */
#define KTX_GL_UNPACK_ALIGNMENT 4

/**
 * @brief Error codes returned by library functions.
 */
typedef enum KTX_error_code_t {
	KTX_SUCCESS = 0,		 /*!< Operation was successful. */
	KTX_FILE_OPEN_FAILED,	 /*!< The target file could not be opened. */
	KTX_FILE_WRITE_ERROR,    /*!< An error occurred while writing to the file. */
	KTX_GL_ERROR,            /*!< GL operations resulted in an error. */
	KTX_INVALID_OPERATION,   /*!< The operation is not allowed in the current state. */
	KTX_INVALID_VALUE,	     /*!< A parameter value was not valid */
	KTX_NOT_FOUND,			 /*!< Requested key was not found */
	KTX_OUT_OF_MEMORY,       /*!< Not enough memory to complete the operation. */
	KTX_UNEXPECTED_END_OF_FILE, /*!< The file did not contain enough data */
	KTX_UNKNOWN_FILE_FORMAT, /*!< The file not a KTX file */
	KTX_UNSUPPORTED_TEXTURE_TYPE, /*!< The KTX file specifies an unsupported texture type. */
} KTX_error_code;

/**
 * @brief structure used to pass information about the texture to ktxWriteKTX
 */
typedef struct KTX_texture_info_t
{
	/**
	 * @brief The type of the image data.
	 *
	 * Values are the same as in the @p type parameter of
     * glTexImage*D. Must be 0 for compressed images.
	 */
	khronos_uint32_t glType;
	/**
	 * @brief The data type size to be used in case of endianness
	 *        conversion.
	 *
	 * This value is used in the event conversion is required when the
	 * KTX file is loaded. It should be the size in bytes corresponding
	 * to glType. Must be 1 for compressed images.
	 */
	khronos_uint32_t glTypeSize;
	/**
	 * @brief The format of the image(s).
	 *
	 * Values are the same as in the format parameter
	 * of glTexImage*D. Must be 0 for compressed images.
     */
	khronos_uint32_t glFormat;
	/** @brief The internalformat of the image(s).
	 *
	 * Values are the same as for the internalformat parameter of
	 * glTexImage*2D. Note: it will not be used when a KTX file
	 * containing an uncompressed texture is loaded into OpenGL ES.
	 */
	khronos_uint32_t glInternalFormat;
    /** @brief The base internalformat of the image(s)
	 *
	 * For non-compressed textures, should be the same as glFormat.
	 * For compressed textures specifies the base internal, e.g.
	 * GL_RGB, GL_RGBA.
     */
	khronos_uint32_t glBaseInternalFormat;
	/** @brief Width of the image for texture level 0, in pixels. */
	khronos_uint32_t pixelWidth;
	/** @brief Height of the texture image for level 0, in pixels.
	 *
	 * Must be 0 for 1D textures.
	 */
 	khronos_uint32_t pixelHeight;
	/** @brief Depth of the texture image for level 0, in pixels.
	 *
	 * Must be 0 for 1D, 2D and cube textures.
	 */
	khronos_uint32_t pixelDepth;
	/** @brief The number of array elements.
	 *
	 * Must be 0 if not an array texture.
	 */
	khronos_uint32_t numberOfArrayElements;
	/** @brief The number of cubemap faces.
	 *
	 * Must be 6 for cubemaps and cubemap arrays, 1 otherwise. Cubemap
     * faces must be provided in the order: +X, -X, +Y, -Y, +Z, -Z.
	 */
	khronos_uint32_t numberOfFaces;
    /** @brief The number of mipmap levels.
	 *
     * 1 for non-mipmapped texture. 0 indicates that a full mipmap pyramid should
     * be generated from level 0 at load time (this is usually not allowed for
	 * compressed formats). Mipmaps must be provided in order from largest size to
	 * smallest size. The first mipmap level is always level 0.
	 */
	khronos_uint32_t numberOfMipmapLevels;
} KTX_texture_info;

/**
 * @brief Structure used to pass image data to ktxWriteKTX.
 */
typedef struct KTX_image_info {
	GLsizei size;	/*!< Size of the image data in bytes. */
	GLubyte* data;  /*!< Pointer to the image data. */
} KTX_image_info;

/**
 * @brief Structure used to return texture dimensions
 */
typedef struct KTX_dimensions {
	GLsizei width;  /*!< */
	GLsizei height; /*!< */
	GLsizei depth;  /*!< */
} KTX_dimensions;

/**
 * @brief Opaque handle to a KTX_hash_table.
 */
typedef void* KTX_hash_table;

/* ktxLoadTextureF
 *
 * Loads a texture from a stdio FILE.
 */
KTX_error_code
ktxLoadTextureF(FILE*, GLuint* pTexture, GLenum* pTarget,
				KTX_dimensions* pDimensions, GLboolean* pIsMipmapped,
				GLenum* pGlerror,
				unsigned int* pKvdLen, unsigned char** ppKvd);

/* ktxLoadTextureN
 *
 * Loads a texture from a KTX file on disk.
 */
KTX_error_code
ktxLoadTextureN(const char* const filename, GLuint* pTexture, GLenum* pTarget,
				KTX_dimensions* pDimensions, GLboolean* pIsMipmapped,
				GLenum* pGlerror,
				unsigned int* pKvdLen, unsigned char** ppKvd);

/* ktxLoadTextureM
 *
 * Loads a texture from a KTX file in memory.
 */
KTX_error_code
ktxLoadTextureM(const void* bytes, GLsizei size, GLuint* pTexture, GLenum* pTarget,
				KTX_dimensions* pDimensions, GLboolean* pIsMipmapped,
				GLenum* pGlerror,
				unsigned int* pKvdLen, unsigned char** ppKvd);

/* ktxWriteKTXF
 *
 * Writes a KTX file using supplied data.
 */
KTX_error_code
ktxWriteKTXF(FILE*, const KTX_texture_info* imageInfo,
			 GLsizei bytesOfKeyValueData, const void* keyValueData,
			 GLuint numImages, KTX_image_info images[]);

/* ktxWriteKTXN
 *
 * Writes a KTX file using supplied data.
 */
KTX_error_code
ktxWriteKTXN(const char* dstname, const KTX_texture_info* imageInfo,
			 GLsizei bytesOfKeyValueData, const void* keyValueData,
			 GLuint numImages, KTX_image_info images[]);

/* ktxErrorString()
 *
 * Returns a string corresponding to a KTX error code.
 */
const char* const ktxErrorString(KTX_error_code error);

/* ktxHashTable_Create()
 *
 * Creates a key-value hash table
 */
KTX_hash_table ktxHashTable_Create();

/* ktxHashTable_Destroy()
 *
 * Destroys a key-value hash table
 */
void ktxHashTable_Destroy(KTX_hash_table This);

/* ktxHashTable_AddKVPair()
 *
 * Adds a key-value pair to a hash table.
 */
KTX_error_code
ktxHashTable_AddKVPair(KTX_hash_table This, const char* key,
					   unsigned int valueLen, const void* value);

/* ktxHashTable_FindValue()
 *
 * Looks up a key and returns the value.
 */
KTX_error_code
ktxHashTable_FindValue(KTX_hash_table This, const char* key,
					   unsigned int* pValueLen, void** pValue);

/* ktxHashTable_Serialize()
 *
 * Serializes the hash table to a block of memory suitable for
 * writing to a KTX file.
 */
KTX_error_code
ktxHashTable_Serialize(KTX_hash_table This, unsigned int* kvdLen, unsigned char** kvd);

/* ktxHashTable_Deserialize()
 *
 * Creates a hash table from the serialized data read from a
 * a KTX file.
 */
KTX_error_code
ktxHashTable_Deserialize(unsigned int kvdLen, void* kvd, KTX_hash_table* pKvt);

#ifdef __cplusplus
}
#endif

/**
@page history Revision History

@section v3 Version 2.0
Added:
@li support for decoding ETC2 and EAC formats in the absence of a hardware
    decoder.
@li support for converting textures with legacy LUMINANCE, LUMINANCE_ALPHA,
    etc. formats to the equivalent R, RG, etc. format with an
	appropriate swizzle, when loading in OpenGL Core Profile contexts.
@li ktxErrorString function to return a string corresponding to an error code.
@li	tests for ktxLoadTexture[FN] that run under OpenGL ES 3.0 and OpenGL 3.3.
    The latter includes an EGL on WGL wrapper that makes porting apps between
	OpenGL ES and OpenGL easier on Windows.
@li more texture formats to ktxLoadTexture[FN] and toktx tests.

Changed:
@li ktxLoadTexture[FMN] to discover the capabilities of the GL context at
    run time and load textures, or not, according to those capabilities.

Fixed:
@li failure of ktxWriteKTXF to pad image rows to 4 bytes as required by the KTX
    format.
@li ktxWriteKTXF exiting with KTX_FILE_WRITE_ERROR when attempting to write
    more than 1 byte of face-LOD padding.

Although there is only a very minor API change, the addition of ktxErrorString, the functional changes
are large enough to justify bumping the major revision number.

@section v2 Version 1.0.1
Implemented ktxLoadTextureM.
Fixed the following:
@li Public Bugzilla 571: crash when null passed for pIsMipmapped.
@li Public Bugzilla 572: memory leak when unpacking ETC textures.
@li Public Bugzilla 573: potential crash when unpacking ETC textures with unused padding pixels.
@li Public Bugzilla 576: various small fixes.

Thanks to Krystian Bigaj for the ktxLoadTextureM implementation and these fixes.

@section v1 Version 1.0
Initial release.

*/

#endif /* _KTX_H_ */


text:
New content

Lorem ipsum dolor sit amet. Aliquam erat volutpat. Maecenas non
	tortor nulla, non malesuada velit.

Aliquam erat volutpat. Maecenas non tortor nulla, non malesuada
	velit. Nullam felis tellus, tristique nec egestas in, luctus sed diam.
	Suspendisse potenti.

Consectetur adipiscing elit. Nulla consectetur libero consectetur
	quam consequat nec tincidunt massa feugiat. Donec egestas mi turpis.
	Fusce adipiscing dui eu metus gravida vel facilisis ligula iaculis.
	Cras a rhoncus massa. Donec sed purus eget nunc placerat consequat.

Cras venenatis condimentum nibh a mollis. Duis id sapien nibh.
	Vivamus porttitor, felis quis blandit tincidunt, erat magna scelerisque
	urna, a faucibus erat nisl eget nisl. Aliquam consequat turpis id velit
	egestas a posuere orci semper. Mauris suscipit erat quis urna
	adipiscing ultricies. In hac habitasse platea dictumst. Nulla
	scelerisque lorem quis dui sagittis egestas.

redpajama_set_name: RedPajamaGithub


text:
#ifndef MICROPY_INCLUDED_STMHAL_TIMER_H
#define MICROPY_INCLUDED_STMHAL_TIMER_H

extern TIM_HandleTypeDef TIM5_Handle;

extern const mp_obj_type_t pyb_timer_type;

void timer_init0(void);
void timer_tim5_init(void);
TIM_HandleTypeDef *timer_tim6_init(uint freq);
void timer_deinit(void);
uint32_t timer_get_source_freq(uint32_t tim_id);
void timer_irq_handler(uint tim_id);

TIM_HandleTypeDef *pyb_timer_get_handle(mp_obj_t timer);

#endif // MICROPY_INCLUDED_STMHAL_TIMER_H


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">JniBitmapOperationsTest</string>
    <string name="action_settings">Settings</string>
    <string name="repository_website">Repository website</string>
    <string name="all_my_repositories">All my repositories</string>
    <string name="all_my_apps">All my apps</string>
    <string name="more_info">More info</string>

</resources>


text:
/**
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.deephacks.confit.test.validation;

import org.deephacks.confit.model.Bean;
import org.deephacks.confit.model.BeanId;

import java.io.PrintStream;
import java.util.Arrays;
import java.util.Deque;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

public class BinaryTreeUtils {

    public static Set<Bean> getTree(Integer root, List<Integer> children) {
        Node rootNode = new Node(root);
        for (int i : children) {
            rootNode.insert(i);
        }
        Set<Bean> beans = new HashSet<>();
        rootNode.traverse(beans, null);
        return beans;
    }

    public static Bean getBean(int i, Set<Bean> beans) {
        for (Bean bean : beans) {
            if (new Integer(bean.getId().getInstanceId()).intValue() == i) {
                return bean;
            }
        }
        return null;
    }

    public static class Node {
        int value = 0;
        public Node left;
        public Node right;

        Node(int value) {
            this.value = value;
        }

        public Bean traverse(Set<Bean> beans, Bean parent) {
            Bean current = Bean.create(BeanId.create(value + "", "binarytree"));
            current.setProperty("value", value + "");
            if (parent != null) {
                current.setReference("parent", parent.getId());
            }
            if (left != null) {
                Bean leftBean = left.traverse(beans, current);
                current.setReference("left", leftBean.getId());
            }
            if (right != null) {
                Bean rightBean = right.traverse(beans, current);
                current.setReference("right", rightBean.getId());
            }
            beans.add(current);
            return current;
        }

        public void insert(int insert) {
            if (value == insert) {
                return;
            }
            if (value > insert) {
                if (left != null) {
                    left.insert(insert);
                } else {
                    left = new Node(insert);
                }
            } else {
                if (right != null) {
                    right.insert(insert);
                } else {
                    right = new Node(insert);
                }
            }
        }

        public Node delete(int delete) {
            if (value == delete) {
                if (left != null && right != null) {

                    Node x = right;
                    while (x.left != null) {
                        x = x.left;
                    }

                    value = x.value;
                    x.value = delete;
                    right = right.delete(delete);

                    return this;
                } else if (left != null) {
                    return left;
                } else if (right != null) {
                    return right;
                } else {
                    return null;
                }
            } else if (value > delete) {
                left = (left == null) ? null : left.delete(delete);
                return this;
            } else {
                right = (right == null) ? null : right.delete(delete);
                return this;
            }
        }

        public String toString() {
            return value + "";
        }
    }

    public static void printPretty(BinaryTree root) {
        TreePrinter.printPretty(root, 1, 0, new TreePrinter.PaddedWriter(System.out));

    }

    private static class TreePrinter {

        // Search for the deepest part of the tree
        private static <T> int maxHeight(BinaryTree t) {
            if (t == null)
                return 0;
            int leftHeight = maxHeight(t.getLeft());
            int rightHeight = maxHeight(t.getRight());
            return (leftHeight > rightHeight) ? leftHeight + 1 : rightHeight + 1;
        }

        // Pretty formatting of a binary tree to the output stream
        public static <T> void printPretty(BinaryTree tree, int level, int indentSpace,
                PaddedWriter out) {
            int h = maxHeight(tree);
            int BinaryTreesInThisLevel = 1;
            int branchLen = 2 * ((int) Math.pow(2.0, h) - 1) - (3 - level)
                    * (int) Math.pow(2.0, h - 1);
            int BinaryTreeSpaceLen = 2 + (level + 1) * (int) Math.pow(2.0, h);
            int startLen = branchLen + (3 - level) + indentSpace;

            Deque<BinaryTree> BinaryTreesQueue = new LinkedList<BinaryTree>();
            BinaryTreesQueue.offerLast(tree);
            for (int r = 1; r < h; r++) {
                printBranches(branchLen, BinaryTreeSpaceLen, startLen, BinaryTreesInThisLevel,
                        BinaryTreesQueue, out);
                branchLen = branchLen / 2 - 1;
                BinaryTreeSpaceLen = BinaryTreeSpaceLen / 2 + 1;
                startLen = branchLen + (3 - level) + indentSpace;
                printBinaryTrees(branchLen, BinaryTreeSpaceLen, startLen, BinaryTreesInThisLevel,
                        BinaryTreesQueue, out);

                for (int i = 0; i < BinaryTreesInThisLevel; i++) {
                    BinaryTree currBinaryTree = BinaryTreesQueue.pollFirst();
                    if (currBinaryTree != null) {
                        BinaryTreesQueue.offerLast(currBinaryTree.getLeft());
                        BinaryTreesQueue.offerLast(currBinaryTree.getRight());
                    } else {
                        BinaryTreesQueue.offerLast(null);
                        BinaryTreesQueue.offerLast(null);
                    }
                }
                BinaryTreesInThisLevel *= 2;
            }
            printBranches(branchLen, BinaryTreeSpaceLen, startLen, BinaryTreesInThisLevel,
                    BinaryTreesQueue, out);
            printLeaves(indentSpace, level, BinaryTreesInThisLevel, BinaryTreesQueue, out);
        }

        private static <T> void printBranches(int branchLen, int BinaryTreeSpaceLen, int startLen,
                int BinaryTreesInThisLevel, Deque<BinaryTree> BinaryTreesQueue, PaddedWriter out) {
            Iterator<BinaryTree> iterator = BinaryTreesQueue.iterator();
            for (int i = 0; i < BinaryTreesInThisLevel / 2; i++) {
                if (i == 0) {
                    out.setw(startLen - 1);
                } else {
                    out.setw(BinaryTreeSpaceLen - 2);
                }
                out.write();
                BinaryTree next = iterator.next();
                if (next != null) {
                    out.write("/");
                } else {
                    out.write(" ");
                }
                out.setw(2 * branchLen + 2);
                out.write();
                next = iterator.next();
                if (next != null) {
                    out.write("\\");
                } else {
                    out.write(" ");
                }
            }
            out.endl();
        }

        // Print the branches and BinaryTree (eg, ___10___ )
        private static <T> void printBinaryTrees(int branchLen, int BinaryTreeSpaceLen,
                int startLen, int BinaryTreesInThisLevel, Deque<BinaryTree> BinaryTreesQueue,
                PaddedWriter out) {
            Iterator<BinaryTree> iterator = BinaryTreesQueue.iterator();
            BinaryTree currentBinaryTree;
            for (int i = 0; i < BinaryTreesInThisLevel; i++) {
                currentBinaryTree = iterator.next();
                if (i == 0) {
                    out.setw(startLen);
                } else {
                    out.setw(BinaryTreeSpaceLen);
                }
                out.write();
                if (currentBinaryTree != null && currentBinaryTree.getLeft() != null) {
                    out.setfill('_');
                } else {
                    out.setfill(' ');
                }
                out.setw(branchLen + 2);
                if (currentBinaryTree != null) {
                    out.write(currentBinaryTree.toString());
                } else {
                    out.write();
                }
                if (currentBinaryTree != null && currentBinaryTree.getRight() != null) {
                    out.setfill('_');
                } else {
                    out.setfill(' ');
                }
                out.setw(branchLen);
                out.write();
                out.setfill(' ');
            }
            out.endl();
        }

        // Print the leaves only (just for the bottom row)
        private static <T> void printLeaves(int indentSpace, int level, int BinaryTreesInThisLevel,
                Deque<BinaryTree> BinaryTreesQueue, PaddedWriter out) {
            Iterator<BinaryTree> iterator = BinaryTreesQueue.iterator();
            BinaryTree currentBinaryTree;
            for (int i = 0; i < BinaryTreesInThisLevel; i++) {
                currentBinaryTree = iterator.next();
                if (i == 0) {
                    out.setw(indentSpace + 2);
                } else {
                    out.setw(2 * level + 2);
                }
                if (currentBinaryTree != null) {
                    out.write(currentBinaryTree.toString());
                } else {
                    out.write();
                }
            }
            out.endl();
        }

        public static class PaddedWriter {
            private int width = 0;
            private char fillChar = ' ';
            private final PrintStream writer;

            public PaddedWriter(PrintStream writer) {
                this.writer = writer;
            }

            void setw(int i) {
                width = i;
            }

            void setfill(char c) {
                fillChar = c;
            }

            void write(String str) {
                write(str.toCharArray());
            }

            void write(char[] buf) {
                if (buf.length < width) {
                    char[] pad = new char[width - buf.length];
                    Arrays.fill(pad, fillChar);
                    writer.print(pad);
                }
                writer.print(buf);
                setw(0);
            }

            void write() {
                char[] pad = new char[width];
                Arrays.fill(pad, fillChar);
                writer.print(pad);
                setw(0);
            }

            void endl() {
                writer.println();
                setw(0);
            }
        }
    }

}


text:
```typescript
scrollLeft: (node: HTMLElement) => number;
scrollLeft: (node: HTMLElement, value: number) => void;

scrollTop: (node: HTMLElement) => number;
scrollTop: (node: HTMLElement, value: number) => void;
```

<!--start-code-->

```js
class Demo extends React.Component {
  render() {
    return (
      <div>
        <ButtonToolbar>
          <Button
            onClick={() => {
              scrollTop(window, 1500);
            }}
          >
            scrollTop 1500
          </Button>

          <Button
            onClick={() => {
              alert(scrollTop(window));
            }}
          >
            get scrollTop
          </Button>
        </ButtonToolbar>
      </div>
    );
  }
}

ReactDOM.render(<Demo />);
```

<!--end-code-->


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="generator" content="rustdoc">
    <title>The (old) Rust Pointer Guide</title>

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

    <link rel="shortcut icon" href="http://www.rust-lang.org/favicon.ico">

  Rust 1.0.0-nightly

  cfea8ec41

The (old) Rust Pointer Guide

This content has moved into
the Rust Programming Language book.

Copyright © 2011-2015 The Rust Project Developers. Licensed under the
Apache License, Version 2.0
or the MIT license, at your option.

This file may not be copied, modified, or distributed except according to those terms.


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <color name="default_blue">#03A9F4</color>

    <color name="light_blue">#81D4FA</color>

    <color name="default_white">#FFFFFF</color>

    <color name="hint_background">#D0D0D0</color>

</resources>


text:
package com.airbnb.lottie.parser;

import com.airbnb.lottie.LottieComposition;
import com.airbnb.lottie.model.animatable.AnimatableColorValue;
import com.airbnb.lottie.model.animatable.AnimatableFloatValue;
import com.airbnb.lottie.model.animatable.AnimatableIntegerValue;
import com.airbnb.lottie.model.content.ShapeStroke;
import com.airbnb.lottie.parser.moshi.JsonReader;
import com.airbnb.lottie.value.Keyframe;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

class ShapeStrokeParser {

  private static final JsonReader.Options NAMES = JsonReader.Options.of(
      "nm",
      "c",
      "w",
      "o",
      "lc",
      "lj",
      "ml",
      "hd",
      "d"
  );
  private static final JsonReader.Options DASH_PATTERN_NAMES = JsonReader.Options.of(
      "n",
      "v"
  );

  private ShapeStrokeParser() {
  }

  static ShapeStroke parse(
      JsonReader reader, LottieComposition composition) throws IOException {
    String name = null;
    AnimatableColorValue color = null;
    AnimatableFloatValue width = null;
    AnimatableIntegerValue opacity = null;
    ShapeStroke.LineCapType capType = null;
    ShapeStroke.LineJoinType joinType = null;
    AnimatableFloatValue offset = null;
    float miterLimit = 0f;
    boolean hidden = false;

    List<AnimatableFloatValue> lineDashPattern = new ArrayList<>();

    while (reader.hasNext()) {
      switch (reader.selectName(NAMES)) {
        case 0:
          name = reader.nextString();
          break;
        case 1:
          color = AnimatableValueParser.parseColor(reader, composition);
          break;
        case 2:
          width = AnimatableValueParser.parseFloat(reader, composition);
          break;
        case 3:
          opacity = AnimatableValueParser.parseInteger(reader, composition);
          break;
        case 4:
          capType = ShapeStroke.LineCapType.values()[reader.nextInt() - 1];
          break;
        case 5:
          joinType = ShapeStroke.LineJoinType.values()[reader.nextInt() - 1];
          break;
        case 6:
          miterLimit = (float) reader.nextDouble();
          break;
        case 7:
          hidden = reader.nextBoolean();
          break;
        case 8:
          reader.beginArray();
          while (reader.hasNext()) {
            String n = null;
            AnimatableFloatValue val = null;

            reader.beginObject();
            while (reader.hasNext()) {
              switch (reader.selectName(DASH_PATTERN_NAMES)) {
                case 0:
                  n = reader.nextString();
                  break;
                case 1:
                  val = AnimatableValueParser.parseFloat(reader, composition);
                  break;
                default:
                  reader.skipName();
                  reader.skipValue();
              }
            }
            reader.endObject();

            switch (n) {
              case "o":
                offset = val;
                break;
              case "d":
              case "g":
                composition.setHasDashPattern(true);
                lineDashPattern.add(val);
                break;
            }
          }
          reader.endArray();

          if (lineDashPattern.size() == 1) {
            // If there is only 1 value then it is assumed to be equal parts on and off.
            lineDashPattern.add(lineDashPattern.get(0));
          }
          break;
        default:
          reader.skipValue();
      }
    }

    // Telegram sometimes omits opacity.
    // https://github.com/airbnb/lottie-android/issues/1600
    opacity = opacity == null ? new AnimatableIntegerValue(Collections.singletonList(new Keyframe<>(100))) : opacity;
    return new ShapeStroke(
        name, offset, lineDashPattern, color, opacity, width, capType, joinType, miterLimit, hidden);
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#10a7c6</color>
    <color name="colorPrimaryDark">#0c6a71</color>
    <color name="colorAccent">#FF4081</color>
    <color name="year">#999999</color>
    <color name="idColor">#c60748</color>
    <color name="title">#222222</color>
    <color name="transparente">#00FFFFFF</color>
    <color name="white">#f5f1f1</color>
</resources>


text:
<title>Other Directives - The C Preprocessor</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="The C Preprocessor">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Pragmas.html#Pragmas" title="Pragmas">
<link rel="next" href="Preprocessor-Output.html#Preprocessor-Output" title="Preprocessor Output">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Preprocessor Output,
Previous: Pragmas,
Up: Top

8 Other Directives

The `<samp>#ident</samp>' directive takes one argument, a string constant.  On
some systems, that string constant is copied into a special segment of
the object file.  On other systems, the directive is ignored.  The
`<samp><span class="samp">#sccs</span></samp>' directive is a synonym for `<samp>#ident</samp>'.

These directives are not part of the C standard, but they are not
official GNU extensions either.  What historical information we have
been able to find, suggests they originated with System V.

The <dfn>null directive</dfn> consists of a `<samp>#</samp>' followed by a newline,
with only whitespace (including comments) in between.  A null directive
is understood as a preprocessing directive but has no effect on the
preprocessor output.  The primary significance of the existence of the
null directive is that an input line consisting of just a `<samp>#</samp>' will
produce no output, rather than a line of output containing just a
`<samp>#</samp>'.  Supposedly some old C programs contain such lines.


text:
test_description='git svn merge detection'
. ./lib-git-svn.sh

svn_ver="$(svn --version --quiet)"
case $svn_ver in
0.* | 1.[0-4].*)
	skip_all="skipping git-svn test - SVN too old ($svn_ver)"
	test_done
	;;
esac

test_expect_success 'initialize source svn repo' '
	svn_cmd mkdir -m x "$svnrepo"/trunk &&
	svn_cmd mkdir -m x "$svnrepo"/branches &&
	svn_cmd co "$svnrepo"/trunk "$SVN_TREE" &&
	(
		cd "$SVN_TREE" &&
		touch foo &&
		svn add foo &&
		svn commit -m "initial commit" &&
		svn cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch1 &&
		touch bar &&
		svn add bar &&
		svn commit -m x &&
		svn cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch2 &&
		svn switch "$svnrepo"/branches/branch1 &&
		touch baz &&
		svn add baz &&
		svn commit -m x &&
		svn switch "$svnrepo"/trunk &&
		svn merge "$svnrepo"/branches/branch1 &&
		svn commit -m "merge" &&
		svn switch "$svnrepo"/branches/branch1 &&
		svn commit -m x &&
		svn switch "$svnrepo"/branches/branch2 &&
		svn merge "$svnrepo"/branches/branch1 &&
		svn commit -m "merge branch1" &&
		svn switch "$svnrepo"/trunk &&
		svn merge "$svnrepo"/branches/branch2 &&
		svn resolved baz &&
		svn commit -m "merge branch2"
	) &&
	rm -rf "$SVN_TREE"
'

test_expect_success 'clone svn repo' '
	git svn init -s "$svnrepo" &&
	git svn fetch
'

test_expect_success 'verify merge commit' 'git rev-parse HEAD^2'

test_done


text:
package checks

import (
	"fmt"
	"time"

	maps "github.com/ashwanthkumar/golang-utils/maps"
	"github.com/gambol99/go-marathon"
)

// Checks for minimum instances of an app running with respect to total # of instances that is
// supposed to run
type MinInstances struct {
	// DefaultWarningThreshold - overriden using alerts.min-instances.warning
	DefaultWarningThreshold float32
	// DefaultCriticalThreshold - overriden using alerts.min-instances.fail
	DefaultCriticalThreshold float32
}

func (n *MinInstances) Name() string {
	return "min-instances"
}

func (n *MinInstances) Check(app marathon.Application) AppCheck {
	failThreshold := maps.GetFloat32(app.Labels, "alerts.min-instances.critical.threshold", n.DefaultCriticalThreshold)
	warnThreshold := maps.GetFloat32(app.Labels, "alerts.min-instances.warn.threshold", n.DefaultWarningThreshold)
	result := Pass
	currentlyRunning := float32(app.TasksHealthy + app.TasksStaged)
	message := fmt.Sprintf("Only %d are healthy out of total %d", int(currentlyRunning), app.Instances)

	if currentlyRunning == 0.0 && app.Instances > 0 {
		result = Critical
	} else if currentlyRunning > 0.0 && currentlyRunning < failThreshold*float32(app.Instances) {
		result = Critical
	} else if currentlyRunning < warnThreshold*float32(app.Instances) {
		result = Warning
	} else {
		message = fmt.Sprintf("We now have %d healthy out of total %d", app.TasksHealthy, app.Instances)
	}

	return AppCheck{
		App:       app.ID,
		Labels:    app.Labels,
		CheckName: n.Name(),
		Result:    result,
		Message:   message,
		Timestamp: time.Now(),
	}
}


text:
<title>
McCain stands by attack ad - UPI.com
</title>
<link rel="stylesheet" type="text/css" href="http://www.upi.com/global/css/global.css">

<link rel="shortcut icon" href="http://www.upi.com/favicon.ico">

<link rel="stylesheet" type="text/css" href="http://www.upi.com/inc/css/common.css">

<link rel="stylesheet" type="text/css" href="http://www.upi.com/inc/css/smalltype.css" title="smalltype">

<link rel="stylesheet" type="text/css" href="http://www.upi.com/inc/css/largetype.css" title="largetype">

<link rel="alternate" type="application/rss+xml" title="NewsTrack - Top News" href="http://www.upi.com/rss/NewsTrack/Top_News/">

<link rel="alternate" type="application/rss+xml" title="NewsTrack - Science" href="http://www.upi.com/rss/NewsTrack/Science/">

<link rel="alternate" type="application/rss+xml" title="NewsTrack - Business" href="http://www.upi.com/rss/NewsTrack/Business/">

<link rel="alternate" type="application/rss+xml" title="NewsTrack - Entertainment" href="http://www.upi.com/rss/NewsTrack/Entertainment/">

<link rel="alternate" type="application/rss+xml" title="NewsTrack - Sports" href="http://www.upi.com/rss/NewsTrack/Sports/">

<link rel="alternate" type="application/rss+xml" title="NewsTrack - Health" href="http://www.upi.com/rss/NewsTrack/Health/">

<link rel="alternate" type="application/rss+xml" title="NewsTrack - Quirks" href="http://www.upi.com/rss/NewsTrack/Quirks/">

<link rel="alternate" type="application/rss+xml" title="International Security - Emerging Threats - Briefing" href="http://www.upi.com/rss/International_Security/Emerging_Threats/Briefing/">

<link rel="alternate" type="application/rss+xml" title="International Security - Emerging Threats - Analysis" href="http://www.upi.com/rss/International_Security/Emerging_Threats/Analysis/">

<link rel="alternate" type="application/rss+xml" title="International Security - Energy - Briefing" href="http://www.upi.com/rss/International_Security/Energy/Briefing/">

<link rel="alternate" type="application/rss+xml" title="International Security - Energy - Analysis" href="http://www.upi.com/rss/International_Security/Energy/Analysis/">

<link rel="alternate" type="application/rss+xml" title="International Security - Industry - Briefing" href="http://www.upi.com/rss/International_Security/Industry/Briefing/">

<link rel="alternate" type="application/rss+xml" title="International Security - Industry - Analysis" href="http://www.upi.com/rss/International_Security/Industry/Analysis/">

My Account

Home

Top News

Science

Business

Entertainment

Sports

Health

Quirks

Newspictures

Emerging Threats

Energy Resources

Security Industry

<form width="200px" id="searchFormT" action="javascript:void(0)">
<input class="x-nc-invisible">

Search:
<select name="sLocation" class="sLocation">
<option value="sStories">
Stories
</option>
<option value="sHeadlines">
Headlines
</option>
<option value="sWriter">
Writer
</option>
<option value="sPhotos">
Photos
</option>
</select>
<input name="ss" class="ss" value="" type="text">

»

Search

</form>

<map name="m_upi_newsletter_mobile" id="m_upi_newsletter_mobile">
<area shape="rect" coords="339,0,474,80" href="http://my.upi.com/register/">

<area shape="rect" coords="0,0,109,80" href="http://m.upi.com/">

<area shape="rect" coords="148,55,327,76" href="http://my.upi.com/register/">

<area shape="rect" coords="108,30,287,51" href="http://m.upi.com/">

</map>

Top News

RSS Feed

McCain stands by attack ad

Published: Dec. 30, 2007 at  8:20 PM

Print story

Email to a friend

Font size:

WASHINGTON,  Dec. 30 (UPI) --

U.S. Sen. John McCain, R-Ariz., Sunday defended the use of the term "phony" in his campaign advertising to describe GOP presidential rival Mitt Romney.

Romney, a former governor of Massachusetts, called the ad -- which included the "phony" designation used by the Concord Monitor in its editorial supporting McCain -- a "nasty" personal attack. McCain, appearing on ABC's "This Week with George Stephanopoulos," refrained from calling Romney a phony during the telecast but said Romney has switched positions on issues and it is OK to use what others have said about Romney in his advertising.

"I paid for the ad that put up the words of the respected newspapers here in the state of New Hampshire and I think that's perfectly appropriate," McCain said. "I think he's a person who's changed his position on many issues and the voters know that and they'll decide that, but that's what I will continue to quote from ... ."

McCain said his campaign is financially strong and he will not apply for federal matching funds unless the situation warrants it.

"I've never run a campaign on money," he said, "and here in New Hampshire and in South Carolina it's the retail politics at work and what wins elections, not money."

© 2007 United Press International. All Rights Reserved.

This material may not be reproduced, redistributed, or manipulated in any form.

Print story

Order reprints

Email to a friend

Post comment

Share this story:

Digg

Del.icio.us

See Also:

Lack of front-runner splitting GOP

John McCain gaining ground in GOP field

Romney focuses attacks on McCain

Romney ads target Huckabee in Iowa

»

Next in Top News:

Clinton claims she has real experience

Former Massachusetts Gov. Mitt Romney speaks at the Des Moines Register Republican Presidential Debate in Johnston, Iowa on December 12, 2007. This debate is the last before the Iowa caucuses.  (UPI Photo/Andrea Melendez/POOL)

Republicans presidential candidates debate in Iowa

Latest Headlines

Analysis: Biofuels law attracts opposition

Kuznetsova sails into Australian 2nd round

Wood recovering from hernia operation

'Good Masters!' wins Newbery Award

Iraq to need U.S. security help until 2018

Australia turns down uranium sale to India

India to buy 140 Howitzers

ONGC strikes gas in Mahanadi basin

»

view more...

Most Popular

'Weird' Michigan primary under way

Iraq factions join against Kurd oil deals

Kenyan parliament reopens in acrimony

Fluctuations in stream flow are discovered

UPI NewsTrack TopNews

Russian bus with 12 aboard missing

China-made toy wrestler figures recalled

Thompson Files: Air tanker showdown

News Quirks

Watercooler Stories

Jockstrip: The world as we know it.

Your Daily Horoscope

The almanac

Colorado lawmaker kicks photographer

Parrots get new home

UPI NewsTrack Quirks in the News

Teen may be responsible for small riot

»

view more...

Zogby/UPI Polls

UPI Poll: Foreign policy top U.S. issue

UPI Poll: U.S. candidates and Iraq

UPI Poll: One-quarter know Iraq casualties

UPI Poll: Most oppose war in Iraq

UPI Poll: Bush, Congress poor on Iraq

UPI Poll: Looking to leave Iraq

UPI Poll: Petraeus's accuracy

UPI Poll: Watching the Iraq debate

»

view more...

Latest Videos

"High School Musical" cast returns for third film

Romney leads in Michigan primary

"Sweeney Todd" and "Atonement" honored at Globes

John Kerry endorses Obama for president

Britney Spears vacations in Mexico

Bush optimistic about Mideast treaty by 2009

Bush expects Mideast peace treaty by next year

»

view more...

Video

|

Official Government Wires

|

Marketplace

|

Merchandise Store

UPI en Español

<form width="200px" id="searchFormB" action="javascript:void(0)">
<input class="x-nc-invisible">

Search:
<select name="sLocation" class="sLocation">
<option value="sStories">
Stories
</option>
<option value="sHeadlines">
Headlines
</option>
<option value="sWriter">
Writer
</option>
<option value="sPhotos">
Photos
</option>
</select>
<input name="ss" class="ss" value="" type="text">

»

Search

</form>

© 2008 United Press International, Inc. All Rights Reserved.

About UPI

|

Site Map

|

Affiliates

|

Terms of Use

|

Privacy Policy

|

Careers

|

Advertise Online

|

Contact Us

United Press International, UPI, the UPI logo, and other trademarks and service marks, are registered or unregistered trademarks of United Press International, Inc. in the United States and in other countries.

Sponsored Links:

Auto Dealers

-

College Football Tickets

-

Low Rate Loans

-

Shareware and Freeware Download

-

Software Download Center

-

tattoos

-

Compare Electric Companies in Texas

-

home care - home health care

-

PC Games

-

Prom dresses and gowns

-

Texas Electric

-

Windows Software

-

Printer Paper

-

Conventions - Trade Shows - Conferences

-

Motivational Sports Speakers Bureau

-

Press Release Services

-

Real Estate Properties in the world


text:
/**
 * Created by Administrator on 2014/10/10.
 */
var Px = window.Px = {};

var Tweener = P.require('P.base.utils.tweener'),
    feature = P.require('P.base.feature'),
    utils = P.require('P.base.utils'),
    dom = P.require('P.base.dom'),
    services = P.require('P.base.services'),
    anim = P.require('P.anim.Anim');

P.provide("P.control.AddressControl" , "P.control.Control",{
    initialize: function (opts) {
        P.setOptions(this, opts);
        this._initDom();
    },

    _initDom:function(){
        this._container = P.creat("div" , null , "pano-control-address", null, "transform: translateZ(1000000000000px);z-index:99999;;position: absolute; left: 0;top: 0;display:block;font-size:12px;text-shadow: rgba(0, 0, 0,0.8) 1px 1px 3px;color:#fff;font-family:arial,'microsoft yahei';padding:8px;text-align:left;");
        this._address = P.creat("div",null,"pano-control-ars",this._container,"border-bottom:rgba(255,255,255,0.6) solid 1px;padding:5px 0;");
        this._date = P.creat("div",null,"pano-control-imagedate",this._container,"padding:5px 0;");
        this.setDate();
    },

    setDate : function(v){
        this._address.innerHTML = v;
    },

    onAdd:function(){
        this._pano.addEventListener("pano_changed" , P.bind(this._onChangePano , this));
       // P.on(this._pano,"click", P.bind(this._onToggle , this));
    }
    ,

    _onChangePano : function(){
        var time = this._pano._panoData.imageDate;
        var copy = this._pano._panoData.copyright;
            copy = "©"+ copy + "";
        var self = this;
        this._date.innerHTML = copy + "拍摄时间:" + time+"";

        services.geoCoder(this._pano.getPosition() , function(d){

            self.setDate(d);
        } , this._pano.options.provider.key)
    }

});

P.extra = {};
P.extra.Sound = function(el){
    this.init(el);
};

P.extra.Sound.prototype = {
    list : {},
    _container : null,
    _autoInit : false,
    singleInstance : P.base.feature.mobile,

    init:function(el){
        this._container = el;
        this._initAutoAudio();
    },
    _initAutoAudio : function() {

        //http://www.iandevlin.com/blog/2012/09/html5/html5-media-and-data-uri
        var event = feature.touch ? "touchend" : "mouseup";
        P.on(document, event, P.bind(function () {
            if (this._autoInit == true) return;
             var audio = this._creat();
             //audio.load("data:audio/mp3;base64,//uwxAADwAABpAAAACAAADSAAAAETEFNRTMuOTkuNVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVUxBTUUzLjk5LjVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=","audio_check",false,0);
             //audio.play();
            //alert();
            for (var i in this.list) {
                var audio = this.list[i];
                if (audio.autoplay && audio.paused) audio.play();
            }
            this._autoInit = true;

        }, this))
    },
    _creat :function(){
        var audio = P.creat("audio",null,null,this._container,"");
        return audio;
    }
    ,

    loadQueue:function(list){

    },
    _resumePlayList : [],
    load : function(url , id, repeat , vol , single){
        var aid = id || "audio"+(this.stamp++);

        if(this.singleInstance || single){
            for(var i in this.list){
                if(this.list[i].paused == false && i != aid)
                {
                    this._resumePlayList.push( i );
                    this.list[i].pause();
                }
            }
        }

        if(this.list[aid]){
            this.list[aid].src = url;

        }else {
            var audio = this._creat();
            audio.loop = repeat === true ? true : false;
            audio.autoplay = true;
            audio.src = url;
            //if(audio)
            this.list[aid] = audio;
        }

        if(this.singleInstance || single){
            //this.list[aid].addEventListener("ended" , P.bind(this._onResumeSingle, this));
            if(this.list[aid].bindSingle !== true) {
                P.on(this.list[aid], "ended", this._onResumeSingle, this);
                this.list[aid].bindSingle = true;
            }
        }

        if(vol) this.list[aid].volume = vol;
        if(this._autoInit) this.list[aid].play();
        else this._initAutoAudio(aid);
        return aid;
    },
    _onResumeSingle : function(e){
        if(this._resumePlayList.length)
        {
            var l = this.singleInstance ? 1 : this._resumePlayList.length;
            for(var i=0; i<l;i++)
            {
                this.list[ this._resumePlayList[i] ].play();
            }
        }
        //remove event
        P.un(e.target , "ended" , this._onResumeSingle);
        e.target.bindSingle = false;
    },

    stop : function(id)
    {
        if(this.list[id]){
            this.list[id].stop();
            this._container.removeChild(this.list[id]);
            delete this.list[id];
        }
    },
    pause : function(id){
        if(this.list[id]){
            this.list[id].pause();
        }
    },

    toggle : function(id){
        var audio = this.list[id];
        if(audio){
            if(audio.paused) audio.play();
            else audio.pause();
            return !audio.paused;
        }
    },

    pauseAll : function(){
        for(var i in this.list)
        {
            this.list[i].pause();
        }
        return false;
    },
    toggleAll : function(){
        var s;
        for(var i in this.list)
        {
           s =  this.toggle(i);
        }
        return s;
    },

    _test : function(){
        var k = 0 ,a = 0;
        for(var i in this.list)
        {
            if(this.list[i].paused == false) k++;
            a++;
        }
        document.title = k+"/"+a;
    }

}

P.provide("P.control.Sounder" , "P.control.Control", {
    list :{}, _autoInit : false,stamp:0, sound:null,
    initialize: function (opts) {
        P.setOptions(this, opts);
        this._initScene();
    },

    _initScene : function(){
        this._container = P.creat("div" , null , "pano-control-sounder", null);
        this._control = P.creat("a",null,"pano-sounder-control",this._container);
        this.sound = new P.extra.Sound(this._container);
    }
    ,
    onAdd : function(){
        this._pano
            .set("soundload" , P.bind(this.load, this))
            .set("soundstop" , P.bind(this.stop ,this))
            .set("soundpause" , P.bind(this.pause,this))
            .set("soundtoggle", P.bind(this.toggle,this))
            .addEventListener("pano_changed" , P.bind(this._onChangePano , this))
            .addEventListener("provider_load" , P.bind(this._onLoad , this));

        P.on(this._control,"click", P.bind(this._onPause , this));

        //setTimeout(P.bind(this._onLoad,this),1000)
        this._onLoad();
        this._onChangePano();
        //this._pano.playSound = P.bind(this.play, this);
    },
    _onLoad : function(){
        if(this._pano.options.provider)
        {
            var bg = this._pano.options.provider.options.data.basic.audio;
            if(bg)
                this.sound.load(bg,"sound_background",true,0.15)
        }

        //alert("loader")
    },
    _onPause : function(){

        var k = this.sound.toggleAll();

        if(k) dom.removeClass(this._control,"mute");
        else dom.addClass(this._control,"mute");
    },
    _onChangePano : function(){
        if(this._pano.options.provider) {
            var panoid = this._pano.getPano();
            var audio = this._pano.options.provider.data[panoid].raw.audio;
            if (audio)
                this.sound.load(audio, "scenesound", false, 0.75, true);
        }
    }
});

P.provide("P.control.Comment" , "P.control.Control",{
    options : {tick : 2000},
    initialize: function (opts) {
        P.setOptions(this, opts);
        this._initScene();
    },
    _initScene : function(){
        this._container = P.creat("div" , null , "pano-control-comment", null, "transform: translateZ(1000000000000px);z-index:9999999999;position: absolute; left: 0px; top:0;width:100%;height:25px;background:rgba(0,0,0,0.3);/*background-image: linear-gradient(to top,transparent,rgba(0,0,0,0.6));*/overflow:hidden;line-height:25px;font-size:12px;font-family:'microsoft yahei'");

        this._content = P.creat("div" , null,"pano-comment-content",this._container,"color:#fff;padding:0 5px;");

        this._comment1 = P.creat("div" , null,null,this._content,"text-overflow: ellipsis;white-space: nowrap;width:100%;overflow: hidden;");

        this._comment2 = P.creat("div" , null,null,this._content,"text-overflow: ellipsis;white-space: nowrap;width:100%;overflow: hidden;");

    },

    onAdd:function(){
        this.load();
        //var p = setTimeout(P.bind(this.draw , this) , 2000);
        this.draw();
    },

    draw : function(){

        Tweener.to(this._container,{
            time:0.6,scrollTop:25,
            onComplete : P.bind(this._updateShow , this)
        })
    },

    _updateShow : function(){
		setTimeout(P.bind(this.draw , this) , this.options.tick);

        if(this.data.length == 0 || this._size == 0)  return;

        var _tpl = "{user_nickname}: {text_excerpt}" , next = 0;

        this.index++;

        //end
        if(this.index == this._size) this.index = 0;

        next = (this._size == 1 || this.index == this._size-1) ? 0 : (this.index+1)
        //console.log(this.index+":"+next)
        this._comment1.innerHTML = utils.template(_tpl, this.data.reviews[this.index]);

        this._comment2.innerHTML = utils.template(_tpl, this.data.reviews[next]);

        this._container.scrollTop = 0;

    },

    _scrollHeight:0 , _size: 0,_step : 0, index:0, data:[],
    update:function(d){
        this.data = d;

        var html = "";
        if(d.status == "OK")
        {
            this._size = d.reviews.length;
            this.data = d;
            //this._updateShow();
        }

    },
    load:function(){
        var data = this.options.data;
        var self = this;

        if(typeof(data) == "string")
        {
            if(this.options.source == "qq")
            {
                services.getCommentFromQQ(data , function(d){
                    self.update(d);
                });
            }
        }
        else if(typeof(data) == "object")
        {
            self.update(d);
        }
        else
        {

            P.base.http.ajax({url:"assets/comment.txt?v=1" ,dataType:"json" ,
                success:function(d){

                    self.update(d);
                },
                error : function(){

                }
            });

        }

    }
});

P.provide("P.control.Popup" , "P.control.Control",{
    initialize: function (opts) {
        P.setOptions(this, opts);
        this._initScene();
    },

    _initScene : function(){
        this._container = P.creat("div" , null , "pano-control-popup", null, "transform: translateZ(1000000000000px);z-index:9999999999;position: absolute;left:0; top: 100%;opacity:0;width:100%;height:100%;background:#000;background: #fff;overflow-y: auto;line-height:1.75em;font-size:12px;font-family:'microsoft yahei'");
        this._close = P.creat("a",null,"pano-popup-close",this._container);

        this._content = P.creat("div" , null,"pano-popup-content",this._container,"padding:0px;width:100%;height:100%;");

        P.on(this._close ,"click" , P.bind(this._onClose , this));
    },

    _onClose:function(){
        P.css(this._container , {"top":"100%","opacity":0});
    },

    setContent:function(v){
        P.css(this._container , {"top":0,"opacity":1});
        var h = v;
        var c = document.getElementById(v);
        if(c)
        {
            var d = P.data(c,"data-page");
            if(d)  h = "
</frame>
";
            else h = c.innerHTML;
        }

        this._content.innerHTML = h;
    },

    onAdd : function(){
        //this._pano
        this._pano.setPop = P.bind(this.setContent , this);
        this._pano.set("setPop" , P.bind(this.setContent , this))
    }
});

P.provide("P.control.Mix" , "P.control.Control",{
    /**
     * style
     */
    thumbHeight : 80,
    thumbWidth:120,
    padding:5,
    scrollWidth:100,
    _vw:1,

    initialize: function (opts) {
        P.setOptions(this, opts);
        this._initScene();
    },

    _initScene : function(){
        this._container = P.creat("div" , null , "pano-control-mix pano-animation-linear", null, "transform: translateZ(1000000000000px);z-index:9999999999;position: absolute; left: 0px; bottom: 10px;width:100%;height:80px;border-top:solid 1px rgba(255,255,255,0.5);border-bottom:solid 1px rgba(255,255,255,0.5);");
        //this._warp = P.creat()
        //this._wrap = P.creat("div",null,null,this._container,"position:relative;background: rgba(0,0,0,0.3);")
        this._content = P.creat("div" , null,"pano-mix-content",this._container)
        this._contentDiv = P.creat("div" , null,null,this._content,"height:80px;");

        this._ctrl = P.creat("div",null,"pano-mix-ctrl",this._container);
        this._expand = P.creat("a" , null , "pano-mix-expand pano-animation-linear" , this._ctrl);

        this._tips = P.creat("div",null,"pano-mix-tip",this._container);

        this._scene = P.creat("div" , null,"pano-mix-scene",this._container,"position: absolute;width:70px;height:80px;left: 0px;top:0;overflow-y:auto;overflow-x:hidden;background:rgba(0,0,0,0.1)");
        this._sceneDiv = P.creat("div" , null,null,this._scene,"width:70px;");
        //this._scrollBar = P.creat("div",null,"pano-mix-scroll" , this._content,"position:absolute;bottom:8px;left:36;width:"+this.scrollWidth+"px;height:2px;background:#eee;border-radius:0px;");
        //this._ctrl.innerHTML = "PreNextToggle";
        //this._test();

    },

    _regListeners : function(){
        //P.on(this._expand,"click", P.bind(this._onToggle , this));
        var event = feature.touch ? "touchstart" : "click";

        P.on(this._expand,event, P.bind(this._onToggle , this));
        P.on(this._content , "click", P.bind(this._onSwitch , this));
        P.on(this._content, "mousewheel", this._onMouseWheel, this);
        P.on(this._scene ,"click" , P.bind(this._onScene , this));
        P.on(this._scene, "mousewheel", this._onMouseWheelScene, this);
        P.on(this._pano , "pano_changed" , P.bind( this._onPanoChange , this));

        this._onPanoChange();
        //this.trigger();
        //P.on(window, "resize", this.onResize, this);

    },

    _onPanoChange:function(e){
        var id = this._pano._panoid;
        var d = this._pano.options.provider.data[id].raw;
        //console.log(this._pano.options.provider.data[id].panoData.tiles.getTileUrl)
        if(d.bestheading)
            this._pano.setPov({heading:d.bestheading});
    },

    onResize : function(){
        if( this._vw < (this._pano.viewWidth - 36) )
        {
            this._scrollBar.style.display = "none";
        }else
        {
            this._scrollBar.style.display = "inline";
        }
        //this._content.scrollLeft / (this._vw - this._pano.viewWidth + 36);

    },

    onAdd : function(){
        if(this.options.qq === true)
        {
            var self = this;
            P.base.services.getQQData(this.options.data , function(d){
                self.setData(d);
                self._regListeners();
            });
        }else{
            if(this.options.data) this.setData(this.options.data);
            this._regListeners();
        }

    },

    _test : function(){
        this._content.innerHTML = "

开始

People

Red Tower

Running Track

Rush hour

";
    },

    data : null,

    _tpl : "
{title}
",
    _tpl_f :"
{title}
",

    _getProviders : function(data){
        var id = data.provider.id;
        if(id == "HQT") return new P.provider.HQTProvider({server : "pano/" , maxDeep : 2 , onecMode : false});
        if(id == "Tencent" ) {return new P.provider.LocalProvider({size:data.basic.tileSize,data:data,key : this.options.key , maxpixelzoom:0 , onceMode:true , maxDeep:2 , ignoneLv0:true , renderPreview:true});}
        //return new P.provider.QQProvider({key : this.options.key , maxpixelzoom:2 , onceMode:false});
        if(id == "Local" ) {return new P.provider.LocalProvider({size:data.basic.tileSize,data:data,key : this.options.key , maxpixelzoom:data.basic.maxpixelzoom , onceMode:data.basic.onceMode , maxDeep:data.basic.level , ignoneLv0:data.basic.ignoneLv0});}
    },

    setData : function(d){
        this.data = d;

        this._pano.addProvider( this._getProviders(d)).setPano(d.scene[0].pano[0].id);

        this.setTitle(d);

        //console.log(d);
        /*if(this.options.qq === true){
            services.getQQScene(d.scene[0].id , function(md){

            });
        }*/

        var f="";
        // listTree
        d.scene_table  = {};
        for(var i=0;i< d.scene.length;i++){
            //console.log(d.scene[i])
            if( d.scene[i].id === undefined ){
                d.scene[i].id = i;
            }
            d.scene_table[d.scene[i].id ] = d.scene[i];

            f += utils.template( this._tpl_f, d.scene[i]);
        }

        this._sceneDiv.innerHTML = "
"+f+"
";

        dom.addClass(this._sceneDiv.firstChild.firstChild , "select");

        //this._contentDiv.firstChild.firstChild.style["padding-left"] = "0";

        this.setTitle(d.description);

        this.setContent(d.scene[0].pano);

    },

    setContent : function(d){

        var h = "" ;

        this._vw = (this.thumbWidth + this.padding*2) * d.length;

        for(var i=0;i< d.length;i++){
           d[i].thumb = this._pano.options.provider.getThumbById(d[i].id);
           h +=  utils.template( this._tpl, d[i]) ;
        }

        this._contentDiv.innerHTML = "
"+h+"
";
        this._contentDiv.style.width = this._vw+"px";

    },

    setTitle : function(v){
        this._tips.innerHTML = v;
    },

    _onScene : function(e){
        //alert(e.target)
        //var tar =  e.target || e.srcElement
        var id = P.data(e.target , "data-id");
        console.log(id)
        dom.removeClass(dom.query("li.select") , "select");
        dom.addClass( e.target || e.srcElement , "select");

        if(id!== undefined) this.setContent(this.data.scene_table[id].pano);

    },

    _onMouseWheelScene:function(e){
        var delta = dom.event.getWheelDelta(e);
        /*var d = this._content.clientWidth * .5;*/
        //console.log(delta)
        anim.loop({
            duration : 200,
            onUpdate : P.bind(this._onUpdateSceneScroll, this,-3*delta)
            //onComplete : P.bind(this._pano.render , this._pano)
        });
    },

    _onUpdateSceneScroll:function(v){
        console.log(v)
        this._scene.scrollTop += v;
    },
    _onMouseWheel:function (e) {
        var delta = dom.event.getWheelDelta(e);
        /*var d = this._content.clientWidth * .5;*/

        anim.loop({
            duration : 200,
            onUpdate : P.bind(this._onUpdateScroll, this,-3*delta)
            //onComplete : P.bind(this._pano.render , this._pano)
        });

    },

    _onUpdateScroll:function(v){
        this._content.scrollLeft += v;
        var value = this._content.scrollLeft / (this._vw - this._pano.viewWidth + 54);
        //console.log(value);
        //this._scrollBar.style["margin-left"] = (this._pano.viewWidth - 36 - this.scrollWidth) * value+"px";
    },

    _onAnimate:function(e){
        var cmd = eval(P.data(e.target.parentNode , "data"));
        var tl = this._pano.timeline;
        for(var i in cmd)
            tl[cmd[i][0]].apply(tl , cmd[i][1]);

    },

    _onSwitch : function(e){
        var id = P.data(e.target.parentNode , "data-id");

        if(id)
            this._pano.setPano(id);
    },

    _onToggle : function(){
        dom.toggleClass(this._container , "mini");//.addClass("mini");

    }

});

/*

P.object.Arrow = function(dir ,data){
    this.prefix = P.prefix.css;
    this.creat(dir , data);
    //return this;

}

P.object.Arrow.prototype = {
    creat : function(dir , data){
        this.dir = dir;
        //var rad = dir * Math.PI/180;
        //var dx = Math.sin(dir) , dy = d*Math.cos(dirR);
        this.el = P.creat("div",null,null,null,"",data);
        this.shadow = P.object.Arrow.shadow(dir , this.el, this.prefix , data);
        this.arrow = P.object.Arrow.arrow(dir , this.el , this.prefix , data);
    },

    draw : function(vw,vh,rx,ty,rz){
        var step = (vw > vh ? vh : vw)*.2;
        var ix = (vw-81)/2; var iy = (vh-54)/2;
        ix += Math.sin((this.dir+rz) * Math.PI/180) * 120;
        iy -= Math.cos((this.dir+rz) * Math.PI/180) * 120;
        */
/*this.el.style[this.prefix+"transform"] = "translate3d("+ix+"px,"+iy+"px,99999px) *//*
*/
/*rotateX("+rx+"deg)*//*
*/
/* translateY("+(-step)+"px)*//*
*/
/* rotateY("+this.dir+"deg)*//*
*/
/*";*//*

        this.el.style[this.prefix+"transform"] = "";
        this.arrow.style[this.prefix+"transform"] = "translate3d("+ix+"px,"+(iy)+"px,99999px) translateY("+(ty)+"px) perspective(800px) rotateX("+(rx)+"deg) rotateZ("+(rz+this.dir)+"deg) ";

        this.shadow.style[this.prefix+"transform"] = "translate3d("+ix+"px,"+iy+"px,99999px) translateY("+(ty+3)+"px) perspective(800px) rotateX("+(rx)+"deg) rotateZ("+(rz+this.dir)+"deg) ";
    }
}

P.object.Arrows = function(pano){
    this.init(pano);
}

P.object.Arrow.arrow = function(dir,container,prefix,data){
    var ar = P.creat("canvas" , null,null,container,"overflow: hidden; position: absolute; " + prefix + "transform: rotateX(" + dir + "deg) translateY(-120px);",data);
    ar.width = 81; ar.height = 59;
    var ctx = ar.getContext('2d');
    var ARROW_DATA = [[81,40],[67.5,54],[40,27],[13.5,54],[0,40],[40,0]];
    ctx.beginPath(); // 开始路径绘制
    ctx.fillStyle = "#ffffff";
    ctx.moveTo(ARROW_DATA[0][0], ARROW_DATA[0][1]);
    for(var i=1;i<ARROW_DATA.length;i++)
        ctx.lineTo(ARROW_DATA[i][0], ARROW_DATA[i][1]); // 绘制一条到200, 20的直线
    ctx.fill();
    //ctx.scale();
    return ar;
}

P.object.Arrow.shadow = function(dir,container,prefix,data){
    var ar = P.creat("canvas" , null,null,container,"overflow: hidden; position: absolute; " + prefix + "transform: rotateX(" + dir + "deg) translateY(-110px);",data);
    ar.width = 81; ar.height = 59;
    var ctx = ar.getContext('2d');
    var ARROW_DATA = [[81,40],[67.5,54],[40,27],[13.5,54],[0,40],[40,0]];
    ctx.beginPath();
    ctx.fillStyle = "rgba(0,0,0,0.5)";
    ctx.moveTo(ARROW_DATA[0][0], ARROW_DATA[0][1]);
    for(var i=1;i<ARROW_DATA.length;i++)
        ctx.lineTo(ARROW_DATA[i][0], ARROW_DATA[i][1]); // 绘制一条到200, 20的直线
    ctx.fill();

    return ar;
}

P.object.Arrows.prototype = {
    init:function( pano){
        this._pano = pano;
        this.prefix = P.prefix.css;
        this.roadList = [];
        this.container = P.creat("div",null,"pano-road",this._pano._viewport,"position:absolute;left:0;top:0;");

        this._pano.addEventListener("render" , P.bind(this._render,this));

        this._pano.addEventListener("link_changed" , P.bind(this.onLinkChange,this));

        P.on(this.container , "click" , P.bind(this.onClick , this));

    },

    onClick : function(e){

        var id = P.data(e.target || e.srcElement, "data-id");
        this._pano.setPano(id);
    },

    onLinkChange:function(){

        var links = this._pano.getLinks();
        this.clear();
        this.update(links);
    },

    creat :function(dir , data){
        var p = new P.object.Arrow(dir ,data)
        this.container.appendChild(p.el );
        return p;
        */
/*return (shadow === true) ?
            P.object.Arrow.shadow(dir , data, this.container, this.prefix) :
            P.object.Arrow.arrow(dir , data, this.container, this.prefix);*//*

    },

    clear:function(){
        for(var i in this.roadList)
        {
            this.container.removeChild(this.roadList[i].el);
            this.roadList = [];
        }
    },

    update : function(v){
        for (var i = 0; i < v.length; i++) {

            //this.roadList.push( this.creat(v[i].dir , {"data-id":v[i].id} , true) );
            this.roadList.push( this.creat(v[i].dir , {"data-id":v[i].id}) );
        }
    },

    getTransform:function(){
        var cp =  -this._pano.pitch;;//0//this._pano._scene.calcPitch;
        var rx = cp>-30 ? 60 : (90 + cp);//console.log(this.calcPitch)
        //	-30 ~ -90 上升 40px; -30  ~ 0 匀速下降至 vH/2 - 90
        var ty = (cp<-30) ? -40*(90+cp)/60 : (-40 + (this._pano.viewHeight*0.5 - 50)*(30+cp)/30);
        var vw = this._pano.viewWidth , vh = this._pano.viewHeight;
        //var shadow = dy-6
        //中心 下移 透视 旋转(先移动 后旋转,translate3d 设置z是为了 接收 鼠标事件,否则rotateZ后 z<0)
        return "translate3d("+(vw-81)/2+"px,"+(vh-54)/2+"px,99999px) translateY("+(ty)+"px) perspective(800px) rotateX("+rx+"deg) rotateZ("+(0-this._pano.heading)+"deg) ";
    },

    _render:function(){
        var cp =  -this._pano.pitch;;//0//this._pano._scene.calcPitch;
        var rx = cp>-30 ? 60 : (90 + cp);//console.log(this.calcPitch)
        //	-30 ~ -90 上升 40px; -30  ~ 0 匀速下降至 vH/2 - 90
        var ty = (cp<-30) ? -40*(90+cp)/60 : (-40 + (this._pano.viewHeight*0.5 - 50)*(30+cp)/30);
        var vw = this._pano.viewWidth , vh = this._pano.viewHeight;
        var rz = 0-this._pano.heading;
        for(var i in this.roadList)
        {
            //console.log("rend:");console.log(this.roadList[i]);

            this.roadList[i].draw(vw,vh,rx,ty , rz);
            //.style[this.prefix+"transform"] = this.getTransform();
            //console.log(this.getTransform())
        }
       //console.log("RENDER")
    }
}
*/


text:
package com.appleframework.exception;

/**
 * 异常工厂类
 *
 * @author craig.chen
 * @Title: ErrorFactory.java
 * @Package com.appleframework.exception
 * @date 2020/6/17 11:43 上午
 */
public class ErrorsFactory {

	public static ServiceException newError(ErrorCode err) {
		return new ServiceException(err.getCode(), err.getMsg());
	}

	public static ServiceException newError(ErrorCode err, String msg) {
		return new ServiceException(err.getCode(), msg);
	}

	public static ServiceException newError(ErrorCode err, Throwable throwable) {
		return new ServiceException(err.getCode(), err.getMsg(), throwable);
	}

	public static ServiceException newError(Class<?> clazz, ErrorCode err) {
		return new ServiceException(clazz, err);
	}

	public static ServiceException newError(Class<?> clazz, ErrorCode err, Throwable throwable) {
		return new ServiceException(clazz, err, throwable);
	}

	public static ServiceException newError(Class<?> clazz, ErrorCode err, Object... params) {
		return new ServiceException(clazz, err, params);
	}
}


text:
#ifndef _OSS_UNALLOCRUN_H
#define _OSS_UNALLOCRUN_H

#include "tsk/framework/framework_i.h"

/**
 * Stores information that can map a region in the original disk image
 * to a region in one of the chunks of unallocated space (as created by
 * the CarvePrep implementation.
 */
class TSK_FRAMEWORK_API UnallocRun
{
public:
    UnallocRun(int a_volId, int a_unallocImgId, uint64_t a_unallocStart,
        uint64_t a_length, uint64_t a_allocStart);
    ~UnallocRun();

    int getVolId() const;
    int getUnallocImgId() const;
    uint64_t getUnallocStart() const;
    uint64_t getLength() const;
    uint64_t getAllocStart() const;

private:
    int m_volId;
    int m_unallocImgId;
    uint64_t m_unallocStart;
    uint64_t m_length;
    uint64_t m_origStart;
};

#endif


text:
package com.jivesoftware.os.upena.service;

import com.jivesoftware.os.jive.utils.ordered.id.OrderIdProvider;
import com.jivesoftware.os.upena.service.UpenaMap.UpenaKeyProvider;
import com.jivesoftware.os.upena.shared.Project;
import com.jivesoftware.os.upena.shared.ProjectKey;

public class ProjectKeyProvider implements UpenaKeyProvider<ProjectKey, Project> {

    private final OrderIdProvider idProvider;

    public ProjectKeyProvider(OrderIdProvider idProvider) {
        this.idProvider = idProvider;
    }

    @Override
    public ProjectKey getNodeKey(UpenaMap<ProjectKey,Project> table, Project value) {
        String k = Long.toString(Math.abs(idProvider.nextId()));
        return new ProjectKey(k);
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Physoderma aponogetonis Sparrow

### Remarks
null


text:
@interface BTUIKPayPalWordmarkCompactVectorArtView : BTUIKPayPalWordmarkVectorArtView

@end


text:
function Add-VSEC2LaunchTemplateCapacityReservationTarget {
    <#
    .SYNOPSIS
        Adds an AWS::EC2::LaunchTemplate.CapacityReservationTarget resource property to the template. Specifies a target Capacity Reservation.

    .DESCRIPTION
        Adds an AWS::EC2::LaunchTemplate.CapacityReservationTarget resource property to the template.
Specifies a target Capacity Reservation.

CapacityReservationTarget is a property of the  Amazon EC2 LaunchTemplate LaunchTemplateData: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html property type.

    .LINK
        http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-capacityreservationtarget.html

    .PARAMETER CapacityReservationId
        The ID of the Capacity Reservation.

        Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-capacityreservationtarget.html#cfn-ec2-launchtemplate-capacityreservationtarget-capacityreservationid
        PrimitiveType: String
        UpdateType: Mutable

    .FUNCTIONALITY
        Vaporshell
    #>
    [OutputType('Vaporshell.Resource.EC2.LaunchTemplate.CapacityReservationTarget')]
    [cmdletbinding()]
    Param
    (
        [parameter(Mandatory = $false)]
        [ValidateScript( {
                $allowedTypes = "System.String","Vaporshell.Function","Vaporshell.Condition"
                if ([string]$($_.PSTypeNames) -match "($(($allowedTypes|ForEach-Object{[RegEx]::Escape($_)}) -join '|'))") {
                    $true
                }
                else {
                    $PSCmdlet.ThrowTerminatingError((New-VSError -String "This parameter only accepts the following types: $($allowedTypes -join ", "). The current types of the value are: $($_.PSTypeNames -join ", ")."))
                }
            })]
        $CapacityReservationId
    )
    Begin {
        $obj = [PSCustomObject]@{}
        $commonParams = @('Verbose','Debug','ErrorAction','WarningAction','InformationAction','ErrorVariable','WarningVariable','InformationVariable','OutVariable','OutBuffer','PipelineVariable')
    }
    Process {
        foreach ($key in $PSBoundParameters.Keys | Where-Object {$commonParams -notcontains $_}) {
            switch ($key) {
                Default {
                    $obj | Add-Member -MemberType NoteProperty -Name $key -Value $PSBoundParameters.$key
                }
            }
        }
    }
    End {
        $obj | Add-ObjectDetail -TypeName 'Vaporshell.Resource.EC2.LaunchTemplate.CapacityReservationTarget'
        Write-Verbose "Resulting JSON from $($MyInvocation.MyCommand): `n`n$($obj | ConvertTo-Json -Depth 5)`n"
    }
}


text:
package org.elasticsearch.client;

import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPut;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
import org.elasticsearch.action.admin.cluster.settings.ClusterGetSettingsRequest;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.common.Strings;

import java.io.IOException;

final class ClusterRequestConverters {

    private ClusterRequestConverters() {}

    static Request clusterPutSettings(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest) throws IOException {
        Request request = new Request(HttpPut.METHOD_NAME, "/_cluster/settings");

        RequestConverters.Params parameters = new RequestConverters.Params();
        parameters.withTimeout(clusterUpdateSettingsRequest.timeout());
        parameters.withMasterTimeout(clusterUpdateSettingsRequest.masterNodeTimeout());
        request.addParameters(parameters.asMap());
        request.setEntity(RequestConverters.createEntity(clusterUpdateSettingsRequest, RequestConverters.REQUEST_BODY_CONTENT_TYPE));
        return request;
    }

    static Request clusterGetSettings(ClusterGetSettingsRequest clusterGetSettingsRequest) throws IOException {
        Request request = new Request(HttpGet.METHOD_NAME, "/_cluster/settings");
        RequestConverters.Params parameters = new RequestConverters.Params();
        parameters.withLocal(clusterGetSettingsRequest.local());
        parameters.withIncludeDefaults(clusterGetSettingsRequest.includeDefaults());
        parameters.withMasterTimeout(clusterGetSettingsRequest.masterNodeTimeout());
        request.addParameters(parameters.asMap());
        return request;
    }

    static Request clusterHealth(ClusterHealthRequest healthRequest) {
        String[] indices = healthRequest.indices() == null ? Strings.EMPTY_ARRAY : healthRequest.indices();
        String endpoint = new RequestConverters.EndpointBuilder()
            .addPathPartAsIs("_cluster/health")
            .addCommaSeparatedPathParts(indices)
            .build();
        Request request = new Request(HttpGet.METHOD_NAME, endpoint);

        RequestConverters.Params params = new RequestConverters.Params()
            .withWaitForStatus(healthRequest.waitForStatus())
            .withWaitForNoRelocatingShards(healthRequest.waitForNoRelocatingShards())
            .withWaitForNoInitializingShards(healthRequest.waitForNoInitializingShards())
            .withWaitForActiveShards(healthRequest.waitForActiveShards(), ActiveShardCount.NONE)
            .withWaitForNodes(healthRequest.waitForNodes())
            .withWaitForEvents(healthRequest.waitForEvents())
            .withTimeout(healthRequest.timeout())
            .withMasterTimeout(healthRequest.masterNodeTimeout())
            .withLocal(healthRequest.local())
            .withLevel(healthRequest.level());
        request.addParameters(params.asMap());
        return request;
    }
}


text:
 User Profile Page

Welcome, {{vm.currentUser.email}}!

			<button ng-if="vm.promptForAddress" ng-click="vm.openForm()" class="btn btn-default"> Add Shipping and Billing Details</button>

						Email Address:
						{{vm.currentUser.email}}

						Name:
						{{vm.currentUser.shipping_address.name.first}} {{vm.currentUser.shipping_address.name.last}}

						Verified Email:

Recently purchased

Order Confirmation Number

					{{product.productID}}

			<button ng-hide="true" ng-click="vm.testFilter(vm.countries)" class="btn btn-default btn-xs">Test filter</button>

				<form name="profileForm" class="form-horizontal" ng-submit="vm.submitProfile(vm.currentUser)" role="form" novalidate>

				    Country:
Required

				      <select name="profileform.country" class="profile-form-dropdown-width" ng-model="vm.currentUser.country_id" ng-options="country._id as country.name for country in vm.countries" ng-change="vm.updateRegions(vm.currentUser.country_id)"></select>

				    First name:

Required

				      <input name="shippingFirstName" class="profile-form-dropdown-width" ng-model="vm.currentUser.shipping_address.name.first" type="text" required/>

				    Last name:

Required

				      <input name="shippingLastName" class="profile-form-dropdown-width" ng-model="vm.currentUser.shipping_address.name.last" type="text" required/>

				    Street Address:

Required

				      <input name="shipStrAddr" class="profile-form-dropdown-width" ng-model="vm.currentUser.shipping_address.street_address" type="text" required/>

				    City:

Required

				      <input name="shipCity" class="profile-form-dropdown-width" ng-model="vm.currentUser.shipping_address.city" type="text" required/>

				    State:

Required

				      <select name="shipState" class="profile-form-dropdown-width" ng-model="vm.currentUser.shipping_address.region_id" ng-options="region._id as region.name for region in vm.regions" required></select>

				    Zip Code:

Required

				      <input name="shipZip" class="profile-form-dropdown-width" ng-model="vm.currentUser.shipping_address.zip" type="text" required/>

				  	Billing Address same as Shipping

				  	<input type="checkbox" ng-click="vm.matchAddresses(vm.currentUser)" ng-model="vm.currentUser.hasSameBillingAndShipping"/>

				    First name:

Required

				      <input name="billingFirstName" class="profile-form-dropdown-width" ng-model="vm.currentUser.billing_address.name.first" type="text" required/>

				    Last name:

Required

				      <input name="billingLastName" class="profile-form-dropdown-width" ng-model="vm.currentUser.billing_address.name.last" type="text" required/>

				    Street Address:

Required

				      <input name="billStrAddr" class="profile-form-dropdown-width" ng-model="vm.currentUser.billing_address.street_address" type="text" required/>

				    City:

Required

				      <input name="billCity" class="profile-form-dropdown-width" ng-model="vm.currentUser.billing_address.city" type="text" required/>

				    State:

Required

				      <select name="billState" class="profile-form-dropdown-width" ng-model="vm.currentUser.billing_address.region_id" ng-options="region._id as region.name for region in vm.regions" required></select>

				    Zip Code:

Required

				      <input name="billZip" class="profile-form-dropdown-width" ng-model="vm.currentUser.billing_address.zip" type="text" required/>

				  	<button ng-disabled="profileForm.$invalid" type="submit">Submit</button>

All required fields must be filled

				</form>
				<button ng-click="vm.closeForm()">Cancel</button>


text:
namespace lldb_private {
class StringLexer;
class AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType {
public:
  AppleObjCTypeEncodingParser(ObjCLanguageRuntime &runtime);
  ~AppleObjCTypeEncodingParser() override = default;

  CompilerType RealizeType(clang::ASTContext &ast_ctx, const char *name,
                           bool for_expression) override;

private:
  struct StructElement {
    std::string name;
    clang::QualType type;
    uint32_t bitfield;

    StructElement();
    ~StructElement() = default;
  };

  clang::QualType BuildType(clang::ASTContext &ast_ctx, StringLexer &type,
                            bool for_expression,
                            uint32_t *bitfield_bit_size = nullptr);

  clang::QualType BuildStruct(clang::ASTContext &ast_ctx, StringLexer &type,
                              bool for_expression);

  clang::QualType BuildAggregate(clang::ASTContext &ast_ctx, StringLexer &type,
                                 bool for_expression, char opener, char closer,
                                 uint32_t kind);

  clang::QualType BuildUnion(clang::ASTContext &ast_ctx, StringLexer &type,
                             bool for_expression);

  clang::QualType BuildArray(clang::ASTContext &ast_ctx, StringLexer &type,
                             bool for_expression);

  std::string ReadStructName(StringLexer &type);

  StructElement ReadStructElement(clang::ASTContext &ast_ctx, StringLexer &type,
                                  bool for_expression);

  clang::QualType BuildObjCObjectPointerType(clang::ASTContext &ast_ctx,
                                             StringLexer &type,
                                             bool for_expression);

  uint32_t ReadNumber(StringLexer &type);

  std::string ReadQuotedString(StringLexer &type);

  ObjCLanguageRuntime &m_runtime;
};

} // namespace lldb_private

#endif // liblldb_AppleObjCTypeEncodingParser_h_


text:
import React from 'react'

export default class VerifyLink extends React.Component {

 constructor () {
   super()
   this.buildLink = this.buildLink.bind(this)
 }

 buildLink () {
   console.log(this.props.product)
   const dir = this.props.direction === 'import' ? 'd' : 'v'
   const product = this.props.product.code
   console.log(this.props.criteria)
   const countries = this.props.criteria.selectedCountries.filter(c => c.code !== 'ALL_COUNTRIES').map(c => c.code).join(',')
   const monthFrom = this.props.criteria.interval.from.month
   const monthTill = this.props.criteria.interval.till.month
   const yearFrom = this.props.criteria.interval.from.year
   const yearTill = this.props.criteria.interval.till.year
   const group = this.props.criteria.groupBy

   return 'http://apl.czso.cz/pll/stazo/!presso.STAZO.PRIPRAV_ZOBRAZ?mesic_od=' + monthFrom + '&rok_od=' + yearFrom + '&mesic_do=' + monthTill + '&rok_do=' + yearTill + '&seskup=' + group + '&typ_vyst=1&mena=CZK&dov_vyv=' + dir + '&omez=99999&tab=A&zb_zem=3&razeni1=x&smer1=+&razeni2=x&smer2=+&razeni3=x&smer3=+&nomen=18&ur_nomen=18&kod_zbozi=' + product + '&n_kod_zbozi=' + product + '&skup_zeme=1&vyber_zemi=1&kod_zeme=' + countries + '&n_kod_zeme=' + countries + '&jazyk=CS&par=D&max_obd=201510&email=&jmdot=&popdot='
 }

  render () {
    return (

         Zobrazit zdrojová data na stránkách czso.cz

    )
  }
}

VerifyLink.propTypes = {
  product: React.PropTypes.object.isRequired,
  direction: React.PropTypes.string.isRequired,
  criteria: React.PropTypes.object.isRequired
}


text:
> Given a non-negative integer `num`, repeatedly add all its digits until the result has only one digit.

## Example

Given `num = 38`, the process is like: `3 + 8 = 11`, `1 + 1 = 2`. Since `2` has only one digit, return it.

## Follow Up

Could you do it without any loop/recursion in O(1) runtime?

## Solution

- [Java](solution1.java)

## Source

[LeetCode 258](https://leetcode.com/problems/add-digits/)


text: WebStorm 11 walkthrough for Angular 2


text:
package response

import (
	"github.com/chanxuehong/wechat.v2/mp/core"
)

const (
	MsgTypeText                    core.MsgType = "text"                      // 文本消息
	MsgTypeImage                   core.MsgType = "image"                     // 图片消息
	MsgTypeVoice                   core.MsgType = "voice"                     // 语音消息
	MsgTypeVideo                   core.MsgType = "video"                     // 视频消息
	MsgTypeMusic                   core.MsgType = "music"                     // 音乐消息
	MsgTypeNews                    core.MsgType = "news"                      // 图文消息
	MsgTypeTransferCustomerService core.MsgType = "transfer_customer_service" // 将消息转发到多客服
)

// 文本消息
type Text struct {
	XMLName struct{} `xml:"xml" json:"-"`
	core.MsgHeader
	Content string `xml:"Content" json:"Content"` // 回复的消息内容(换行: 在content中能够换行, 微信客户端支持换行显示)
}

func NewText(to, from string, timestamp int64, content string) (text *Text) {
	return &Text{
		MsgHeader: core.MsgHeader{
			ToUserName:   to,
			FromUserName: from,
			CreateTime:   timestamp,
			MsgType:      MsgTypeText,
		},
		Content: content,
	}
}

// 图片消息
type Image struct {
	XMLName struct{} `xml:"xml" json:"-"`
	core.MsgHeader
	Image struct {
		MediaId string `xml:"MediaId" json:"MediaId"` // 通过素材管理接口上传多媒体文件得到 MediaId
	} `xml:"Image" json:"Image"`
}

func NewImage(to, from string, timestamp int64, mediaId string) (image *Image) {
	image = &Image{
		MsgHeader: core.MsgHeader{
			ToUserName:   to,
			FromUserName: from,
			CreateTime:   timestamp,
			MsgType:      MsgTypeImage,
		},
	}
	image.Image.MediaId = mediaId
	return
}

// 语音消息
type Voice struct {
	XMLName struct{} `xml:"xml" json:"-"`
	core.MsgHeader
	Voice struct {
		MediaId string `xml:"MediaId" json:"MediaId"` // 通过素材管理接口上传多媒体文件得到 MediaId
	} `xml:"Voice" json:"Voice"`
}

func NewVoice(to, from string, timestamp int64, mediaId string) (voice *Voice) {
	voice = &Voice{
		MsgHeader: core.MsgHeader{
			ToUserName:   to,
			FromUserName: from,
			CreateTime:   timestamp,
			MsgType:      MsgTypeVoice,
		},
	}
	voice.Voice.MediaId = mediaId
	return
}

// 视频消息
type Video struct {
	XMLName struct{} `xml:"xml" json:"-"`
	core.MsgHeader
	Video struct {
		MediaId     string `xml:"MediaId"               json:"MediaId"`               // 通过素材管理接口上传多媒体文件得到 MediaId
		Title       string `xml:"Title,omitempty"       json:"Title,omitempty"`       // 视频消息的标题, 可以为空
		Description string `xml:"Description,omitempty" json:"Description,omitempty"` // 视频消息的描述, 可以为空
	} `xml:"Video" json:"Video"`
}

func NewVideo(to, from string, timestamp int64, mediaId, title, description string) (video *Video) {
	video = &Video{
		MsgHeader: core.MsgHeader{
			ToUserName:   to,
			FromUserName: from,
			CreateTime:   timestamp,
			MsgType:      MsgTypeVideo,
		},
	}
	video.Video.MediaId = mediaId
	video.Video.Title = title
	video.Video.Description = description
	return
}

// 音乐消息
type Music struct {
	XMLName struct{} `xml:"xml" json:"-"`
	core.MsgHeader
	Music struct {
		Title        string `xml:"Title,omitempty"        json:"Title,omitempty"`       // 音乐标题
		Description  string `xml:"Description,omitempty"  json:"Description,omitempty"` // 音乐描述
		MusicURL     string `xml:"MusicUrl"               json:"MusicUrl"`              // 音乐链接
		HQMusicURL   string `xml:"HQMusicUrl"             json:"HQMusicUrl"`            // 高质量音乐链接, WIFI环境优先使用该链接播放音乐
		ThumbMediaId string `xml:"ThumbMediaId"           json:"ThumbMediaId"`          // 通过素材管理接口上传多媒体文件得到 ThumbMediaId
	} `xml:"Music" json:"Music"`
}

func NewMusic(to, from string, timestamp int64, thumbMediaId, musicURL, HQMusicURL, title, description string) (music *Music) {
	music = &Music{
		MsgHeader: core.MsgHeader{
			ToUserName:   to,
			FromUserName: from,
			CreateTime:   timestamp,
			MsgType:      MsgTypeMusic,
		},
	}
	music.Music.Title = title
	music.Music.Description = description
	music.Music.MusicURL = musicURL
	music.Music.HQMusicURL = HQMusicURL
	music.Music.ThumbMediaId = thumbMediaId
	return
}

// 图文消息里的 Article
type Article struct {
	Title       string `xml:"Title,omitempty"       json:"Title,omitempty"`       // 图文消息标题
	Description string `xml:"Description,omitempty" json:"Description,omitempty"` // 图文消息描述
	PicURL      string `xml:"PicUrl,omitempty"      json:"PicUrl,omitempty"`      // 图片链接, 支持JPG, PNG格式, 较好的效果为大图360*200, 小图200*200
	URL         string `xml:"Url,omitempty"         json:"Url,omitempty"`         // 点击图文消息跳转链接
}

// 图文消息
type News struct {
	XMLName struct{} `xml:"xml" json:"-"`
	core.MsgHeader
	ArticleCount int       `xml:"ArticleCount"            json:"ArticleCount"`       // 图文消息个数, 限制为10条以内
	Articles     []Article `xml:"Articles>item,omitempty" json:"Articles,omitempty"` // 多条图文消息信息, 默认第一个item为大图, 注意, 如果图文数超过10, 则将会无响应
}

func NewNews(to, from string, timestamp int64, articles []Article) (news *News) {
	news = &News{
		MsgHeader: core.MsgHeader{
			ToUserName:   to,
			FromUserName: from,
			CreateTime:   timestamp,
			MsgType:      MsgTypeNews,
		},
	}
	news.ArticleCount = len(articles)
	news.Articles = articles
	return
}

// 将消息转发到多客服, 参见多客服模块
type TransferToCustomerService struct {
	XMLName struct{} `xml:"xml" json:"-"`
	core.MsgHeader
	TransInfo *TransInfo `xml:"TransInfo,omitempty" json:"TransInfo,omitempty"`
}

type TransInfo struct {
	KfAccount string `xml:"KfAccount" json:"KfAccount"`
}

// 如果不指定客服则 kfAccount 留空.
func NewTransferToCustomerService(to, from string, timestamp int64, kfAccount string) (msg *TransferToCustomerService) {
	msg = &TransferToCustomerService{
		MsgHeader: core.MsgHeader{
			ToUserName:   to,
			FromUserName: from,
			CreateTime:   timestamp,
			MsgType:      MsgTypeTransferCustomerService,
		},
	}
	if kfAccount != "" {
		msg.TransInfo = &TransInfo{
			KfAccount: kfAccount,
		}
	}
	return
}


text:
PATH_TO_THE_REPO_PATH_UTILS_FILE = "https://raw.githubusercontent.com/highfidelity/hifi_tests/master/tests/utils/branchUtils.js";
Script.include(PATH_TO_THE_REPO_PATH_UTILS_FILE);

if (typeof depth === 'undefined') {
   depth = 0;
   nitpick = createNitpick(Script.resolvePath("."));
   testsRootPath = nitpick.getTestsRootPath();

   nitpick.enableRecursive();
   nitpick.enableAuto();
} else {
   depth++
}

Script.include(testsRootPath + "engine/interaction/pointer/parabola/renderState/test.js");
Script.include(testsRootPath + "engine/interaction/pointer/parabola/lockEnd/test.js");
Script.include(testsRootPath + "engine/interaction/pointer/parabola/ignore/test.js");
Script.include(testsRootPath + "engine/interaction/pointer/parabola/enable/test.js");

if (depth > 0) {
   depth--;
} else {
   nitpick.runRecursive();
}


text:
<?php

namespace Wpt\Framework\Http;

/**
 * Class Response
 * @package Wpt\Framework\Http
 */
class Response extends Message
{
    /**
     * @var int
     */
    private $statusCode = 200;

    /**
     * @var string
     */
    private $reasonPhrase = '';

    /**
     * @var array
     */
    private $statusTexts = [
        100 => 'Continue',
        101 => 'Switching Protocols',
        102 => 'Processing',            // RFC2518
        200 => 'OK',
        201 => 'Created',
        202 => 'Accepted',
        203 => 'Non-Authoritative Information',
        204 => 'No Content',
        205 => 'Reset Content',
        206 => 'Partial Content',
        207 => 'Multi-Status',          // RFC4918
        208 => 'Already Reported',      // RFC5842
        226 => 'IM Used',               // RFC3229
        300 => 'Multiple Choices',
        301 => 'Moved Permanently',
        302 => 'Found',
        303 => 'See Other',
        304 => 'Not Modified',
        305 => 'Use Proxy',
        306 => 'Reserved',
        307 => 'Temporary Redirect',
        308 => 'Permanent Redirect',    // RFC7238
        400 => 'Bad Request',
        401 => 'Unauthorized',
        402 => 'Payment Required',
        403 => 'Forbidden',
        404 => 'Not Found',
        405 => 'Method Not Allowed',
        406 => 'Not Acceptable',
        407 => 'Proxy Authentication Required',
        408 => 'Request Timeout',
        409 => 'Conflict',
        410 => 'Gone',
        411 => 'Length Required',
        412 => 'Precondition Failed',
        413 => 'Request Entity Too Large',
        414 => 'Request-URI Too Long',
        415 => 'Unsupported Media Type',
        416 => 'Requested Range Not Satisfiable',
        417 => 'Expectation Failed',
        418 => 'I\'m a teapot',                                               // RFC2324
        422 => 'Unprocessable Entity',                                        // RFC4918
        423 => 'Locked',                                                      // RFC4918
        424 => 'Failed Dependency',                                           // RFC4918
        425 => 'Reserved for WebDAV advanced collections expired proposal',   // RFC2817
        426 => 'Upgrade Required',                                            // RFC2817
        428 => 'Precondition Required',                                       // RFC6585
        429 => 'Too Many Requests',                                           // RFC6585
        431 => 'Request Header Fields Too Large',                             // RFC6585
        500 => 'Internal Server Error',
        501 => 'Not Implemented',
        502 => 'Bad Gateway',
        503 => 'Service Unavailable',
        504 => 'Gateway Timeout',
        505 => 'HTTP Version Not Supported',
        506 => 'Variant Also Negotiates (Experimental)',                      // RFC2295
        507 => 'Insufficient Handler',                                        // RFC4918
        508 => 'Loop Detected',                                               // RFC5842
        510 => 'Not Extended',                                                // RFC2774
        511 => 'Network Authentication Required',                             // RFC6585
    ];

    /**
     * @return int
     */
    public function getStatusCode()
    {
        return $this->statusCode;
    }

    /**
     * @param        $code
     * @param string $reasonPhrase
     *
     * @return $this
     */
    public function withStatus($code, $reasonPhrase = '')
    {
        if (! isset($this->statusTexts[$code])) {
            throw new \InvalidArgumentException('Invalid status code: '. $code);
        }

        $this->statusCode   = $code;
        $this->reasonPhrase = $reasonPhrase ?: $this->statusTexts[$code];

        return $this;
    }

    /**
     * @return string
     */
    public function getReasonPhrase()
    {
        return $this->reasonPhrase;
    }
}