text:
// -----------------------------------------------------------------------------
// Original code from SlimDX project.
// Original code published with the following license:
// -----------------------------------------------------------------------------
/*
 * Copyright (c) 2007-2012 SlimDX Group
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

#ifndef LUDI_QUATERNION_H_
#define LUDI_QUATERNION_H_

#include "Vector3.h"
#include "Vector4.h"

namespace ludi {
    // Forward declaration
    class Matrix3;
    class Matrix4;
    class Vector2;
    class Vector3;
    class Vector4;

    /*! Represents a four dimensional mathematical quaternion. */
    class Quaternion {
    public:
        static const Quaternion& Zero;          //!< A \ref Quaternion with all of its components set to zero.
        static const Quaternion& One;           //!< A \ref Quaternion with all of its components set to one.
        static const Quaternion& Identity;      //!< The identity \ref Quaternion (0, 0, 0, 1).

        /*! The size of the \ref Quaternion type, in bytes. */
        static constexpr int SizeInBytes() { return sizeof(Quaternion); }

    public:
        /*! Adds two quaternions.
         *  \param lhs The first quaternion to add.
         *  \param rhs The second quaternion to add.
         *  \param result When the method completes, contains the sum of the two quaternions. */
        static void Add(const Quaternion& lhs, const Quaternion& rhs, Quaternion& result);

        /*! Adds two quaternions.
         *  \param lhs The first quaternion to add.
         *  \param rhs The second quaternion to add.
         *  \return The sum of the two quaternions. */
        static Quaternion Add(const Quaternion& lhs, const Quaternion& rhs);

        /*! Subtracts two quaternions.
         *  \param lhs The first quaternion to subtract.
         *  \param rhs The second quaternion to subtract.
         *  \param result When the method completes, contains the difference of the two quaternions. */
        static void Subtract(const Quaternion& lhs, const Quaternion& rhs, Quaternion& result);

        /*! Subtracts two quaternions.
         *  \param lhs The first quaternion to subtract.
         *  \param rhs The second quaternion to subtract.
         *  \return The difference of the two quaternions. */
        static Quaternion Subtract(const Quaternion& lhs, const Quaternion& rhs);

        /*! Scales a quaternion by the given value.
         *  \param lhs The quaternion to scale.
         *  \param scale The amount by which to scale the quaternion.
         *  \param result When the method completes, contains the scaled quaternion. */
        static void Multiply(const Quaternion& lhs, float scale, Quaternion& result);

        /*! Scales a quaternion by the given value.
         *  \param lhs The quaternion to scale.
         *  \param scale The amount by which to scale the quaternion.
         *  \return The scaled quaternion. */
        static Quaternion Multiply(const Quaternion& lhs, float scale);

        /*! Multiplies a quaternion by another.
         *  \param lhs The first quaternion to multiply.
         *  \param rhs The second quaternion to multiply.
         *  \param result When the method completes, contains the multiplied quaternion. */
        static void Multiply(const Quaternion& lhs, const Quaternion& rhs, Quaternion& result);

        /*! Multiplies a quaternion by another.
         *  \param lhs The first quaternion to multiply.
         *  \param rhs The second quaternion to multiply.
         *  \return The multiplied quaternion. */
        static Quaternion Multiply(const Quaternion& lhs, const Quaternion& rhs);

        /*! Scales a quaternion by the given value.
         *  \param lhs The quaternion to scale.
         *  \param scale The amount by which to scale the quaternion.
         *  \param result When the method completes, contains the scaled quaternion. */
        static void Divide(const Quaternion& lhs, float scale, Quaternion& result);

        /*! Scales a quaternion by the given value.
         *  \param lhs The quaternion to scale.
         *  \param scale The amount by which to scale the quaternion.
         *  \return The scaled quaternion. */
        static Quaternion Divide(const Quaternion& lhs, float scale);

        /*! Divides a quaternion by another.
         *  \param lhs The first quaternion to divide.
         *  \param rhs The second quaternion to divide.
         *  \param result When the method completes, contains the divided quaternion. */
        static void Divide(const Quaternion& lhs, const Quaternion& rhs, Quaternion& result);

        /*! Divides a quaternion by another.
         *  \param lhs The first quaternion to divide.
         *  \param rhs The second quaternion to divide.
         *  \return The divided quaternion. */
        static Quaternion Divide(const Quaternion& lhs, const Quaternion& rhs);

        /*! Reverses the direction of a given quaternion.
         *  \param value The quaternion to negate.
         *  \param result When the method completes, contains a quaternion facing in the opposite direction. */
        static void Negate(const Quaternion& value, Quaternion& result);

        /*! Reverses the direction of a given quaternion.
         *  \param value The quaternion to negate.
         *  \return A quaternion facing in the opposite direction. */
        static Quaternion Negate(const Quaternion& value);

        /*! Returns a \ref Quaternion containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.
         *  \param value1 A \ref Quaternion containing the 4D Cartesian coordinates of vertex 1 of the triangle.
         *  \param value2 A \ref Quaternion containing the 4D Cartesian coordinates of vertex 2 of the triangle.
         *  \param value3 A \ref Quaternion containing the 4D Cartesian coordinates of vertex 3 of the triangle.
         *  \param amount1 Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in \p value2).
         *  \param amount2 Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in \p value3).
         *  \param result When the method completes, contains a \ref Quaternion containing the 4D Cartesian coordinates of the specified point. */
        static void Barycentric(const Quaternion& value1, const Quaternion& value2, const Quaternion& value3, float amount1, float amount2, Quaternion& result);

        /*! Returns a \ref Quaternion containing the 4D Cartesian coordinates of a point specified in Barycentric coordinates relative to a 2D triangle.
         *  \param value1 A \ref Quaternion containing the 4D Cartesian coordinates of vertex 1 of the triangle.
         *  \param value2 A \ref Quaternion containing the 4D Cartesian coordinates of vertex 2 of the triangle.
         *  \param value3 A \ref Quaternion containing the 4D Cartesian coordinates of vertex 3 of the triangle.
         *  \param amount1 Barycentric coordinate b2, which expresses the weighting factor toward vertex 2 (specified in \p value2).
         *  \param amount2 Barycentric coordinate b3, which expresses the weighting factor toward vertex 3 (specified in \p value3).
         *  \return A \ref Quaternion containing the 4D Cartesian coordinates of the specified point. */
        static Quaternion Barycentric(const Quaternion& value1, const Quaternion& value2, const Quaternion& value3, float amount1, float amount2);

        /*! Conjugates a quaternion.
         *  \param value The quaternion to conjugate.
         *  \param result When the method completes, contains the conjugated quaternion. */
        static void Conjugate(const Quaternion& value, Quaternion& result);

        /*! Conjugates a quaternion.
         *  \param value The quaternion to conjugate.
         *  \return The conjugated quaternion. */
        static Quaternion Conjugate(const Quaternion& value);

        /*! Calculates the dot product of two quaternions.
         *  \param lhs First source quaternion.
         *  \param rhs Second source quaternion.
         *  \param result When the method completes, contains the dot product of the two quaternions. */
        static void Dot(const Quaternion& lhs, const Quaternion& rhs, float& result);

        /*! Calculates the dot product of two quaternions.
         *  \param lhs First source quaternion.
         *  \param rhs Second source quaternion.
         *  \return The dot product of the two quaternions. */
        static float Dot(const Quaternion& lhs, const Quaternion& rhs);

        /*! Exponentiates a quaternion.
         *  \param value The quaternion to exponentiate.
         *  \param result When the method completes, contains the exponentiated quaternion. */
        static void Exponential(const Quaternion& value, Quaternion& result);

        /*! Exponentiates a quaternion.
         *  \param value The quaternion to exponentiate.
         *  \return The exponentiated quaternion. */
        static Quaternion Exponential(const Quaternion& value);

        /*! Conjugates and renormalizes the quaternion.
         *  \param value The quaternion to conjugate and renormalize.
         *  \param result When the method completes, contains the conjugated and renormalized quaternion. */
        static void Invert(const Quaternion& value, Quaternion& result);

        /*! Conjugates and renormalizes the quaternion.
         *  \param value The quaternion to conjugate and renormalize.
         *  \return The conjugated and renormalized quaternion. */
        static Quaternion Invert(const Quaternion& value);

        /*! Performs a linear interpolation between two quaternions.
         *  \param start Start quaternion.
         *  \param end End quaternion.
         *  \param amount Value between 0 and 1 indicating the weight of \p end.
         *  \param result When the method completes, contains the linear interpolation of the two quaternions.
         *  \remark
         *      This method performs the linear interpolation based on the following formula.
         *      \code start + (end - start) * amount \endcode
         *      Passing \p amount a value of 0 will cause \p start to be returned; a value of 1 will cause \p end to be returned.  */
        static void Lerp(const Quaternion& start, const Quaternion& end, float amount, Quaternion& result);

        /*! Performs a linear interpolation between two quaternion.
         *  \param start Start quaternion.
         *  \param end End quaternion.
         *  \param amount Value between 0 and 1 indicating the weight of \p end.
         *  \return The linear interpolation of the two quaternions.
         *  \remark
         *      This method performs the linear interpolation based on the following formula.
         *      \code start + (end - start) * amount \endcode
         *      Passing \p amount a value of 0 will cause \p start to be returned; a value of 1 will cause \p end to be returned.  */
        static Quaternion Lerp(const Quaternion& start, const Quaternion& end, float amount);

        /*! Calculates the natural logarithm of the specified quaternion.
         *  \param value The quaternion whose logarithm will be calculated.
         *  \param result When the method completes, contains the natural logarithm of the quaternion. */
        static void Logarithm(const Quaternion& value, Quaternion& result);

        /*! Calculates the natural logarithm of the specified quaternion.
         *  \param value The quaternion whose logarithm will be calculated.
         *  \return The natural logarithm of the quaternion. */
        static Quaternion Logarithm(const Quaternion& value);

        /*! Converts the quaternion into a unit quaternion.
         *  \param value The quaternion to normalize.
         *  \param result When the method completes, contains the normalized quaternion. */
        static void Normalize(const Quaternion& value, Quaternion& result);

        /*! Converts the quaternion into a unit quaternion.
         *  \param value The quaternion to normalize.
         *  \return The normalized quaternion. */
        static Quaternion Normalize(const Quaternion& value);

        /*! Creates a quaternion given a rotation and an axis.
         *  \param axis The axis of rotation.
         *  \param angle The angle of rotation.
         *  \param result When the method completes, contains the newly created quaternion. */
        static void RotationAxis(const Vector3& axis, float angle, Quaternion& result);

        /*! Creates a quaternion given a rotation and an axis.
         *  \param axis The axis of rotation.
         *  \param angle The angle of rotation.
         *  \return The newly created quaternion. */
        static Quaternion RotationAxis(const Vector3& axis, float angle);

        /*! Creates a quaternion given a rotation matrix.
         *  \param matrix The rotation matrix.
         *  \param result When the method completes, contains the newly created quaternion. */
        static void RotationMatrix(const Matrix4& matrix, Quaternion& result);

        /*! Creates a quaternion given a rotation matrix.
         *  \param matrix The rotation matrix.
         *  \param result When the method completes, contains the newly created quaternion. */
        static void RotationMatrix(const Matrix3& matrix, Quaternion& result);

        /*! Creates a lhs-handed, look-at quaternion.
         *  \param eye The position of the viewer's eye.
         *  \param target The camera look-at target.
         *  \param up The camera's up vector.
         *  \param result When the method completes, contains the created look-at quaternion. */
        static void LookAtLH(const Vector3& eye, const Vector3& target, const Vector3& up, Quaternion& result);

        /*! Creates a lhs-handed, look-at quaternion.
         *  \param eye The position of the viewer's eye.
         *  \param target The camera look-at target.
         *  \param up The camera's up vector.
         *  \return The created look-at quaternion. */
        static Quaternion LookAtLH(const Vector3& eye, const Vector3& target, const Vector3& up);

        /*! Creates a lhs-handed, look-at quaternion.
         *  \param forward The camera's forward direction.
         *  \param up The camera's up vector.
         *  \param result When the method completes, contains the created look-at quaternion. */
        static void RotationLookAtLH(const Vector3& forward, const Vector3& up, Quaternion& result);

        /*! Creates a lhs-handed, look-at quaternion.
         *  \param forward The camera's forward direction.
         *  \param up The camera's up vector.
         *  \return The created look-at quaternion. */
        static Quaternion RotationLookAtLH(const Vector3& forward, const Vector3& up);

        /*! Creates a rhs-handed, look-at quaternion.
         *  \param eye The position of the viewer's eye.
         *  \param target The camera look-at target.
         *  \param up The camera's up vector.
         *  \param result When the method completes, contains the created look-at quaternion. */
        static void LookAtRH(const Vector3& eye, const Vector3& target, const Vector3& up, Quaternion& result);

        /*! Creates a rhs-handed, look-at quaternion.
         *  \param eye The position of the viewer's eye.
         *  \param target The camera look-at target.
         *  \param up The camera's up vector.
         *  \return The created look-at quaternion. */
        static Quaternion LookAtRH(const Vector3& eye, const Vector3& target, const Vector3& up);

        /*! Creates a rhs-handed, look-at quaternion.
         *  \param forward The camera's forward direction.
         *  \param up The camera's up vector.
         *  \param result When the method completes, contains the created look-at quaternion. */
        static void RotationLookAtRH(const Vector3& forward, const Vector3& up, Quaternion& result);

        /*! Creates a rhs-handed, look-at quaternion.
         *  \param forward The camera's forward direction.
         *  \param up The camera's up vector.
         *  \return The created look-at quaternion. */
        static Quaternion RotationLookAtRH(const Vector3& forward, const Vector3& up);

        /*! Creates a lhs-handed spherical billboard that rotates around a specified object position.
         *  \param objectPosition The position of the object around which the billboard will rotate.
         *  \param cameraPosition The position of the camera.
         *  \param cameraUpVector The up vector of the camera.
         *  \param cameraForwardVector The forward vector of the camera.
         *  \param result When the method completes, contains the created billboard quaternion. */
        static void BillboardLH(const Vector3& objectPosition, const Vector3& cameraPosition, const Vector3& cameraUpVector, const Vector3& cameraForwardVector, Quaternion& result);

        /*! Creates a lhs-handed spherical billboard that rotates around a specified object position.
         *  \param objectPosition The position of the object around which the billboard will rotate.
         *  \param cameraPosition The position of the camera.
         *  \param cameraUpVector The up vector of the camera.
         *  \param cameraForwardVector The forward vector of the camera.
         *  \return The created billboard quaternion. */
        static Quaternion BillboardLH(const Vector3& objectPosition, const Vector3& cameraPosition, const Vector3& cameraUpVector, const Vector3& cameraForwardVector);

        /*! Creates a rhs-handed spherical billboard that rotates around a specified object position.
         *  \param objectPosition The position of the object around which the billboard will rotate.
         *  \param cameraPosition The position of the camera.
         *  \param cameraUpVector The up vector of the camera.
         *  \param cameraForwardVector The forward vector of the camera.
         *  \param result When the method completes, contains the created billboard quaternion. */
        static void BillboardRH(const Vector3& objectPosition, const Vector3& cameraPosition, const Vector3& cameraUpVector, const Vector3& cameraForwardVector, Quaternion& result);

        /*! Creates a rhs-handed spherical billboard that rotates around a specified object position.
         *  \param objectPosition The position of the object around which the billboard will rotate.
         *  \param cameraPosition The position of the camera.
         *  \param cameraUpVector The up vector of the camera.
         *  \param cameraForwardVector The forward vector of the camera.
         *  \return The created billboard quaternion. */
        static Quaternion BillboardRH(const Vector3& objectPosition, const Vector3& cameraPosition, const Vector3& cameraUpVector, const Vector3& cameraForwardVector);

        /*! Creates a quaternion given a rotation matrix.
         *  \param matrix The rotation matrix.
         *  \return The newly created quaternion. */
        static Quaternion RotationMatrix(const Matrix4& matrix);

        /*! Creates a quaternion given a yaw, pitch, and roll value.
         *  \param yaw The yaw of rotation.
         *  \param pitch The pitch of rotation.
         *  \param roll The roll of rotation.
         *  \param result When the method completes, contains the newly created quaternion. */
        static void RotationYawPitchRoll(float yaw, float pitch, float roll, Quaternion& result);

        /*! Creates a quaternion given a yaw, pitch, and roll value.
         *  \param yaw The yaw of rotation.
         *  \param pitch The pitch of rotation.
         *  \param roll The roll of rotation.
         *  \return The newly created quaternion. */
        static Quaternion RotationYawPitchRoll(float yaw, float pitch, float roll);

        /*! Interpolates between two quaternions, using spherical linear interpolation.
         *  \param start Start quaternion.
         *  \param end End quaternion.
         *  \param amount Value between 0 and 1 indicating the weight of \p end.
         *  \param result When the method completes, contains the spherical linear interpolation of the two quaternions. */
        static void Slerp(const Quaternion& start, const Quaternion& end, float amount, Quaternion& result);

        /*! Interpolates between two quaternions, using spherical linear interpolation.
         *  \param start Start quaternion.
         *  \param end End quaternion.
         *  \param amount Value between 0 and 1 indicating the weight of \p end.
         *  \return The spherical linear interpolation of the two quaternions. */
        static Quaternion Slerp(const Quaternion& start, const Quaternion& end, float amount);

        /*! Interpolates between quaternions, using spherical quadrangle interpolation.
         *  \param value1 First source quaternion.
         *  \param value2 Second source quaternion.
         *  \param value3 Third source quaternion.
         *  \param value4 Fourth source quaternion.
         *  \param amount Value between 0 and 1 indicating the weight of interpolation.
         *  \param result When the method completes, contains the spherical quadrangle interpolation of the quaternions. */
        static void Squad(const Quaternion& value1, const Quaternion& value2, const Quaternion& value3, const Quaternion& value4, float amount, Quaternion& result);

        /*! Interpolates between quaternions, using spherical quadrangle interpolation.
         *  \param value1 First source quaternion.
         *  \param value2 Second source quaternion.
         *  \param value3 Third source quaternion.
         *  \param value4 Fourth source quaternion.
         *  \param amount Value between 0 and 1 indicating the weight of interpolation.
         *  \return The spherical quadrangle interpolation of the quaternions. */
        static Quaternion Squad(const Quaternion& value1, const Quaternion& value2, const Quaternion& value3, const Quaternion& value4, float amount);

        /*! Sets up control points for spherical quadrangle interpolation.
         *  \param value1 First source quaternion.
         *  \param value2 Second source quaternion.
         *  \param value3 Third source quaternion.
         *  \param value4 Fourth source quaternion.
         *  \param results When method completes, an array of three quaternions that represent control points for spherical quadrangle interpolation. */
        static void SquadSetup(const Quaternion& value1, const Quaternion& value2, const Quaternion& value3, const Quaternion& value4, Quaternion* results);

    private:
        float x_;	//!< The x component of the quaternion.
        float y_;   //!< The y component of the quaternion.
        float z_;   //!< The z component of the quaternion.
        float w_;   //!< The w component of the quaternion.

    public:
        /*! Constructs a \ref Quaternion with default values. */
        inline Quaternion()
            : x_(0.0f)
            , y_(0.0f)
            , z_(0.0f)
            , w_(0.0f)
        {
            // nothing
        }

        /*! Constructs a \ref Quaternion.
         *  \param value The value that will be assigned to all components. */
        inline Quaternion(float value)
            : x_(value)
            , y_(value)
            , z_(value)
            , w_(value)
        {
            // nothing
        }

        /*! Constructs a \ref Quaternion.
         *  \param value A vector containing the values with which to initialize the components. */
        inline Quaternion(const Vector4& value)
            : x_(value.x())
            , y_(value.y())
            , z_(value.z())
            , w_(value.w())
        {
            // nothing
        }

        /*! Constructs a \ref Quaternion.
         *  \param value A vector containing the values with which to initialize the x_, y_, and z components.
         *  \param w Initial value for the w component of the quaternion. */
        inline Quaternion(const Vector3& value, float w)
            : x_(value.x())
            , y_(value.y())
            , z_(value.z())
            , w_(w)
        {
            // nothing
        }

        /*! Constructs a \ref Quaternion.
         *  \param value A vector containing the values with which to initialize the x_ and y components.
         *  \param z Initial value for the z component of the quaternion.
         *  \param w Initial value for the w component of the quaternion. */
        inline Quaternion(const Vector2& value, float z, float w)
            : x_(value.x())
            , y_(value.y())
            , z_(z)
            , w_(w)
        {
            // nothing
        }

        /*! Constructs a \ref Quaternion.
         *  \param x Initial value for the x component of the quaternion.
         *  \param y Initial value for the y component of the quaternion.
         *  \param z Initial value for the z component of the quaternion.
         *  \param w Initial value for the w component of the quaternion. */
        inline Quaternion(float x, float y, float z, float w)
            : x_(x)
            , y_(y)
            , z_(z)
            , w_(w)
        {
            // nothing
        }

        /*! Constructs a \ref Quaternion.
         *  \param values The values to assign to the x_, y_, z_, and w components of the quaternion. This must be an array with four elements.
         *  \exception ArgumentNullException Thrown when \p values is null.
         *  \exception ArgumentOutOfRangeException Thrown when \p values contains more or less than four elements. */
        inline Quaternion(float const * const values) {
            if (values == nullptr) {
                throw ArgumentNullException("values");
            }

            x_ = values[0];
            y_ = values[1];
            z_ = values[2];
            w_ = values[3];
        }

        /*! Constructs a \ref Quaternion from another \ref Quaternion.
         *  \param rhs A quaternion containing the values with which to initialize all components with. */
        inline Quaternion(const Quaternion& rhs)
            : x_(rhs.x_)
            , y_(rhs.y_)
            , z_(rhs.z_)
            , w_(rhs.w_)
        {
            // nothing
        }

        /*! Assigns another Quaternion to this.
         *  \param rhs A quaternion containing the values with which to assign all components to. */
        inline Quaternion& operator = (const Quaternion& rhs) {
            x_ = rhs.x_;
            y_ = rhs.y_;
            z_ = rhs.z_;
            w_ = rhs.w_;

            return *this;
        }

    public:
        /*! Gets the component at the specified index.
         *  The value of the x, y, z, or w component, depending on the index.
         *  \param index The index of the component to access. Use 0 for the x component, 1 for the y component, 2 for the z component, and 3 for the w component.
         *  \return The value of the component at the specified index.
         *  \exception ArgumentOutOfRangeException Thrown when the \p index is out of the range [0, 3]. */
        inline float operator [] (int index) const {
            if (index < 0 || index > 3) { throw ArgumentOutOfRangeException("index", "Indices for Quaternion run from 0 to 3, inclusive."); }
            return *(&x_ + index);
        }

        /*! Gets the component at the specified index.
         *  The value of the x, y, z, or w component, depending on the index.
         *  \param index The index of the component to access. Use 0 for the x component, 1 for the y component, 2 for the z component, and 3 for the w component.
         *  \return The value of the component at the specified index.
         *  \exception ArgumentOutOfRangeException Thrown when the \p index is out of the range [0, 3]. */
        inline float& operator [] (int index) {
            if (index < 0 || index > 3) { throw ArgumentOutOfRangeException("index", "Indices for Quaternion run from 0 to 3, inclusive."); }
            return *(&x_ + index);
        }

        /*! Determines whether the specified quaternion is considered equal.
         *  \param rhs The quaternion to compare.
         *  \return true if \p rhs is equal, false otherwise. */
        inline bool operator == (const Quaternion& rhs) const {
            return Math::NearEqual(rhs.x_, x_) &&
                   Math::NearEqual(rhs.y_, y_) &&
                   Math::NearEqual(rhs.z_, z_) &&
                   Math::NearEqual(rhs.w_, w_);
        }

        /*! Determines whether the specified quaternion is considered not equal.
         *  \param rhs The quaternion to compare.
         *  \return true if \p rhs is not equal, false otherwise. */
        inline bool operator != (const Quaternion& rhs) const {
            return !Math::NearEqual(rhs.x_, x_) ||
                   !Math::NearEqual(rhs.y_, y_) ||
                   !Math::NearEqual(rhs.z_, z_) ||
                   !Math::NearEqual(rhs.w_, w_);
        }

        /*! Adds two quaternions.
         *  \param rhs The quaternion to add.
         *  \return The sum of the two quaternions. */
        inline Quaternion operator + (const Quaternion& rhs) const {
            return Quaternion(x_ + rhs.x_, y_ + rhs.y_, z_ + rhs.z_, w_ + rhs.w_);
        }

        /*! Adds specified amount to quaternion.
         *  \param value The scalar value to add.
         *  \return The quaternion with added scalar. */
        inline Quaternion operator + (float value) const {
            return Quaternion(x_ + value, y_ + value, z_ + value, w_ + value);
        }

        /*! Subtracts two quaternions.
         *  \param rhs The quaternion to subtract.
         *  \return The difference of the two quaternions. */
        inline Quaternion operator - (const Quaternion& rhs) const {
            return Quaternion(x_ - rhs.x_, y_ - rhs.y_, z_ - rhs.z_, w_ - rhs.w_);
        }

        /*! Subtracts specified amount from quaternion.
         *  \param value The scalar value to subtract.
         *  \return The quaternion with subtracted scalar. */
        inline Quaternion operator - (float value) const {
            return Quaternion(x_ - value, y_ - value, z_ - value, w_ - value);
        }

        /*! Multiplies two quaternions.
         *  \param rhs The quaternion to multiply.
         *  \return The product of the two quaternions. */
        inline Quaternion operator * (const Quaternion& rhs) const {
            float lx = x_;
            float ly = y_;
            float lz = z_;
            float lw = w_;
            float rx = rhs.x_;
            float ry = rhs.y_;
            float rz = rhs.z_;
            float rw = rhs.w_;
            float a = (ly * rz - lz * ry);
            float b = (lz * rx - lx * rz);
            float c = (lx * ry - ly * rx);
            float d = (lx * rx + ly * ry + lz * rz);

            return Quaternion((lx * rw + rx * lw) + a,
                              (ly * rw + ry * lw) + b,
                              (lz * rw + rz * lw) + c,
                              lw * rw - d);
        }

        /*! Scales a quaternion by the given value.
         *  \param scale The amount by which to scale the quaternion.
         *  \return The scaled quaternion. */
        inline Quaternion operator * (float scale) {
            return Quaternion(x_ * scale, y_ * scale, z_ * scale, w_ * scale);
        }

        /*! Divides two quaternions.
         *  \param rhs The quaternion to multiply.
         *  \return The quotient of the two quaternions. */
        inline Quaternion operator / (const Quaternion& rhs) const {
            return ((*this) * rhs.Inverse());
        }

        /*! Scales a quaternion by the given value.
         *  \param scale The amount by which to scale the quaternion.
         *  \return The scaled quaternion. */
        inline Quaternion operator / (float scale) {
            scale = 1.0f / scale;
            return Quaternion(x_ * scale, y_ * scale, z_ * scale, w_ * scale);
        }

        /*! Assert a color (return it unchanged).
         *  \return The asserted (unchanged) color. */
        inline const Quaternion& operator + () const {
            return *this;
        }

        /*! Negates the quaternion.
         *  \return The negated quaternion. */
        inline Quaternion operator - () const {
            Quaternion result;
            Negate(*this, result);
            return result;
        }

        /*! Adds two quaternions and assigns it to this.
         *  \param rhs The quaternion to add.
         *  \return The reference to this. */
        inline Quaternion& operator += (const Quaternion& rhs) {
            x_ += rhs.x_;
            y_ += rhs.y_;
            z_ += rhs.z_;
            w_ += rhs.w_;

            return *this;
        }

        /*! Adds specified amount to quaternion and assigns it to this
         *  \param value The scalar value to add.
         *  \return The reference to this. */
        inline Quaternion& operator += (float value) {
            x_ += value;
            y_ += value;
            z_ += value;
            w_ += value;

            return *this;
        }

        /*! Subtracts two quaternions and assigns it to this.
         *  \param rhs The quaternion to subtract.
         *  \return The reference to this. */
        inline Quaternion& operator -= (const Quaternion& rhs) {
            x_ -= rhs.x_;
            y_ -= rhs.y_;
            z_ -= rhs.z_;
            w_ -= rhs.w_;

            return *this;
        }

        /*! Subtracts specified amount from quaternion and assigns it to this.
         *  \param value The scalar value to subtract.
         *  \return The reference to this. */
        inline Quaternion& operator -= (float value) {
            x_ -= value;
            y_ -= value;
            z_ -= value;
            w_ -= value;

            return *this;
        }

        /*! Multiplies two quaternions and assigns it to this.
         *  \param rhs The quaternion to multiply.
         *  \return The reference to this. */
        inline Quaternion& operator *= (const Quaternion& rhs) {
            float lx = x_;
            float ly = y_;
            float lz = z_;
            float lw = w_;
            float rx = rhs.x_;
            float ry = rhs.y_;
            float rz = rhs.z_;
            float rw = rhs.w_;
            float a = (ly * rz - lz * ry);
            float b = (lz * rx - lx * rz);
            float c = (lx * ry - ly * rx);
            float d = (lx * rx + ly * ry + lz * rz);

            x_ = (lx * rw + rx * lw) + a;
            y_ = (ly * rw + ry * lw) + b;
            z_ = (lz * rw + rz * lw) + c;
            w_ = lw * rw - d;

            return *this;
        }

        /*! Multiplies quaternion with value and assigns it to this.
         *  \param value The quaternion to mod by.
         *  \return The reference to this. */
         inline Quaternion& operator *= (float value) {
            x_ *= value;
            y_ *= value;
            z_ *= value;
            w_ *= value;

            return *this;
        }

        /*! Divides two quaternions and assigns it to this.
         *  \param rhs The quaternion to divide by.
         *  \return The reference to this. */
        inline Quaternion& operator /= (const Quaternion& rhs) {
            (*this) = (*this) * rhs.Inverse();

            return *this;
        }

        /*! Divides quaternion with value and assigns it to this.
         *  \param value The quaternion to mod by.
         *  \return The reference to this. */
         inline Quaternion& operator /= (float value) {
            value = 1.0f / value;

            x_ *= value;
            y_ *= value;
            z_ *= value;
            w_ *= value;

            return *this;
        }

        /*! Performs an explicit conversion from \ref Quaternion to \ref Vector4.
         *  \return The result of the conversion. */
        explicit operator Vector4() {
            return ToVector4();
        }

    public:
        /*! Conjugates the quaternion. */
        inline void Conjugate() {
            x_ = -x_;
            y_ = -y_;
            z_ = -z_;
        }

        /*! Conjugates and renormalizes the quaternion. */
        inline void Invert() {
            float lengthSq = LengthSquared();
            if (!Math::IsZero(lengthSq)) {
                lengthSq = 1.0f / lengthSq;

                x_ = -x_ * lengthSq;
                y_ = -y_ * lengthSq;
                z_ = -z_ * lengthSq;
                w_ = w_ * lengthSq;
            }
        }

        /*! Converts the quaternion into a unit quaternion. */
        inline void Normalize() {
            float length = Length();
            if (!Math::IsZero(length)) {
                float inverse = 1.0f / length;
                x_ *= inverse;
                y_ *= inverse;
                z_ *= inverse;
                w_ *= inverse;
            }
        }

         /*! Exponentiates a quaternion. */
        inline void Exponential()  {
            float angle = (float)sqrt((x_ * x_) + (y_ * y_) + (z_ * z_));
            float sine = (float)sin(angle);

            if (fabs(sine) >= Math::ZeroTolerance()) {
                float coeff = sine / angle;
                x_ = coeff * x_;
                y_ = coeff * y_;
                z_ = coeff * z_;
            }

            w_ = (float)cos(angle);
        }

        /*! Calculates the natural logarithm of the specified quaternion. */
        inline void Logarithm() {
            if (fabs(w_) < 1.0f) {
                float angle = (float)acos(w_);
                float sine = (float)sin(angle);

                if (fabs(sine) >= Math::ZeroTolerance()) {
                    float coeff = angle / sine;
                    x_ = x_ * coeff;
                    y_ = y_ * coeff;
                    z_ = z_ * coeff;
                }
            }

            w_ = 0.0f;
        }

        /*! Reverses the direction of a given quaternion. */
        inline void Negate() {
            x_ = -x_;
            y_ = -y_;
            z_ = -z_;
            w_ = -w_;
        }

    public:
        /*! Gets the angle of the quaternion.
         *  The quaternion's angle. */
        float Angle() const {
            float length = (x_ * x_) + (y_ * y_) + (z_ * z_);

            if (Math::IsZero(length)) {
                return 0.0f;
            }

            return (float)(2.0f * acos(Math::Clamp(w_, -1.0f, 1.0f)));
        }

        /*! Gets the axis components of the quaternion.
         *  The axis components of the quaternion. */
        Vector3 Axis() const {
            float length = (x_ * x_) + (y_ * y_) + (z_ * z_);

            if (Math::IsZero(length)) {
                return Vector3::UnitX;
            }

            float inv = 1.0f / (float)sqrt(length);
            return Vector3(x_ * inv, y_ * inv, z_ * inv);
        }

        /*! Calculates the dot product of two quaternions.
         *  \param rhs The quaternion.
         *  \return The dot product of the two quaternions. */
        inline float Dot(const Quaternion& rhs) const;

        /*! Conjugates and renormalizes the quaternion.
         *  \return The conjugated and renormalized quaternion. */
        Quaternion Inverse() const {
            Quaternion result;
            Invert(*this, result);
            return result;
        }

        /*! Calculates the length of the quaternion.
         *  \return The length of the quaternion.
         *  \remark
         *      \ref Quaternion::LengthSquared may be preferred when only the relative length is needed
         *      and speed is of the essence. */
        float Length() const {
            return (float)sqrt((x_ * x_) + (y_ * y_) + (z_ * z_) + (w_ * w_));
        }

        /*! Calculates the squared length of the quaternion.
         *  \return The squared length of the quaternion.
         *  \remark
         *      This method may be preferred to \ref Quaternion::Length when only a relative length is needed
         *      and speed is of the essence. */
        float LengthSquared() const {
            return (x_ * x_) + (y_ * y_) + (z_ * z_) + (w_ * w_);
        }

    public:
        /*! Converts from \ref Quaternion to \ref Vector4. */
        Vector4 ToVector4() const {
            return Vector4(x_, y_, z_, w_);
        }

        /*! Creates an array containing the elements of the quaternion.
         *  \param result A four-element array containing the components of the quaternion. */
        void ToArray(float* result) {
            result[0] = x_;
            result[1] = y_;
            result[2] = z_;
            result[3] = w_;
        }

    public:
        /*! Gets a value indicating whether this instance is equivalent to the identity quaternion.
         *  \return True if this instance is an identity quaternion; otherwise, false. */
        inline bool IsIdentity() const {
            return *this == Identity;
        }

        /*! Gets a value indicting whether this instance is normalized. */
        inline bool IsNormalized() const {
            return Math::IsOne((x_ * x_) + (y_ * y_) + (z_ * z_) + (w_ * w_));
        }

        inline bool IsUnit() const {
            return IsNormalized();
        }

    public:
        inline float x() const { return x_; }
        inline float y() const { return y_; }
        inline float z() const { return z_; }
        inline float w() const { return w_; }

        inline void set_x(float value) { x_ = value; }
        inline void set_y(float value) { y_ = value; }
        inline void set_z(float value) { z_ = value; }
        inline void set_w(float value) { w_ = value; }

        inline void set(float x, float y, float z, float w) {
            x_ = x;
            y_ = y;
            z_ = z;
            w_ = w;
        }

        inline void set(const Vector3& axis, float w) {
            x_ = axis.x();
            y_ = axis.y();
            z_ = axis.z();
            w_ = w;
        }

    public:
        /*! Determines whether the two dummys are considered equal.
         *  \param lhs The first quaternion to compare.
         *  \param rhs The second quaternion to compare.
         *  \return True if the lhs and rhs parameters have the same value; otherwise, false. */
        /*inline friend bool operator == (const Quaternion& lhs, const Quaternion& rhs) {
            return Math::NearEqual(lhs.x_, rhs.x_) &&
                   Math::NearEqual(lhs.y_, rhs.y_) &&
                   Math::NearEqual(lhs.z_, rhs.z_) &&
                   Math::NearEqual(lhs.w_, rhs.w_);
        }*/

        /*! Determines whether the two dummys are considered not equal.
         *  \param lhs The first quaternion to compare.
         *  \param rhs The second quaternion to compare.
         *  \return True if the lhs and rhs parameters do not have the same value; otherwise, false. */
        inline friend bool operator != (const Quaternion& lhs, const Quaternion& rhs) {
            return !Math::NearEqual(lhs.x_, rhs.x_) ||
                   !Math::NearEqual(lhs.y_, rhs.y_) ||
                   !Math::NearEqual(lhs.z_, rhs.z_) ||
                   !Math::NearEqual(lhs.w_, rhs.w_);
        }

        /*! Scales a quaternion by the given value.
         *  \param scale The amount by which to scale the quaternion.
         *  \param rhs The quaternion to scale.
         *  \return The scaled quaternion. */
        inline friend Quaternion operator * (float scale, const Quaternion& rhs) {
            Quaternion result;
            Multiply(rhs, scale, result);
            return result;
        }

        /*! Scales a quaternion by the given value.
         *  \param lhs The quaternion to scale.
         *  \param scale The amount by which to scale the quaternion.
         *  \return The scaled quaternion. */
        inline friend Quaternion operator * (const Quaternion& lhs, float scale) {
            Quaternion result;
            Multiply(lhs, scale, result);
            return result;
        }

        /*! Scales a quaternion by the given value.
         *  \param scale The amount by which to scale the quaternion.
         *  \param rhs The quaternion to scale.
         *  \return The scaled quaternion. */
        inline friend Quaternion operator / (float scale, const Quaternion& rhs) {
            Quaternion result;
            Divide(scale, rhs, result);
            return result;
        }

        /*! Scales a quaternion by the given value.
         *  \param lhs The quaternion to scale.
         *  \param scale The amount by which to scale the quaternion.
         *  \return The scaled quaternion. */
        inline friend Quaternion operator / (const Quaternion& lhs, float scale) {
            Quaternion result;
            Divide(lhs, scale, result);
            return result;
        }

        /*! Write out to stream.
         *  \param stream The stream.
         *  \param rhs The quaternion. */
        inline friend std::ostream& operator << (std::ostream& stream, const Quaternion& rhs) {
            stream << "quaternion(x: " << rhs.x_ << " y:" << rhs.y_ << " z:" << rhs.z_ << " w:" << rhs.w_ << ")";
            return stream;
        }
    };

    /*! Returns a hash code for instance.
     *  \return A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. */
    inline std::size_t hash_value(const Quaternion& rhs) {
        std::size_t seed = 0;

        boost::hash_combine(seed, rhs.x());
        boost::hash_combine(seed, rhs.y());
        boost::hash_combine(seed, rhs.z());
        boost::hash_combine(seed, rhs.w());

        return seed;
    }

} // ludi

