text:
using System;
using System.Collections.Generic;
using System.Text;

namespace OpenSource.Data.HashFunction.CRC
{
    /// <summary>
    /// Defines a configuration for a <see cref="ICRC"/> implementation.
    /// </summary>
    public class CRCConfig
        : ICRCConfig
    {
        /// <summary>
        /// Length of the produced CRC value, in bits.
        /// </summary>
        /// <value>
        /// The length of the produced CRC value, in bits
        /// </value>
        public int HashSizeInBits { get; set; }

        /// <summary>
        /// Divisor to use when calculating the CRC.
        /// </summary>
        /// <value>
        /// The divisor that will be used when calculating the CRC value.
        /// </value>
        public UInt64 Polynomial { get; set; }

        /// <summary>
        /// Value to initialize the CRC register to before calculating the CRC.
        /// </summary>
        /// <value>
        /// The value that will be used to initialize the CRC register before the calculation of the CRC value.
        /// </value>
        public UInt64 InitialValue { get; set; }

        /// <summary>
        /// If true, the CRC calculation processes input as big endian bit order.
        /// </summary>
        /// <value>
        /// <c>true</c> if the input should be processed in big endian bit order; otherwise, <c>false</c>.
        /// </value>
        public bool ReflectIn { get; set; }

        /// <summary>
        /// If true, the CRC calculation processes the output as big endian bit order.
        /// </summary>
        /// <value>
        /// <c>true</c> if the CRC calculation processes the output as big endian bit order; otherwise, <c>false</c>.
        /// </value>
        public bool ReflectOut { get; set; }

        /// <summary>
        /// Value to xor with the final CRC value.
        /// </summary>
        /// <value>
        /// The value to xor with the final CRC value.
        /// </value>
        public UInt64 XOrOut { get; set; }

        #region Standards

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC3_ROHC standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC3_ROHC => new CRCConfig() {
            HashSizeInBits = 3,
            Polynomial = 0x3,
            InitialValue = 0x7,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x0,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC4_ITU standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC4_ITU => new CRCConfig() {
            HashSizeInBits = 4,
            Polynomial = 0x3,
            InitialValue = 0x0,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x0,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC5_EPC standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC5_EPC => new CRCConfig() {
            HashSizeInBits = 5,
            Polynomial = 0x09,
            InitialValue = 0x09,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC5_ITU standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC5_ITU => new CRCConfig() {
            HashSizeInBits = 5,
            Polynomial = 0x15,
            InitialValue = 0x00,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC5_USB standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC5_USB => new CRCConfig() {
            HashSizeInBits = 5,
            Polynomial = 0x05,
            InitialValue = 0x1f,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x1f,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC6_CDMA2000A standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC6_CDMA2000A => new CRCConfig() {
            HashSizeInBits = 6,
            Polynomial = 0x27,
            InitialValue = 0x3f,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC6_CDMA2000B standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC6_CDMA2000B => new CRCConfig() {
            HashSizeInBits = 6,
            Polynomial = 0x07,
            InitialValue = 0x3f,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC6_DARC standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC6_DARC => new CRCConfig() {
            HashSizeInBits = 6,
            Polynomial = 0x19,
            InitialValue = 0x00,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC6_ITU standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC6_ITU => new CRCConfig() {
            HashSizeInBits = 6,
            Polynomial = 0x03,
            InitialValue = 0x00,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC7 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC7 => new CRCConfig() {
            HashSizeInBits = 7,
            Polynomial = 0x09,
            InitialValue = 0x00,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC7_ROHC standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC7_ROHC => new CRCConfig() {
            HashSizeInBits = 7,
            Polynomial = 0x4f,
            InitialValue = 0x7f,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC8 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC8 => new CRCConfig() {
            HashSizeInBits = 8,
            Polynomial = 0x07,
            InitialValue = 0x00,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC8_CDMA2000 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC8_CDMA2000 => new CRCConfig() {
            HashSizeInBits = 8,
            Polynomial = 0x9b,
            InitialValue = 0xff,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC8_DARC standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC8_DARC => new CRCConfig() {
            HashSizeInBits = 8,
            Polynomial = 0x39,
            InitialValue = 0x00,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC8_DVBS2 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC8_DVBS2 => new CRCConfig() {
            HashSizeInBits = 8,
            Polynomial = 0xd5,
            InitialValue = 0x00,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC8_EBU standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC8_EBU => new CRCConfig() {
            HashSizeInBits = 8,
            Polynomial = 0x1d,
            InitialValue = 0xff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC8_ICODE standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC8_ICODE => new CRCConfig() {
            HashSizeInBits = 8,
            Polynomial = 0x1d,
            InitialValue = 0xfd,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC8_ITU standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC8_ITU => new CRCConfig() {
            HashSizeInBits = 8,
            Polynomial = 0x07,
            InitialValue = 0x00,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x55,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC8_MAXIM standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC8_MAXIM => new CRCConfig() {
            HashSizeInBits = 8,
            Polynomial = 0x31,
            InitialValue = 0x00,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC8_ROHC standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC8_ROHC => new CRCConfig() {
            HashSizeInBits = 8,
            Polynomial = 0x07,
            InitialValue = 0xff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC8_WCDMA standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC8_WCDMA => new CRCConfig() {
            HashSizeInBits = 8,
            Polynomial = 0x9b,
            InitialValue = 0x00,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x00,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC10 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC10 => new CRCConfig() {
            HashSizeInBits = 10,
            Polynomial = 0x233,
            InitialValue = 0x000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC10_CDMA2000 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC10_CDMA2000 => new CRCConfig() {
            HashSizeInBits = 10,
            Polynomial = 0x3d9,
            InitialValue = 0x3ff,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC11 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC11 => new CRCConfig() {
            HashSizeInBits = 11,
            Polynomial = 0x385,
            InitialValue = 0x01a,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC12_3GPP standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC12_3GPP => new CRCConfig() {
            HashSizeInBits = 12,
            Polynomial = 0x80f,
            InitialValue = 0x000,
            ReflectIn = false,
            ReflectOut = true,
            XOrOut = 0x000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC12_CDMA2000 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC12_CDMA2000 => new CRCConfig() {
            HashSizeInBits = 12,
            Polynomial = 0xf13,
            InitialValue = 0xfff,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC12_DECT standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC12_DECT => new CRCConfig() {
            HashSizeInBits = 12,
            Polynomial = 0x80f,
            InitialValue = 0x000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC13_BBC standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC13_BBC => new CRCConfig() {
            HashSizeInBits = 13,
            Polynomial = 0x1cf5,
            InitialValue = 0x0000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC14_DARC standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC14_DARC => new CRCConfig() {
            HashSizeInBits = 14,
            Polynomial = 0x0805,
            InitialValue = 0x0000,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC15 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC15 => new CRCConfig() {
            HashSizeInBits = 15,
            Polynomial = 0x4599,
            InitialValue = 0x0000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC15_MPT1327 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC15_MPT1327 => new CRCConfig() {
            HashSizeInBits = 15,
            Polynomial = 0x6815,
            InitialValue = 0x0000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0001,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the ARC standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig ARC => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x8005,
            InitialValue = 0x0000,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_AUGCCITT standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_AUGCCITT => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x1021,
            InitialValue = 0x1d0f,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_BUYPASS standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_BUYPASS => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x8005,
            InitialValue = 0x0000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_CCITTFALSE standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_CCITTFALSE => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x1021,
            InitialValue = 0xffff,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_CDMA2000 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_CDMA2000 => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0xc867,
            InitialValue = 0xffff,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_DDS110 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_DDS110 => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x8005,
            InitialValue = 0x800d,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_DECTR standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_DECTR => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x0589,
            InitialValue = 0x0000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0001,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_DECTX standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_DECTX => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x0589,
            InitialValue = 0x0000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_DNP standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_DNP => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x3d65,
            InitialValue = 0x0000,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0xffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_EN13757 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_EN13757 => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x3d65,
            InitialValue = 0x0000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0xffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_GENIBUS standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_GENIBUS => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x1021,
            InitialValue = 0xffff,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0xffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_MAXIM standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_MAXIM => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x8005,
            InitialValue = 0x0000,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0xffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_MCRF4XX standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_MCRF4XX => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x1021,
            InitialValue = 0xffff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_RIELLO standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_RIELLO => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x1021,
            InitialValue = 0xb2aa,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_T10DIF standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_T10DIF => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x8bb7,
            InitialValue = 0x0000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_TELEDISK standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_TELEDISK => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0xa097,
            InitialValue = 0x0000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_TMS37157 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_TMS37157 => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x1021,
            InitialValue = 0x89ec,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC16_USB standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC16_USB => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x8005,
            InitialValue = 0xffff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0xffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRCA standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRCA => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x1021,
            InitialValue = 0xc6c6,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the KERMIT standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig KERMIT => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x1021,
            InitialValue = 0x0000,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the MODBUS standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig MODBUS => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x8005,
            InitialValue = 0xffff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the X25 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig X25 => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x1021,
            InitialValue = 0xffff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0xffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the XMODEM standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig XMODEM => new CRCConfig() {
            HashSizeInBits = 16,
            Polynomial = 0x1021,
            InitialValue = 0x0000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC24 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC24 => new CRCConfig() {
            HashSizeInBits = 24,
            Polynomial = 0x864cfb,
            InitialValue = 0xb704ce,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x000000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC24_FLEXRAYA standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC24_FLEXRAYA => new CRCConfig() {
            HashSizeInBits = 24,
            Polynomial = 0x5d6dcb,
            InitialValue = 0xfedcba,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x000000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC24_FLEXRAYB standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC24_FLEXRAYB => new CRCConfig() {
            HashSizeInBits = 24,
            Polynomial = 0x5d6dcb,
            InitialValue = 0xabcdef,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x000000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC31_PHILIPS standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC31_PHILIPS => new CRCConfig() {
            HashSizeInBits = 31,
            Polynomial = 0x04c11db7,
            InitialValue = 0x7fffffff,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x7fffffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC32 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC32 => new CRCConfig() {
            HashSizeInBits = 32,
            Polynomial = 0x04c11db7,
            InitialValue = 0xffffffff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0xffffffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC32_BZIP2 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC32_BZIP2 => new CRCConfig() {
            HashSizeInBits = 32,
            Polynomial = 0x04c11db7,
            InitialValue = 0xffffffff,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0xffffffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC32C standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC32C => new CRCConfig() {
            HashSizeInBits = 32,
            Polynomial = 0x1edc6f41,
            InitialValue = 0xffffffff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0xffffffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC32D standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC32D => new CRCConfig() {
            HashSizeInBits = 32,
            Polynomial = 0xa833982b,
            InitialValue = 0xffffffff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0xffffffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC32_MPEG2 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC32_MPEG2 => new CRCConfig() {
            HashSizeInBits = 32,
            Polynomial = 0x04c11db7,
            InitialValue = 0xffffffff,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00000000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC32_POSIX standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC32_POSIX => new CRCConfig() {
            HashSizeInBits = 32,
            Polynomial = 0x04c11db7,
            InitialValue = 0x00000000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0xffffffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC32Q standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC32Q => new CRCConfig() {
            HashSizeInBits = 32,
            Polynomial = 0x814141ab,
            InitialValue = 0x00000000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00000000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the JAMCRC standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig JAMCRC => new CRCConfig() {
            HashSizeInBits = 32,
            Polynomial = 0x04c11db7,
            InitialValue = 0xffffffff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0x00000000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the XFER standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig XFER => new CRCConfig() {
            HashSizeInBits = 32,
            Polynomial = 0x000000af,
            InitialValue = 0x00000000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x00000000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC40_GSM standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC40_GSM => new CRCConfig() {
            HashSizeInBits = 40,
            Polynomial = 0x0004820009,
            InitialValue = 0x0000000000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0xffffffffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC64 standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC64 => new CRCConfig() {
            HashSizeInBits = 64,
            Polynomial = 0x42f0e1eba9ea3693,
            InitialValue = 0x0000000000000000,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0x0000000000000000,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC64_WE standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC64_WE => new CRCConfig() {
            HashSizeInBits = 64,
            Polynomial = 0x42f0e1eba9ea3693,
            InitialValue = 0xffffffffffffffff,
            ReflectIn = false,
            ReflectOut = false,
            XOrOut = 0xffffffffffffffff,
        };

        /// <summary>
        /// Creates an instance of <see cref="ICRCConfig"/> configured to the CRC64_XZ standard.
        ///
        /// Parameters for this standard was provided by http://reveng.sourceforge.net/crc-catalogue/.
        /// </summary>
        /// <value>
        /// A new, configured instance of <see cref="ICRCConfig"/>.
        /// </value>
        public static ICRCConfig CRC64_XZ => new CRCConfig() {
            HashSizeInBits = 64,
            Polynomial = 0x42f0e1eba9ea3693,
            InitialValue = 0xffffffffffffffff,
            ReflectIn = true,
            ReflectOut = true,
            XOrOut = 0xffffffffffffffff,
        };

        #endregion

        /// <summary>
        /// Makes a deep clone of current instance.
        /// </summary>
        /// <returns>A deep clone of the current instance.</returns>
        public ICRCConfig Clone() =>
            new CRCConfig() {
                HashSizeInBits = HashSizeInBits,
                Polynomial = Polynomial,
                InitialValue = InitialValue,
                ReflectIn = ReflectIn,
                ReflectOut = ReflectOut,
                XOrOut = XOrOut
            };
    }
}


text:
using NMock2;

namespace NMocha.Internal {
    public class ChangeStateEffect : ISideEffect {
        private readonly State state;

        public ChangeStateEffect(State state) {
            this.state = state;
        }

        #region ISideEffect Members

        public void DescribeOn(IDescription description) {
            description.AppendText("\nthen ");
            state.DescribeOn(description);
            description.AppendText(";");
        }

        public void Apply() {
            state.Activate();
        }

        #endregion
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.IO;

namespace PS
{
    public class LanguageHelper
    {
        string _Language = "chs",_sPath="";
        DataTable _langTable = null;
        bool _bChanged = false;
        public LanguageHelper()
        {
            _langTable = new DataTable();
            _sPath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory);
            _sPath = Path.Combine(Path.Combine(_sPath, "config"), "Language.xml");
            if (File.Exists(_sPath))
                _langTable.ReadXml(_sPath);
            else
            {
                _langTable.TableName = "Language";
                DataColumn col = _langTable.Columns.Add("stringName", typeof(System.String));
                col.Unique = true;
                _langTable.Columns.Add("engText", typeof(System.String));
                _langTable.Columns.Add("chsText", typeof(System.String));
                _bChanged = true;
            }
        }
        ~LanguageHelper()
        {
            if(_bChanged && _langTable!=null)
                _langTable.WriteXml(_sPath, XmlWriteMode.WriteSchema);
        }
        public string Language
        {
            get
            {
                return _Language;
            }
            set
            {
                bool bNewLang = true;
                 string sFld =value+"Text";
                foreach(DataColumn col in _langTable.Columns)
                {
                    if(string.Compare(col.ColumnName,sFld,StringComparison.OrdinalIgnoreCase)==0)
                    {
                        bNewLang = false;
                        break;
                    }
                }
                if(bNewLang)
                {
                    _bChanged = true;
                    _langTable.Columns.Add(sFld, typeof(System.String));
                    foreach (DataRow row in _langTable.Rows)
                        row[sFld] = row["engText"];
                }
                _Language = value;
            }
        }
        public string GetText(string StringID)
        {
            string sText = null;
            string sFld = _Language + "Text";
            if (!_langTable.Columns.Contains(sFld))
                throw new FieldAccessException("Can found field " + sFld + "!");

            DataRow[] sel = _langTable.Select("stringName='" + StringID.Replace("'","''") + "'");
            if (sel != null && sel.Length > 0)
                sText = sel[0][sFld] as string;

            if (sText == null)
            {
                //如果没有找到记录,添加新记录
                lock (_langTable)
                {
                    _langTable.Rows.Add(new object[] { StringID, StringID, StringID });
                    _langTable.WriteXml(_sPath, XmlWriteMode.WriteSchema);
                }
                sText = StringID;
            }

            return sText;
        }
        public Dictionary<string, string> GetLanguageList()
        {
            Dictionary<string, string> lst = new Dictionary<string, string>();
            foreach (DataColumn col in _langTable.Columns)
            {
                string ss=col.ColumnName;
                if (string.Compare(ss, "stringName", StringComparison.OrdinalIgnoreCase) != 0)
                {
                    if (string.Compare(ss.Substring(ss.Length - 4), "Text", StringComparison.OrdinalIgnoreCase) == 0)
                        ss = ss.Substring(0, ss.Length - 4);
                    lst.Add(ss, this.GetText(ss));
                }
            }

            return lst;
        }
    }
}


text:
  # this script should be dot-sourced into the build.ps1 scripts
  # right after the parameters declaration
  # ie
  # . "$PSScriptRoot\build-bootstrap.ps1"

  # THIS FILE IS DISTRIBUTED AS PART OF UMBRACO.BUILD
  # DO NOT MODIFY IT - ALWAYS USED THE COMMON VERSION

  # ################################################################
  # BOOTSTRAP
  # ################################################################

  # reset errors
  $error.Clear()

  # ensure we have temp folder for downloads
  $scriptRoot = "$PSScriptRoot"
  $scriptTemp = "$scriptRoot\temp"
  if (-not (test-path $scriptTemp)) { mkdir $scriptTemp > $null }

  # get NuGet
  $cache = 4
  $nuget = "$scriptTemp\nuget.exe"
  if (-not $local)
  {
    $source = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
    if ((test-path $nuget) -and ((ls $nuget).CreationTime -lt [DateTime]::Now.AddDays(-$cache)))
    {
      Remove-Item $nuget -force -errorAction SilentlyContinue > $null
    }
    if (-not (test-path $nuget))
    {
      Write-Host "Download NuGet..."
      Invoke-WebRequest $source -OutFile $nuget
      if (-not $?) { throw "Failed to download NuGet." }
    }
  }
  elseif (-not (test-path $nuget))
  {
    throw "Failed to locate NuGet.exe."
  }

  # NuGet notes
  # As soon as we use -ConfigFile, NuGet uses that file, and only that file, and does not
  # merge configuration from system level. See comments in NuGet.Client solution, class
  # NuGet.Configuration.Settings, method LoadDefaultSettings.
  # For NuGet to merge configurations, it needs to "find" the file in the current directory,
  # or above. Which means we cannot really use -ConfigFile but instead have to have Umbraco's
  # NuGet.config file at root, and always run NuGet.exe while at root or in a directory below
  # root.

  $solutionRoot = "$scriptRoot\.."
  $testPwd = [System.IO.Path]::GetFullPath($pwd.Path) + "\"
  $testRoot = [System.IO.Path]::GetFullPath($solutionRoot) + "\"
  if (-not $testPwd.ToLower().StartsWith($testRoot.ToLower()))
  {
      throw "Cannot run outside of the solution's root."
  }

  # get the build system
  if (-not $local)
  {
    $params = "-OutputDirectory", $scriptTemp, "-Verbosity", "quiet", "-PreRelease"
    &$nuget install Umbraco.Build @params
    if (-not $?) { throw "Failed to download Umbraco.Build." }
  }

  # ensure we have the build system
  $ubuildPath = ls "$scriptTemp\Umbraco.Build.*" | sort -property CreationTime -descending | select -first 1
  if (-not $ubuildPath)
  {
    throw "Failed to locate the build system."
  }

  # boot the build system
  # this creates $global:ubuild
  return &"$ubuildPath\ps\Boot.ps1"

  # at that point the build.ps1 script must boot the build system
  # eg
  # $ubuild.Boot($ubuildPath.FullName, [System.IO.Path]::GetFullPath("$scriptRoot\.."),
  #   @{ Local = $local; With7Zip = $false; WithNode = $false },
  #   @{ continue = $continue })
  # if (-not $?) { throw "Failed to boot the build system." }
  #
  # and it's good practice to report
  # eg
  # Write-Host "Umbraco.Whatever Build"
  # Write-Host "Umbraco.Build v$($ubuild.BuildVersion)"

  # eof


text:
package com.twelvemonkeys.imageio.color;

import com.twelvemonkeys.lang.SystemUtil;

import java.awt.color.ICC_Profile;

/**
 * ICCProfileSanitizer.
 *
 * @author Harald Kuhr
 * @author last modified by $Author: harald.kuhr$
 * @version $Id: ProfileCleaner.java,v 1.0 06/01/15 harald.kuhr Exp$
 */
interface ICCProfileSanitizer {
    void fixProfile(ICC_Profile profile);

    boolean validationAltersProfileHeader();

    class Factory {
        static ICCProfileSanitizer get() {
            // Strategy pattern:
            //  - KCMSSanitizerStrategy - Current behaviour, default for Java 1.6 and Oracle JRE 1.7
            //  - LCMSSanitizerStrategy - New behaviour, default for OpenJDK 1.7 and all java 1.8
            //              (unless KCMS switch -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider present)
            // TODO: Allow user-specific strategy selection, should heuristics not work..?
            // -Dcom.twelvemonkeys.imageio.color.ICCProfileSanitizer=com.foo.bar.FooCMSSanitizer

            // TODO: Support for explicit Java 7 settings: sun.java2d.cmm.kcms.CMM
            // (the CMSManager was changed from using direct class to ServiceProvider in Java 8,
            // so the class names/interfaces are different).

            // Here's the evolution of Java Color Management:

            // Java 6:
            // sun.awt.color.CMM (as the one and only)

            // Java 7:
            // sun.java2d.cmm.CMSManager (using default sun.java2d.cmm=sun.java2d.cmm.kcms.CMM)
            // sun.java2d.cmm.PCMM
            // sun.java2d.cmm.kcms.CMM implements PCMM (similar to Java 6 CMM)
            // sun.java2d.cmm.lcms.LCMS implements PCMM

            // Java 8:
            // sun.java2d.cmm.CMSManager (using default sun.java2d.cmm=sun.java2d.cmm.lcms.LcmsServiceProvider)
            // sun.java2d.cmm.CMMServiceProvider (getModule() method, that returns PCMM)
            // sun.java2d.cmm.PCMM
            // sun.java2d.cmm.kcms.KcmsServiceProvider
            // sun.java2d.cmm.kcms.CMM implements PCMM (similar to Java 6 CMM)
            // sun.java2d.cmm.lcms.LcmsServiceProvider
            // sun.java2d.cmm.lcms.LCMS implements PCMM

            // TODO: Consider a different option, invoking CMSManager.getModule() through reflection to get actual used instance
            // Default to using a NullSanitizerStrategy on non-Sun/Oracle systems?

            ICCProfileSanitizer instance;

            // Explicit System properties
            String cmmProperty = System.getProperty("sun.java2d.cmm");
            if ("sun.java2d.cmm.kcms.KcmsServiceProvider".equals(cmmProperty) && SystemUtil.isClassAvailable("sun.java2d.cmm.kcms.CMM")) {
                instance = new KCMSSanitizerStrategy();
            }
            else if ("sun.java2d.cmm.lcms.LcmsServiceProvider".equals(cmmProperty) && SystemUtil.isClassAvailable("sun.java2d.cmm.lcms.LCMS")) {
                instance = new LCMSSanitizerStrategy();
            }
            // Default for Java 1.8+ or OpenJDK 1.7+ (no KCMS available)
            else if (SystemUtil.isClassAvailable("java.util.stream.Stream")
                    || SystemUtil.isClassAvailable("java.lang.invoke.CallSite") && !SystemUtil.isClassAvailable("sun.java2d.cmm.kcms.CMM")) {
                instance = new LCMSSanitizerStrategy();
            }
            // Default for all Java versions <= 1.7
            else {
                instance = new KCMSSanitizerStrategy();
            }

            if (ColorSpaces.DEBUG) {
                System.out.println("ICC ProfileCleaner instance: " + instance.getClass().getName());
            }

            return instance;
        }
    }
}


text:
package org.thymeleaf.util;

import java.util.Collection;

/**
 *
 * @author Daniel Fernández
 *
 * @since 1.0
 *
 */
public final class Validate {

    public static void notNull(final Object object, final String message) {
        if (object == null) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void notEmpty(final String object, final String message) {
        if (StringUtils.isEmptyOrWhitespace(object)) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void notEmpty(final Collection<?> object, final String message) {
        if (object == null || object.size() == 0) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void notEmpty(final Object[] object, final String message) {
        if (object == null || object.length == 0) {
            throw new IllegalArgumentException(message);
        }
    }

    public static void containsNoNulls(final Iterable<?> collection, final String message) {
        for (final Object object : collection) {
            notNull(object, message);
        }
    }

    public static void containsNoEmpties(final Iterable<String> collection, final String message) {
        for (final String object : collection) {
            notEmpty(object, message);
        }
    }

    public static void containsNoNulls(final Object[] array, final String message) {
        for (final Object object : array) {
            notNull(object, message);
        }
    }

    public static void isTrue(final boolean condition, final String message) {
        if (!condition) {
            throw new IllegalArgumentException(message);
        }
    }

    private Validate() {
        super();

    }
}


text:
package competition.entities;

public class Street {
    int startIntersection;
    int endIntersection;
    String name;
    int timeToCross;
    int numCars;

    public Street(final int startIntersection,
                  final int endIntersection,
                  final String name,
                  final int timeToCross) {

        this.startIntersection = startIntersection;
        this.endIntersection = endIntersection;
        this.name = name;
        this.timeToCross = timeToCross;
    }

    public int getStartIntersection() {

        return startIntersection;
    }

    public void setStartIntersection(final int startIntersection) {

        this.startIntersection = startIntersection;
    }

    public int getEndIntersection() {

        return endIntersection;
    }

    public void setEndIntersection(final int endIntersection) {

        this.endIntersection = endIntersection;
    }

    public String getName() {

        return name;
    }

    public void setName(final String name) {

        this.name = name;
    }

    public int getTimeToCross() {

        return timeToCross;
    }

    public void setTimeToCross(final int timeToCross) {

        this.timeToCross = timeToCross;
    }

    public int getNumCars() {

        return numCars;
    }

    public void setNumCars(final int numCars) {

        this.numCars = numCars;
    }

    public void incrementNumCars() {
        this.numCars++;
    }
}