// Inline implementation
//#include "Quaternion.inl"

#endif // LUDI_QUATERNION_H_

redpajama_set_name: RedPajamaGithub


text:
sudo chmod -R 777 var
git checkout var
sudo php bin/console cache:clear --env=dev --no-debug
sudo php bin/console cache:clear --env=prod --no-debug
sudo chmod -R 777 var
git checkout var


text:
package com.google.i18n.phonenumbers;

/**
 * Generic exception class for errors encountered when parsing phone numbers.
 */
@SuppressWarnings("serial")
public class NumberParseException extends Exception {

  public enum ErrorType {
    INVALID_COUNTRY_CODE,
    // This generally indicates the string passed in had less than 3 digits in it. More
    // specifically, the number failed to match the regular expression VALID_PHONE_NUMBER in
    // PhoneNumberUtil.java.
    NOT_A_NUMBER,
    // This indicates the string started with an international dialing prefix, but after this was
    // stripped from the number, had less digits than any valid phone number (including country
    // code) could have.
    TOO_SHORT_AFTER_IDD,
    // This indicates the string, after any country code has been stripped, had less digits than any
    // valid phone number could have.
    TOO_SHORT_NSN,
    // This indicates the string had more digits than any valid phone number could have.
    TOO_LONG,
  }

  private ErrorType errorType;
  private String message;

  public NumberParseException(ErrorType errorType, String message) {
    super(message);
    this.message = message;
    this.errorType = errorType;
  }

  /**
   * Returns the error type of the exception that has been thrown.
   */
  public ErrorType getErrorType() {
    return errorType;
  }

  @Override
  public String toString() {
    return "Error type: " + errorType + ". " + message;
  }
}


text:
layout: "cosmic"
page_title: "Cosmic: cosmic_network_acl"
sidebar_current: "docs-cosmic-resource-network-acl"
description: |-
  Creates a Network ACL for the given VPC.
---

# cosmic_network_acl

Creates a Network ACL for the given VPC.

## Example Usage

```hcl
resource "cosmic_network_acl" "default" {
  name   = "test-acl"
  vpc_id = "76f6e8dc-07e3-4971-b2a2-8831b0cc4cb4"
}
```

## Argument Reference

The following arguments are supported:

* `name` - (Required) The name of the ACL.

* `description` - (Optional) The description of the ACL.

* `vpc_id` - (Required) The ID of the VPC to create this ACL for. Changing this
   forces a new resource to be created.

## Attributes Reference

The following attributes are exported:

* `id` - The ID of the Network ACL

## Import (EXPERIMENTAL)

Network ACLs can be imported; use `<NETWORK ACL ID>` as the import ID. For
example:

```shell
terraform import cosmic_network_acl.default e8b5982a-1b50-4ea9-9920-6ea2290c7359
```


text:
declare var jest, describe, it, expect, require;

import * as React from 'react';
import {shallow} from 'enzyme';
import toJson from 'enzyme-to-json';

import { ContactList } from '../../src/components';

const testComponent1 = shallow(
  <ContactList
    contacts={
      [
        {
          userId: 'perez',
          name: 'Perez',
          pictureUrl: 'http://www.material-ui.com/images/adellecharles-128.jpg',
        }, {
          userId: 'lewis',
          name: 'Lewis',
          pictureUrl: 'http://www.material-ui.com/images/adhamdannaway-128.jpg',
        }, {
          userId: 'harris',
          name: 'Harris',
          pictureUrl: 'http://www.material-ui.com/images/allisongrayce-128.jpg',
        }, {
          userId: 'lee',
          name: 'Lee',
          pictureUrl: 'http://www.material-ui.com/images/ok-128.jpg',
        }, {
          userId: 'gonzalez',
          name: 'Gonzalez',
          pictureUrl: 'http://www.material-ui.com/images/angelceballos-128.jpg',
        }
      ]
    }
  />
);
it('ContactList renders correctly', () => {
  const j = toJson(testComponent1);
  expect(j).toMatchSnapshot();
});

const testComponent2 = shallow(
  <ContactList
    contacts={
      [
        {
          userId: 'perez',
          name: 'Perez',
          pictureUrl: 'http://www.material-ui.com/images/adellecharles-128.jpg',
        }, {
          userId: 'lewis',
          name: 'Lewis',
          pictureUrl: 'http://www.material-ui.com/images/adhamdannaway-128.jpg',
        }, {
          userId: 'harris',
          name: 'Harris',
          pictureUrl: 'http://www.material-ui.com/images/allisongrayce-128.jpg',
        }, {
          userId: 'lee',
          name: 'Lee',
          pictureUrl: 'http://www.material-ui.com/images/ok-128.jpg',
        }, {
          userId: 'gonzalez',
          name: 'Gonzalez',
          pictureUrl: 'http://www.material-ui.com/images/angelceballos-128.jpg',
        }
      ]
    }
    selectedContacts={{
      ['perez']: {
        userId: 'perez',
        name: 'Perez',
        pictureUrl: 'http://www.material-ui.com/images/adellecharles-128.jpg',
      }
    }}
    noContactListText="No contacts"
    noContactListImage="http://example.com/noimage.png"
    checkedIcon={<div />}
    unCheckedIcon={<div />}
    className="test-class"
    style={{width: '100px'}}
    onClick={() => console.log('click')}
  />
);
it('ContactList renders correctly', () => {
  const j = toJson(testComponent2);
  expect(j).toMatchSnapshot();
});


text:
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title>LightZone: Tool Anatomy</title>
    <meta name="description"
      content="Description of the LightZone tool menu."/>
    <link rel="stylesheet" type="text/css" href="Help.css" media="all"/>
    <link rel="stylesheet" type="text/css" href="Platform.css" media="all"/>

        Ayuda de LightZone

        Index

Tool menu

      The Menu button in a tool's title bar
      pops-up a menu when clicked.
      The menu items are described below.

Disable/Enable

        Disables (or enables) the tool.
        (This is the same as clicking the Enable/Disable checkbox
        in a tool's title bar.)

Lock/Unlock

        Locks (or unlocks) the tool.
        A locked tool's settings can not be modified.
        Additionally, a locked tool can not have
        regions
        added to or deleted from it,
        nor can they be selected or edited.

Recordar Preset

        Remembers the current settings for the tool.

Aplicar Preset

        Applies the previously remembered settings to the tool.

Collapse

        Collapses the tool.
        (This is the same as double-clicking in an expanded tool's title bar.)

Collapse All

        Collapses all tools.

Collapse Others

        Collapses all the tools except the current one.

Expand

        Expands the tool.
        (This is the same as double-clicking in an collapsed tool's title bar.)

Expand All

        Expands all collapsed tools.

Auto Expand

        When checked,
        when you select a tool in the
        tool stack,
        it will automatically expand
        and the previously selected tool will automatically collapse.

Borrar

        Deletes the tool from the
        tool stack.
        (This is the same as clicking the Delete button
        in a tool's title bar.)


text:
package org.lemsml.jlems.core.xml;

public interface XMLContainer {

	void setXMLContent(String s);

}


text:
package org.jboss.gravia.resource.spi;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;

import javax.management.openmbean.CompositeData;
import javax.management.openmbean.OpenDataException;

import org.jboss.gravia.resource.Attachable;
import org.jboss.gravia.resource.AttachmentKey;
import org.jboss.gravia.resource.Capability;
import org.jboss.gravia.resource.CompositeDataResourceType;
import org.jboss.gravia.resource.ContentCapability;
import org.jboss.gravia.resource.ContentNamespace;
import org.jboss.gravia.resource.IdentityNamespace;
import org.jboss.gravia.resource.Requirement;
import org.jboss.gravia.resource.Resource;
import org.jboss.gravia.resource.ResourceContent;
import org.jboss.gravia.resource.ResourceIdentity;
import org.jboss.gravia.resource.Version;

/**
 * An abstract implementation of a {@link Resource}
 *
 * @author thomas.diesler@jboss.com
 * @since 02-Jul-2010
 */
public abstract class AbstractResource implements Resource {

    private final List<AbstractCapability> capabilities = new ArrayList<AbstractCapability>();
    private final List<AbstractRequirement> requirements = new ArrayList<AbstractRequirement>();
    private final AtomicBoolean mutable = new AtomicBoolean(true);
    private Capability identityCapability;
    private ResourceIdentity identity;

    private transient Attachable attachments;

    void addCapability(AbstractCapability cap) {
        synchronized (capabilities) {
            assertMutable();
            capabilities.add(cap);
        }
    }

    void addRequirement(AbstractRequirement req) {
        synchronized (requirements) {
            assertMutable();
            requirements.add(req);
        }
    }

    @Override
    @SuppressWarnings("unchecked")
    public <T> T adapt(Class<T> type) {
        T result = null;
        if (type.isAssignableFrom(getClass())) {
            result = (T) this;
        } else if (type.isAssignableFrom(CompositeData.class)) {
            result = (T) getCompositeData();
        } else if (type.isAssignableFrom(ResourceContent.class)) {
            result = (T) getResourceContent();
        }
        return result;
    }

    private CompositeData getCompositeData() {
        CompositeData compositeData;
        try {
            compositeData = new CompositeDataResourceType().getCompositeData(this);
        } catch (OpenDataException ex) {
            throw new IllegalStateException("Cannot construct composite data for: " + this, ex);
        }
        return compositeData;
    }

    /**
     * Get the default content (i.e. from the first content capability)
     */
    private ResourceContent getResourceContent() {

        List<Capability> ccaps = getCapabilities(ContentNamespace.CONTENT_NAMESPACE);
        if (ccaps.isEmpty())
            return null;

        ContentCapability ccap = ccaps.get(0).adapt(ContentCapability.class);
        InputStream contentStream = ccap.getContentStream();
        if (contentStream == null) {
            URL contentURL = ccap.getContentURL();
            if (contentURL != null) {
                try {
                    contentStream = contentURL.openStream();
                } catch (IOException ex) {
                    throw new IllegalStateException("Cannot access content URL: " + contentURL, ex);
                }
            }
        }

        ResourceContent resourceContent = null;
        if (contentStream != null) {
            final InputStream inputStream = contentStream;
            resourceContent = new ResourceContent() {
                @Override
                public InputStream getContent() {
                    return inputStream;
                }
            };
        }

        return resourceContent;
    }

    @Override
    public Capability getIdentityCapability() {
        if (identityCapability == null) {
            List<Capability> icaps = getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
            if (icaps.size() > 1)
                throw new IllegalStateException("Multiple identity capabilities");
            if (icaps.size() < 1)
                throw new IllegalStateException("No identity capability");
            Capability icap = icaps.get(0);
            Object version = icap.getAttribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
            if (!(version instanceof Version)) {
                version = version == null ? Version.emptyVersion : Version.parseVersion(version.toString());
                icap.getAttributes().put(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, version);
            }
            identityCapability = icap;
        }
        return identityCapability;
    }

    @Override
    public ResourceIdentity getIdentity() {
        if (identity == null) {
            Capability icap = getIdentityCapability();
            String symbolicName = (String) icap.getAttribute(IdentityNamespace.IDENTITY_NAMESPACE);
            Version version = (Version) icap.getAttribute(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);
            identity = ResourceIdentity.create(symbolicName, version);
        }
        return identity;
    }

    protected void setMutable(boolean flag) {
        mutable.set(flag);
    }

    protected boolean isMutable() {
        return mutable.get();
    }

    void assertMutable() {
        if (!isMutable())
            throw new IllegalStateException("Invalid access to immutable resource");
    }

    void assertImmutable() {
        if (isMutable())
            throw new IllegalStateException("Invalid access to mutable resource");
    }

    @Override
    public List<Capability> getCapabilities(String namespace) {
        List<Capability> result = new ArrayList<Capability>();
        synchronized (capabilities) {
            for (Capability cap : capabilities) {
                if (namespace == null || namespace.equals(cap.getNamespace())) {
                    result.add(cap);
                }
            }
        }
        return Collections.unmodifiableList(result);
    }

    @Override
    public List<Requirement> getRequirements(String namespace) {
        List<Requirement> result = new ArrayList<Requirement>();
        synchronized (requirements) {
            for (Requirement req : requirements) {
                if (namespace == null || namespace.equals(req.getNamespace())) {
                    result.add(req);
                }
            }
        }
        return Collections.unmodifiableList(result);
    }

    @Override
    public <T> T putAttachment(AttachmentKey<T> key, T value) {
        return getAttachmentsInternal().putAttachment(key, value);
    }

    @Override
    public <T> T getAttachment(AttachmentKey<T> key) {
        return getAttachmentsInternal().getAttachment(key);
    }

    @Override
    public <T> boolean hasAttachment(AttachmentKey<T> key) {
        return getAttachmentsInternal().hasAttachment(key);
    }

    @Override
    public <T> T removeAttachment(AttachmentKey<T> key) {
        return getAttachmentsInternal().getAttachment(key);
    }

    private Attachable getAttachmentsInternal() {
        if (attachments == null) {
            attachments = new AttachableSupport();
        }
        return attachments;
    }

    boolean isValid() {
        try {
            validate();
            return true;
        } catch (RuntimeException rte) {
            return false;
        }
    }

    void validate() {

        // Make sure we have an identity
        getIdentity();

        // Validate the capabilities
        for (Capability cap : getCapabilities(null)) {
            ((AbstractCapability) cap).validate();
        }

        // Validate the requirements
        for (Requirement req : getRequirements(null)) {
            ((AbstractRequirement) req).validate();
        }
    }

    protected String getSimpleTypeName() {
        return getClass().getSimpleName();
    }

    @Override
    public String toString() {
        ResourceIdentity id = identity;
        String idstr = (id != null ? id.getSymbolicName() + ":" + id.getVersion() : "anonymous");
        return getSimpleTypeName() + "[" + idstr + "]";
    }
}


text:
angular.module('AppPrueba')
.service('MostrarService', ['$http','$q', function ($http, $q,InsertarFormularioFincaxF) {

    this.getFincas = function (idUser) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/mostrar.module/mostrar.logic.php?action=getFincasTodo&idUser='+idUser)
            .success(function(response) {
            defered.resolve(response);
        });

        return promise;
    };

    this.getCodigoFincaById = function (gid) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/historicos.module/mostrar.logic.php?action=getCodigoFincaById&gid='+gid)
            .success(function(response) {
                defered.resolve(response);
            });

        return promise;
    };

    this.preview = function (gidFinca) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/historicos.module/historicos.logic.php?action=preview&gidFinca='+gidFinca)
            .success(function(response) {
            defered.resolve(response);
        });

        return promise;
    }

    this.previewValidar = function (gidFinca) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/historicos.module/historicos.logic.php?action=previewValidar&gidFinca='+gidFinca)
            .success(function(response) {
                defered.resolve(response);
            });

        return promise;
    }

    this.getFincasByID = function (idUser, idFinca) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/mostrar.module/mostrar.logic.php?action=getFincasByID&idUser=' + idUser + '&gidFinca=' + idFinca)
            .success(function(response) {
            defered.resolve(response);
        });

        return promise;
    };

    this.getApartoByID = function (idAparto,idFinca) {
        var defered = $q.defer();
        var promise = defered.promise;
        console.log("asdad"+idAparto);
        $http.get('templates/mostrar.module/mostrar.logic.php?action=getApartoByID&gidAparto=' + idAparto+'&gidFinca=' + idFinca)
            .success(function(response) {
            defered.resolve(response);
        });

        return promise;
    };

    this.getGeomHistorico = function (gidFinca,numHistorico) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/historicos.module/historicos.logic.php?action=history&gidFinca='+gidFinca+'&numHistorico='+numHistorico)
            .success(function(response) {
            defered.resolve(response);
        });

        return promise;
    }
    this.getHistAparto = function (gidAparto,anterior,gidFinca) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/historicos.module/historicos.logic.php?action=histAparto&gidAparto='+gidAparto+'&anterior='+anterior+'&gidFinca='+gidFinca)
            .success(function(response) {
            defered.resolve(response);
        });

        return promise;
    }

    this.getFormulariosNoFinca = function (codigofinca,tipo) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/formulario.module/formulario.module.db.php?action=getFormulariosNoFinca&codigofinca='+codigofinca+'&tipo='+tipo)
            .success(function(response) {
                defered.resolve(response);
            });

        return promise;
    }

    this.getFormulariosFinca = function (codigofinca,tipo) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/formulario.module/formulario.module.db.php?action=getFormulariosFinca&codigofinca='+codigofinca+'&tipo='+tipo)
            .success(function(response) {
                defered.resolve(response);
            });

        return promise;
    }

    this.getFormulariosAparto = function (gid) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/formulario.module/formulario.module.db.php?action=getFormulariosAparto&gid='+gid)
            .success(function(response) {
                defered.resolve(response);
            });

        return promise;
    }

    this.insertarFormFinca = function (idform,codigofinca) {
        var defered = $q.defer();
        var promise = defered.promise;

        $http.get('templates/formulario.module/formulario.module.db.php?action=insertarFormFinca&idform=' +idform +'&codigofinca='+codigofinca)
            .success(function(response) {
                defered.resolve(response);
            });

        return promise;
    }

    this.insertarFormAparto = function (idform,gid) {
        var defered = $q.defer();
        var promise = defered.promise;
        console.log("service");
        console.log(idform);
        console.log(gid);

        $http.get('templates/formulario.module/formulario.module.db.php?action=insertarFormAparto&idform=' +idform +'&gid='+gid)
            .success(function(response) {
                defered.resolve(response);
            });

        return promise;
    }

    this.eliminarForm = function (idform,idfincaaparto,tipo) {
        var defered = $q.defer();
        var promise = defered.promise;
        console.log("service");

        $http.get('templates/formulario.module/formulario.module.db.php?action=eliminarForm&idform=' +idform+'&idfincaaparto=' +idfincaaparto+'&tipo='+tipo)
            .success(function(response) {
                defered.resolve(response);
            });

        return promise;
    }

}]);


text:
(function() {
    'use strict';

    angular
        .module('videostoreApp')
        .controller('GatewayController', GatewayController);

    GatewayController.$inject = ['$filter', '$interval', 'GatewayRoutes'];

    function GatewayController ($filter, $interval, GatewayRoutes) {
        var vm = this;

        vm.gatewayRoutes = null;
        vm.refresh = refresh;
        vm.updatingRoutes = null;

        vm.refresh();

        function refresh () {
            vm.updatingRoutes = true;
            GatewayRoutes.query(function(result) {
                vm.gatewayRoutes = result;
                vm.updatingRoutes = false;
            });
        }
    }

})();


text:
int atoi(const char *str);
char* itoa(unsigned int num, char* str, unsigned int base);
char* itoa_signed(int num, char* str, unsigned int base);

void abort(void);

#endif


text:
package edu.kit.iti.ldcrgen.util;

/**
 * Provides different logical operators which are not predefined in Java.
 *
 * @author Roland Kluge
 */
public final class BooleanUtils
{
	private BooleanUtils()
	{
		// utilitiy class -> hidden constructor
	}

	/**
	 * Returns the logic XOR of its arguments.
	 *
	 * @param a
	 *            first value
	 * @param b
	 *            second value
	 * @return a XOR b
	 */
	public static boolean xor(final boolean a, final boolean b)
	{
		return (a || b) && !(a && b);
	}

	/**
	 * Returns the logic implication of its arguments.
	 *
	 * @param a
	 *            first value
	 * @param b
	 *            second value
	 * @return a implies b,i.e., (NOT a) OR b
	 */
	public static boolean implies(final boolean a, final boolean b)
	{
		return (!a) || b;
	}

	/**
	 * Returns the logic equivalence of its arguments.
	 *
	 * @param a
	 *            first value
	 * @param b
	 *            second value
	 * @return a EQUIV b,i.e., (a AND b) OR (NOT a AND NOT b)
	 */
	public static boolean equivalent(final boolean a, final boolean b)
	{
		return a == b;
	}
}


text:
import React from 'react';
import { RaisedButton, Popover, Menu, MenuItem, Divider, FontIcon } from 'material-ui';

export default class HeaderUser extends React.Component {

  constructor(props) {
    super(props);

    this.state = {
      open: false,
    };
  }

  handleTouchTap = (event) => {
    // This prevents ghost click.
    event.preventDefault();

    this.setState({
      open: true,
      anchorEl: event.currentTarget,
    });
  };

  handleRequestClose = () => {
    this.setState({
      open: false,
    });
  };

  render() {
    return (
      <div style={{marginTop: 7}}>
        <RaisedButton
          onTouchTap={this.handleTouchTap}
          label="71,214"
        />
        <Popover
          open={this.state.open}
          anchorEl={this.state.anchorEl}
          anchorOrigin={{horizontal: 'left', vertical: 'bottom'}}
          targetOrigin={{horizontal: 'left', vertical: 'top'}}
          onRequestClose={this.handleRequestClose}
        >
          <Menu>
            <MenuItem primaryText="Profile page" leftIcon={<FontIcon className="material-icons">account_circle</FontIcon>} />
            <MenuItem primaryText="Points History" leftIcon={<FontIcon className="material-icons">whatshot</FontIcon>} />
            <Divider />
            <MenuItem primaryText="Sign out" leftIcon={<FontIcon className="material-icons">exit_to_app</FontIcon>} />
          </Menu>
        </Popover>
      </div>
    );
  }
}


text:
package org.a0z.mpd;

import android.os.Parcel;
import android.os.Parcelable;

public class Genre extends Item implements Parcelable {

	private final String name;
	private final String sort;

	// private final boolean isVa;

	public Genre(String name) {
		this.name = name;
		sort = null;
	}

	protected Genre(Parcel in) {
		this.name = in.readString();
		this.sort = in.readString();
	}

	public String getName() {
		return name;
	}

	public String sort() {
		return null == sort ? name : sort;
	}

	@Override
	public boolean equals(Object o) {
		return (o instanceof Genre) && ((Genre) o).name.equals(name);
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(this.name);
		dest.writeString(this.sort);
	}

	public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
		public Genre createFromParcel(Parcel in) {
			return new Genre(in);
		}

		public Genre[] newArray(int size) {
			return new Genre[size];
		}
	};
}


text:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
    android:key="prefs_addons_screen">

    <!--
    NOTE NOTE!!!!
    There is a copy at app/src/debug/res/xml/prefs_gestures_prefs.xml
    Which includes the gesture-typing pref
    NOTE!!!!!!
    -->
    <Preference android:key="gestures_summary"
        android:summary="@string/swipe_tweak_group" />

    <PreferenceCategory
        android:key="swipe_tweak_group"
        android:title="@string/gesture_settings">

        <!--
        NOTE NOTE!!!!
        There is a copy at app/src/debug/res/xml/prefs_gestures_prefs.xml
        Which includes the gesture-typing pref
        NOTE!!!!!!
        -->
        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_shift"
            android:dialogTitle="@string/swipe_up_action_title"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_swipe_up_action"
            android:summary="@string/swipe_up_action_summary"
            android:title="@string/swipe_up_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_hide"
            android:dialogTitle="@string/swipe_down_action_title"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_swipe_down_action"
            android:summary="@string/swipe_down_action_summary"
            android:title="@string/swipe_down_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_next_symbols"
            android:dialogTitle="@string/swipe_left_action_title"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_swipe_left_action"
            android:summary="@string/swipe_left_action_summary"
            android:title="@string/swipe_left_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_next_alphabet"
            android:dialogTitle="@string/swipe_right_action_title"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_swipe_right_action"
            android:summary="@string/swipe_right_action_summary"
            android:title="@string/swipe_right_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_next_symbols"
            android:dialogTitle="@string/swipe_left_space_bar_action_title"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_swipe_left_space_bar_action"
            android:summary="@string/swipe_left_space_bar_action_summary"
            android:title="@string/swipe_left_space_bar_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_next_alphabet"
            android:dialogTitle="@string/swipe_right_space_bar_action_title"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_swipe_right_space_bar_action"
            android:summary="@string/swipe_right_space_bar_action_summary"
            android:title="@string/swipe_right_space_bar_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_next_symbols"
            android:dialogTitle="@string/swipe_left_two_fingers_action"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_swipe_left_two_fingers_action"
            android:summary="@string/swipe_left_two_fingers_action_summary"
            android:title="@string/swipe_left_two_fingers_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_next_alphabet"
            android:dialogTitle="@string/swipe_right_two_fingers_action_title"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_swipe_right_two_fingers_action"
            android:summary="@string/swipe_right_two_fingers_action_summary"
            android:title="@string/swipe_right_two_fingers_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_utility_keyboard"
            android:dialogTitle="@string/swipe_up_from_spacebar_action_title"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_swipe_up_from_spacebar_action"
            android:summary="@string/swipe_up_from_spacebar_action_summary"
            android:title="@string/swipe_up_from_spacebar_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_merge_layout"
            android:dialogTitle="@string/pinch_gesture_action_title"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_pinch_gesture_action"
            android:summary="@string/pinch_gesture_action_summary"
            android:title="@string/pinch_gesture_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/swipe_action_value_split_layout"
            android:dialogTitle="@string/separate_gesture_action_title"
            android:entries="@array/swipe_action_types_names"
            android:entryValues="@array/swipe_action_types_values"
            android:key="@string/settings_key_separate_gesture_action"
            android:summary="@string/separate_gesture_action_summary"
            android:title="@string/separate_gesture_action"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/settings_default_swipe_velocity_threshold"
            android:dialogTitle="@string/settings_swipe_velocity_threshold_title"
            android:entries="@array/settings_key_swipe_velocity_threshold_names"
            android:entryValues="@array/settings_key_swipe_velocity_threshold_values"
            android:key="@string/settings_key_swipe_velocity_threshold"
            android:summary="@string/settings_swipe_velocity_threshold_summary"
            android:title="@string/settings_swipe_velocity_threshold_title"/>

        <net.evendanan.pushingpixels.ListPreference
            android:defaultValue="@string/settings_default_swipe_distance_threshold"
            android:dialogTitle="@string/settings_swipe_distance_threshold_title"
            android:entries="@array/settings_key_swipe_distance_threshold_names"
            android:entryValues="@array/settings_key_swipe_distance_threshold_values"
            android:key="@string/settings_key_swipe_distance_threshold"
            android:summary="@string/settings_swipe_distance_threshold_summary"
            android:title="@string/settings_swipe_distance_threshold_title"/>
    </PreferenceCategory>

</PreferenceScreen>


text:
railsstatusapp
==============


text:
package gluu.scim2.client.singleresource;

import gluu.scim2.client.UserBaseTest;
import org.gluu.oxtrust.model.scim2.ListResponse;
import org.gluu.oxtrust.model.scim2.user.UserResource;
import org.testng.annotations.Test;

import javax.ws.rs.core.Response;

import java.util.List;
import java.util.stream.Collectors;

import static javax.ws.rs.core.Response.Status.OK;

import static org.testng.Assert.*;

/**
 * NOTES:
 * Check first if /install/community-edition-setup/templates/test/scim-client/data/scim-test-data.ldif has been loaded to LDAP.
 *
 * Created by jgomer on 2017-11-12.
 */
public class QueryParamRetrievalTest extends UserBaseTest {

    private UserResource user;

    @Test
    public void multipleRetrieval(){
        logger.debug("Retrieving test users...");
        String include="displayName, externalId";

        Response response=client.searchUsers("displayName co \"Test\"", null, null, null, null, include, null);
        assertEquals(response.getStatus(), OK.getStatusCode());

        ListResponse listResponse = response.readEntity(ListResponse.class);
        List<UserResource> list=listResponse.getResources().stream().map(usrClass::cast).collect(Collectors.toList());

        //Verify users retrieved contain attributes of interest
        for (UserResource usr : list){
            assertNotNull(usr.getDisplayName());
            assertTrue(usr.getDisplayName().toLowerCase().contains("test"));
            //assertNotNull(usr.getExternalId());
        }

    }

    @Test(dependsOnMethods = "multipleRetrieval")
    public void multipleRetrievalExcluding() {
        logger.debug("Retrieving test users...");
        String exclude="displayName, externalId, name, addresses, emails";

        Response response=client.searchUsers("displayName co \"Test\"", null, null, null, null, null, exclude);
        assertEquals(response.getStatus(), OK.getStatusCode());

        ListResponse listResponse = response.readEntity(ListResponse.class);
        List<UserResource> list=listResponse.getResources().stream().map(UserResource.class::cast).collect(Collectors.toList());

        //Verify users retrieved do not contain attributes of interest
        for (UserResource usr : list) {
            assertNull(usr.getDisplayName());
            assertNull(usr.getExternalId());
            assertNull(usr.getName());
            assertNull(usr.getAddresses());
            assertNull(usr.getEmails());

            assertNotNull(usr.getSchemas());
            assertNotNull(usr.getId());
        }
        user=list.get(0);

    }

    @Test(dependsOnMethods = "multipleRetrievalExcluding")
    public void singleRetrieval(){

        String include="active";
        Response response=client.getUserById(user.getId(), include, null);
        assertEquals(response.getStatus(), OK.getStatusCode());

        user=response.readEntity(usrClass);

        assertNotNull(user.getActive());
        assertNull(user.getExternalId());
        assertNull(user.getName());
        assertNull(user.getAddresses());
        assertNull(user.getEmails());

    }

    @Test(dependsOnMethods = "multipleRetrievalExcluding")
    public void singleRetrievalExcluding() {

        String exclude="id, externalId";
        Response response=client.getUserById(user.getId(), null, exclude);
        assertEquals(response.getStatus(), OK.getStatusCode());

        user=response.readEntity(usrClass);

        assertNotNull(user.getId());    //Always returned
        assertNull(user.getExternalId());

    }

}


text:
package com.feetao.web.model;

import java.io.Serializable;
import java.util.Date;

public class ItemDO implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 * 主键ID
	 */
	private Long id;

	/**
	 * 用户ID
	 */
	private Long userId;

	/**
	 * 分类名称
	 */
	private String itemName;

	/**
	 * 跳转链接
	 */
	private String url;

	/**
	 * 类别图片
	 */
	private String picture;

	/**
	 * 类别描述
	 */
	private String description;

	/**
	 * 状态
	 */
	private Byte status;

	/**
	 * create time
	 */
	private Date gmtCreate;

	/**
	 * modified time
	 */
	private Date gmtModified;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public String getItemName() {
		return itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Byte getStatus() {
		return status;
	}

	public void setStatus(Byte status) {
		this.status = status;
	}

	public Date getGmtCreate() {
		return gmtCreate;
	}

	public void setGmtCreate(Date gmtCreate) {
		this.gmtCreate = gmtCreate;
	}

	public Date getGmtModified() {
		return gmtModified;
	}

	public void setGmtModified(Date gmtModified) {
		this.gmtModified = gmtModified;
	}

}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>souza.claudio</groupId>
    <artifactId>rest</artifactId>
    <packaging>war</packaging>
    <version>1.0</version>
    <name>rest</name>

    <build>
        <finalName>rest</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <inherited>true</inherited>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>souza.claudio.Main</mainClass>
                </configuration>

            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.glassfish.jersey</groupId>
                <artifactId>jersey-bom</artifactId>
                <version>${jersey.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet-core</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>1.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-grizzly2-http</artifactId>
            <version>2.23.2</version>
            <type>jar</type>
        </dependency>
    </dependencies>
    <properties>
        <jersey.version>2.23.2</jersey.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>