Exemplo n.º 1
0
        public void TestTeenager(int input, bool expectedResult)
        {
            ArrayFunctions af           = new ArrayFunctions();
            bool           actualResult = af.IsTeenager(input);

            Assert.Equal(expectedResult, actualResult);
        }
Exemplo n.º 2
0
        /// <summary>Processes raw data to populate the resource</summary>
        /// <param name="raw">Raw byte data</param>
        /// <param name="containsHeader">Whether or not <i>raw</i> contains the resource Header information</param>
        /// <exception cref="ArgumentException">Header-defined <see cref="Type"/> is not <see cref="Resource.ResourceType.Film"/></exception>
        public override void DecodeResource(byte[] raw, bool containsHeader)
        {
            //System.Diagnostics.Debug.WriteLine("Decode FILM");
            _decodeResource(raw, containsHeader);
            if (_type != ResourceType.Film)
            {
                throw new ArgumentException("Raw header is not for a Film resource");
            }
            _numberOfFrames = BitConverter.ToInt16(_rawData, 2);
            _blocks         = new Block[BitConverter.ToInt16(_rawData, 4) + 1];
            int offset = 6;

            for (int i = 0; i < _blocks.Length; i++)
            {
                //System.Diagnostics.Debug.WriteLine("Block " + (i + 1) + " of " + _blocks.Length);
                Block.BlockType type = (Block.BlockType)BitConverter.ToInt32(_rawData, offset + TypeOffset);
                string          name = ArrayFunctions.ReadStringFromArray(_rawData, offset + NameOffset, 8);
                int             len  = BitConverter.ToInt32(_rawData, offset + LengthOffset);
                //System.Diagnostics.Debug.WriteLine(type + name + ", " + len);
                short[] block = new short[(len - 0x12) / 2];
                //System.Diagnostics.Debug.WriteLine("block len: " + block.Length);
                //System.Diagnostics.Debug.WriteLine("copying raw...");
                ArrayFunctions.TrimArray(_rawData, offset + 0x12, block);
                //for (int i = 0; i < block.Length; i++) block[i] = BitConverter.ToInt16(_rawData, offset + HeaderLength + 2 + i * 2);
                //System.Diagnostics.Debug.WriteLine("copied, creating block...");
                _blocks[i] = new Block(type, name, block);
                offset    += len;
            }
        }
Exemplo n.º 3
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            double[] a = null;

            if (!string.IsNullOrWhiteSpace(tbA.Text))
            {
                a = MatlabCompat.CreateArray(tbA.Text);
            }
            double[] b = null;
            if (!string.IsNullOrWhiteSpace(TbB.Text))
            {
                b = MatlabCompat.CreateArray(TbB.Text);
            }

            if (b.Length < a.Length && b.Length == 1)
            {
                double holder = b[0];
                b = new double[a.Length];
                for (int index = 0; index < b.Length; index++)
                {
                    b[index] = holder;
                }
            }


            if (!(a == null || b == null))
            {
                double[] m = null; double[] v = null;

                GplBetastat.betastat(a, b, out m, out v);

                tbM.Text = ArrayFunctions.JoinDoublesToDelimitedString(m);
                tbV.Text = ArrayFunctions.JoinDoublesToDelimitedString(v);
            }
        }
Exemplo n.º 4
0
 /// <summary>Initializes a new Trigger from raw data</summary>
 /// <remarks>If <paramref name="raw"/>.Length is 6 or greater, reads six bytes. If the length is 4 or 5, reads only four bytes</remarks>
 /// <param name="raw">Raw data, minimum Length of 4</param>
 /// <param name="startIndex">Offset within <paramref name="raw"/> to begin reading</param>
 /// <exception cref="ArgumentException">Invalid <paramref name="raw"/> Length</exception>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="startIndex"/> results in reading outside the bounds of <paramref name="raw"/></exception>
 public Trigger(byte[] raw, int startIndex)
 {
     if (raw.Length < 4)
     {
         throw new ArgumentException("Minimum length of raw is 4", "raw");
     }
     _items = new byte[6];
     if (raw.Length >= 6)
     {
         if (raw.Length - startIndex < 6 || startIndex < 0)
         {
             throw new ArgumentOutOfRangeException("For provided value of raw, startIndex must be 0-" + (raw.Length - 6));
         }
         ArrayFunctions.TrimArray(raw, startIndex, _items);
     }
     else
     {
         if (raw.Length - startIndex < 4 || startIndex < 0)
         {
             throw new ArgumentOutOfRangeException("For provided value of raw, startIndex must be 0-" + (raw.Length - 4));
         }
         for (int i = 0; i < 4; i++)
         {
             _items[i] = raw[startIndex + i];
         }
     }
 }
Exemplo n.º 5
0
 /// <summary>Initlialize a new Order from raw data</summary>
 /// <remarks><see cref="SkipTriggers"/> sets to <b>"never (FALSE)"</b><br/>
 /// If <i>raw</i>.Length is 19 or greater, reads 19 bytes. Otherwise reads 18 bytes.</remarks>
 /// <param name="raw">Raw byte data, minimum Length of 18</param>
 /// <param name="startIndex">Offset within <i>raw</i> to begin reading</param>
 /// <exception cref="ArgumentException">Invalid <i>raw</i>.Length value</exception>
 /// <exception cref="ArgumentOutOfRangeException"><i>startIndex</i> results in reading outside the bounds of <i>raw</i></exception>
 public Order(byte[] raw, int startIndex)
 {
     if (raw.Length < 18)
     {
         throw new ArgumentException("Minimum length of raw is 18", "raw");
     }
     _items = new byte[19];
     if (raw.Length >= 19)
     {
         if (raw.Length - startIndex < 19 || startIndex < 0)
         {
             throw new ArgumentOutOfRangeException("For provided value of raw, startIndex must be 0-" + (raw.Length - 19));
         }
         ArrayFunctions.TrimArray(raw, startIndex, _items);
     }
     else
     {
         if (startIndex != 0)
         {
             throw new ArgumentOutOfRangeException("For provided value of raw, startIndex must be 0");
         }
         ArrayFunctions.WriteToArray(raw, _items, 0);
     }
     initialize();
 }
Exemplo n.º 6
0
            public void TestContains()
            {
                var mixed = new object[] { "hi", 1, TestEnum.First };

                Assert.True(ArrayFunctions.Contains(mixed, "hi"));
                Assert.True(ArrayFunctions.Contains(mixed, 1));
                Assert.True(ArrayFunctions.Contains(mixed, TestEnum.First));
                Assert.True(ArrayFunctions.Contains(mixed, "First"));
                Assert.True(ArrayFunctions.Contains(mixed, 100));
                TestParser.AssertTemplate("true", "{{ value | array.contains 'First' }}", model: new ObjectModel {
                    Value = mixed
                });
                TestParser.AssertTemplate("true", "{{ value | array.contains 100 }}", model: new ObjectModel {
                    Value = mixed
                });
                TestParser.AssertTemplate("false", "{{ value | array.contains 'Second' }}", model: new ObjectModel {
                    Value = mixed
                });
                TestParser.AssertTemplate("false", "{{ value | array.contains 101 }}", model: new ObjectModel {
                    Value = mixed
                });
                TestParser.AssertTemplate("false", "{{ value | array.contains 'Third' }}", model: new ObjectModel {
                    Value = mixed
                });
            }
Exemplo n.º 7
0
 /// <summary>Prepares the resource for writing and updates <see cref="Resource.RawData"/></summary>
 public override void EncodeResource()
 {
     System.Diagnostics.Debug.WriteLine("bit width: " + _bitsPerScanLine + ", height: " + _height + "num glyphs: " + _glyphs.Length);
     byte[] raw = new byte[12 + (_bitsPerScanLine / 8 * _height + 1) * _glyphs.Length];
     ArrayFunctions.WriteToArray(_startingChar, raw, 0);
     ArrayFunctions.WriteToArray((short)_glyphs.Length, raw, 2);
     ArrayFunctions.WriteToArray(_bitsPerScanLine, raw, 4);
     ArrayFunctions.WriteToArray(_height, raw, 6);
     ArrayFunctions.WriteToArray(BaseLine, raw, 8);
     for (int i = 0; i < _glyphs.Length; i++)
     {
         raw[12 + i] = (byte)_glyphs[i].Width;
     }
     for (int i = 0, offset = 12 + _glyphs.Length; i < _glyphs.Length; i++)
     {
         BitmapData bd1  = GraphicsFunctions.GetBitmapData(_glyphs[i]);
         byte[]     pix1 = new byte[bd1.Stride * bd1.Height];
         GraphicsFunctions.CopyImageToBytes(bd1, pix1);
         // BitmapData.Stride rounds up to 4, so we have to trim off the excess bytes
         byte[] trimmed = new byte[_height * _bitsPerScanLine / 8];
         for (int y = 0; y < _height; y++)
         {
             for (int x = 0; x < (_bitsPerScanLine / 8); x++)
             {
                 trimmed[x + y * (_bitsPerScanLine / 8)] = pix1[x + y * bd1.Stride];
             }
         }
         System.Diagnostics.Debug.WriteLine("pix1.Length: " + pix1.Length + ", trimmed.Length: " + trimmed.Length + ", offset: " + offset);
         ArrayFunctions.WriteToArray(trimmed, raw, ref offset);
         _glyphs[i].UnlockBits(bd1);
     }
     _rawData = raw;
 }
Exemplo n.º 8
0
 internal Base64Encoding(char[] alphabet, char padding, string encodingName, bool verify)
 {
     if (verify)
     {
         if (alphabet == null)
         {
             throw new ArgumentNullException("alphabet", "alphabet is null");
         }
         if (encodingName == null)
         {
             throw new ArgumentNullException("encodingName", "encodingName is null");
         }
         if (alphabet.Length != 64)
         {
             throw new ArgumentOutOfRangeException("alphabet", "size of alphabet is not 64");
         }
         if (ArrayFunctions.IsArrayDuplicate(alphabet))
         {
             throw new ArgumentException("alphabet", "alphabet contains duplicated items");
         }
         if (ArrayFunctions.IsArrayContains(alphabet, padding))
         {
             throw new ArgumentException("padding", "padding already existed in alphabet");
         }
     }
     this.alphabet     = (char[])alphabet.Clone();
     this.padding      = padding;
     this.encodingName = encodingName;
     this.InitAlgorithm(this.alphabet, this.padding);
 }
Exemplo n.º 9
0
        public void WriteActiveReference(string reference)
        {
            var data     = ModbusTcpHelper.AsciiStringToByteArray(reference);
            var dataWord = ModbusTcpHelper.ByteArrayToWordArray(data);

            ArrayFunctions.InsertArray(_memory, dataWord, ActiveReferenceStartAddress);
        }
Exemplo n.º 10
0
        public void TC(int[] input, bool expectedResult)
        {
            ArrayFunctions af           = new ArrayFunctions();
            bool           actualResult = af.IsUnique(input);

            Assert.Equal(expectedResult, actualResult);
        }
Exemplo n.º 11
0
        public void TestMethod4()
        {
            ArrayFunctions af = new ArrayFunctions();

            int[] a = { 1, 2, 1 };
            Assert.IsFalse(af.IsUnique(a));
        }
Exemplo n.º 12
0
 /// <summary>Processes raw data to populate the resource</summary>
 /// <param name="raw">Raw byte data</param>
 /// <param name="containsHeader">Whether or not <i>raw</i> contains the resource Header information</param>
 /// <exception cref="ArgumentException">Header-defined <see cref="Type"/> from the LFD is not <see cref="Resource.ResourceType.Panl"/></exception>
 /// <remarks>If resource was created from a *.PNL file, <i>containsHeader</i> is ignored.</remarks>
 public override void DecodeResource(byte[] raw, bool containsHeader)
 {
     if (!_isPnl)
     {
         _decodeResource(raw, containsHeader);
         if (_type != ResourceType.Panl)
         {
             throw new ArgumentException("Raw header is not for a Panl resource");
         }
         _images = new Bitmap[1];
         decodeImage(_rawData, 0);
     }
     else
     {
         _rawData = raw;
         int count = 0, offset, pos = 0;
         for (offset = 0; offset < _rawData.Length;)
         {
             if (_rawData[offset++] == 0xFF)
             {
                 count++;
             }
         }
         _images = new Bitmap[count];
         offset  = 0;
         for (int i = 0; i < count; i++)
         {
             byte[] remainder = new byte[_rawData.Length - offset];
             ArrayFunctions.TrimArray(_rawData, offset, remainder);
             panlInfo pi = decodeImage(remainder, i);
             pos   += pi.RawLength;
             offset = pos;
         }
     }
 }
Exemplo n.º 13
0
 internal Base16Encoding(char[] alphabet, string encodingName, bool verify)
 {
     if (verify)
     {
         if (alphabet == null)
         {
             throw new ArgumentNullException("alphabet", "alphabet is null");
         }
         if (encodingName == null)
         {
             throw new ArgumentNullException("encodingName", "encodingName is null");
         }
         if (alphabet.Length != 16)
         {
             throw new ArgumentOutOfRangeException("alphabet", "size of alphabet is not 16");
         }
         if (ArrayFunctions.IsArrayDuplicate(alphabet))
         {
             throw new ArgumentException("alphabet", "alphabet contains duplicated items");
         }
     }
     this.alphabet     = (char[])alphabet.Clone();
     this.encodingName = encodingName;
     this.InitAlgorithm(this.alphabet);
 }
Exemplo n.º 14
0
        /// <summary>Prepares the resource for writing and updates <see cref="Resource.RawData"/></summary>
        public override void EncodeResource()
        {
            int length = 4;

            for (int b = 0; b < NumberOfBlocks; b++)
            {
                length += _blocks[b].Length;
            }
            byte[] raw      = new byte[length];
            int    position = 0;

            ArrayFunctions.WriteToArray(NumberOfFrames, raw, ref position);
            ArrayFunctions.WriteToArray(NumberOfBlocks, raw, ref position);
            foreach (Block b in Blocks)
            {
                ArrayFunctions.WriteToArray((int)b.Type, raw, ref position);
                ArrayFunctions.WriteToArray(b.Name, raw, position);
                position += 8;
                ArrayFunctions.WriteToArray(b.Length, raw, ref position);
                ArrayFunctions.WriteToArray(b.TypeNum, raw, ref position);
                ArrayFunctions.WriteToArray(b.NumberOfChunks, raw, ref position);
                ArrayFunctions.WriteToArray((short)(b.Length - 22), raw, ref position);
                foreach (Chunk c in b.Chunks)
                {
                    ArrayFunctions.WriteToArray(c.Length, raw, ref position);
                    ArrayFunctions.WriteToArray((short)c.Code, raw, ref position);
                    if (c.Vars != null)
                    {
                        ArrayFunctions.WriteToArray(c.Vars, raw, ref position);
                    }
                }
            }
            _rawData = raw;
        }
Exemplo n.º 15
0
        public void WriteProductInUnloading(string dataMatrix)
        {
            var data     = ModbusTcpHelper.AsciiStringToByteArray(dataMatrix);
            var dataWord = ModbusTcpHelper.ByteArrayToWordArray(data);

            ArrayFunctions.InsertArray(_memory, dataWord, UnloadingStartAddress);
        }
Exemplo n.º 16
0
        public void DoublesArraySize()
        {
            var array = new float[4];

            var doubled = ArrayFunctions.DoubleArraySizeAndKeepContents <float>(array);

            Assert.Equal(8, doubled.Length);
        }
Exemplo n.º 17
0
 private void CheckAndUpsizeIndexArray(int numToAdd)
 {
     while (Data.NumIndicesUsed + numToAdd >= Data.QueueSizeIndex)
     {
         Data.Indices         = ArrayFunctions.DoubleArraySizeAndKeepContents <int>(Data.Indices);
         Data.QueueSizeIndex *= 2;
     }
 }
Exemplo n.º 18
0
        public void DoubledArrayReturnsNullIfNullArrayProvided()
        {
            int[] array = null;

            var doubled = ArrayFunctions.DoubleArraySizeAndKeepContents <int>(array);

            Assert.Null(doubled);
        }
Exemplo n.º 19
0
 private void CheckAndUpsizeVertexArray(int numToAdd)
 {
     while (Data.NumVerticesUsed + numToAdd >= Data.QueueSizeVertex)
     {
         Data.Vertices         = ArrayFunctions.DoubleArraySizeAndKeepContents <Vertex2D>(Data.Vertices);
         Data.QueueSizeVertex *= 2;
     }
 }
Exemplo n.º 20
0
        public void TestDuplicates()
        {
            ArrayFunctions af = new ArrayFunctions();

            int[] a = { 1, 2, 3, 4, 4 };

            Assert.IsFalse(af.IsUnique(a));
        }
 /// <summary>Initializes the Goals from raw data</summary>
 /// <param name="raw">Raw byte data, must have Length of 9</param>
 /// <exception cref="ArgumentException">Invalid <i>raw</i>.Length</exception>
 public FGGoals(byte[] raw)
 {
     if (raw.Length < 9)
     {
         throw new ArgumentException("Minimum length of raw is 9", "raw");
     }
     _items = new byte[9];
     ArrayFunctions.TrimArray(raw, 0, _items);
 }
Exemplo n.º 22
0
 /// <summary>Initlialize a new Goal from raw data</summary>
 /// <param name="raw">Raw byte data, minimum Length of 16</param>
 /// <exception cref="ArgumentException">Invalid <i>raw</i>.Length</exception>
 public Goal(byte[] raw)
 {
     if (raw.Length < 16)
     {
         throw new ArgumentException("Minimum length of raw is 16", "raw");
     }
     _items = new byte[16];
     ArrayFunctions.TrimArray(raw, 0, _items);
 }
Exemplo n.º 23
0
        public void Test1()
        {
            ArrayFunctions af = new ArrayFunctions();

            int[] a = { 2, 3, 4 };

            Assert.True(af.IsUnique(a));
            Assert.True(af.IsUnique(new int[0]));
        }
Exemplo n.º 24
0
        public void TestMethod1()
        {
            ArrayFunctions af = new ArrayFunctions();

            int[] a = { 1, 2 };
            Assert.IsTrue(af.IsUnique(a));

            int[] b = { };
            Assert.IsTrue(af.IsUnique(b));
        }
Exemplo n.º 25
0
 /// <summary>Initializes a new Trigger from raw data</summary>
 /// <param name="raw">Raw data, minimum Length of 4</param>
 /// <exception cref="ArgumentException">Invalid <i>raw</i>.Length value<br/><b>-or-</b><br/>Invalid member values</exception>
 public Trigger(byte[] raw)
 {
     if (raw.Length < 4)
     {
         throw new ArgumentException("Minimum length of raw is 4", "raw");
     }
     _items = new byte[4];
     ArrayFunctions.TrimArray(raw, 0, _items);
     _checkValues(this);
 }
Exemplo n.º 26
0
 /// <summary>Gets the ResourceType specified by <i>type</i></summary>
 /// <param name="type">32-bit definition of the Type</param>
 /// <returns>Known resource type, otherwise <see cref="ResourceType.Undefined"/></returns>
 public static ResourceType ParseResourceType(int type)
 {
     try { return((ResourceType)type); }
     catch
     {
         string typeText = ArrayFunctions.ReadStringFromArray(BitConverter.GetBytes(type), 0, 4);
         System.Diagnostics.Debug.WriteLine("ResourceType Parse failure: " + typeText + "(0x" + type.ToString("X") + ")");
         return(ResourceType.Undefined);
     }
 }
Exemplo n.º 27
0
 /// <summary>Initializes the order from raw data.</summary>
 /// <param name="raw">Raw byte data, minimum Length of 18.</param>
 /// <exception cref="ArgumentException">Invalid <paramref name="raw"/> Length value<br/><b>-or-</b><br/>Invalid member values.</exception>
 public Order(byte[] raw)
 {
     if (raw.Length < 18)
     {
         throw new ArgumentException("Minimum length of raw is 18", "raw");
     }
     _items = new byte[18];
     ArrayFunctions.TrimArray(raw, 0, _items);
     checkValues(this);
 }
Exemplo n.º 28
0
 private void tbContourLevels_TextChanged(object sender, EventArgs e)
 {
     if (!_mIgnoreXyzChangeEvent)
     {
         var contourLevels = ArrayFunctions.ExtractFloatArrayFromDelimitedString(tbContourLevels.Text, ',');
         QraStateContainer.Instance.Parameters["FlameWrapper.contour_levels"] =
             new NdConvertibleValue(StockConverters.UnitlessConverter, UnitlessUnit.Unitless, contourLevels,
                                    0.0);
     }
 }
Exemplo n.º 29
0
 /// <summary>Prepares the resource for writing and updates <see cref="Resource.RawData"/></summary>
 public override void EncodeResource()
 {
     byte[] image = EncodeImage(_image, _left, _top);
     byte[] raw   = new byte[image.Length + 8];
     ArrayFunctions.WriteToArray(_left, raw, 0);
     ArrayFunctions.WriteToArray(_top, raw, 2);
     ArrayFunctions.WriteToArray(_right, raw, 4);
     ArrayFunctions.WriteToArray(_bottom, raw, 6);
     ArrayFunctions.WriteToArray(image, raw, 8);
     _rawData = raw;
 }
Exemplo n.º 30
0
 /// <summary>Prepares the resource for writing and updates <see cref="Resource.RawData"/></summary>
 public override void EncodeResource()
 {
     byte[] raw = new byte[_headers.Length * HeaderLength];
     for (int i = 0; i < _headers.Length; i++)
     {
         ArrayFunctions.WriteToArray((int)_headers[i].Type, raw, i * HeaderLength + TypeOffset);
         ArrayFunctions.WriteToArray(_headers[i].Name, raw, i * HeaderLength + NameOffset);
         ArrayFunctions.WriteToArray(_headers[i].Length, raw, i * HeaderLength + LengthOffset);
     }
     _rawData = raw;
 }
Exemplo n.º 31
0
        //Calcuation Controller Action
        public void CalculateAction(List<CategoryViewModel> jCategory)
        {
            foreach (var group in jCategory)
            {
                foreach (var item in group.Functions)
                {
                    if (item.Function == "Input")
                    {
                        item.Output = InputFunctions.Output(item.Type, item.Output);
                        OutputList.Add(new OutputList { ID = Convert.ToString(item.ID), Field = item.Name, Value = item.Output, Group = group.Name });
                    }
                    else
                    {
                        //Logic check at Column Level
                        string colLogic = null;
                        bool colLogicParse = true;
                        if(group.Logic != null)
                        {
                            foreach (var bit in group.Logic)
                            {
                                var grouplastLogic = group.Logic.Last();
                                string grouplastLogicOperator = grouplastLogic.Operator;
                                Logic Logic = new Logic();
                                colLogic = Logic.Output(jCategory, bit, group.ID, 0);
                                Expression ex = new Expression(colLogic);
                                try
                                {
                                    colLogicParse = Convert.ToBoolean(ex.Evaluate());
                                }
                                catch (Exception exception)
                                {
                                    logger.Error(exception);
                                    throw new HttpException(exception.ToString());
                                }

                                if (grouplastLogicOperator == "AND" && colLogicParse == false)
                                {
                                    break;
                                }
                                else if (grouplastLogicOperator == "OR" && colLogicParse == true)
                                {
                                    colLogicParse = true;
                                    break;
                                }

                            }
                        }
                        if (item.Parameter.Count > 0)
                        {
                            string logic = null;
                            bool logicparse = true;
                            string MathString = null;
                            bool PowOpen = false;
                            //Logic check at column level
                            if (colLogicParse == true)
                            {
                                foreach (var bit in item.Logic)
                                {
                                    var lastLogic = item.Logic.Last();
                                    string lastLogicOperator = lastLogic.Operator;
                                    Logic Logic = new Logic();
                                    logic = Logic.Output(jCategory, bit, group.ID, item.ID);
                                    Expression ex = new Expression(logic);

                                    try
                                    {
                                        logicparse = Convert.ToBoolean(ex.Evaluate());
                                    }
                                    catch (Exception exception)
                                    {
                                        logger.Error(exception);
                                        throw new HttpException(exception.ToString());
                                    }

                                    if (lastLogicOperator == "AND" && logicparse == false)
                                    {
                                        break;
                                    }
                                    else if (lastLogicOperator == "OR" && logicparse == true)
                                    {
                                        logicparse = true;
                                        break;
                                    }

                                }
                            }
                            else
                            {
                                logicparse = false;
                            }
                            //Run code if logic if met at column and row level
                            if (logicparse == true)
                            {
                                int paramCount = 1;
                                foreach (var param in item.Parameter)
                                {
                                    string jparameters = Newtonsoft.Json.JsonConvert.SerializeObject(param);
                                    logger.Debug("Column Name(" + group.ID + ") - " + group.Name + " || Row Name(" + item.ID +") - " + item.Name);
                                    if (item.Function == "Maths")
                                    {
                                        Maths Maths = new Maths();
                                        Maths parameters = (Maths)javaScriptSerializ­er.Deserialize(jparameters, typeof(Maths));
                                        MathString = Maths.Output(jparameters,jCategory,group.ID,item.ID,MathString,PowOpen);
                                        PowOpen = Maths.PowOpen(jparameters, PowOpen);
                                        if (paramCount == item.Parameter.Count)
                                        {
                                            Expression e = new Expression(MathString);
                                            var Calculation = e.Evaluate();
                                            bool DeciParse;
                                            decimal CalculationDeci;
                                            string Rounding;
                                            DeciParse = decimal.TryParse(Convert.ToString(Calculation), out CalculationDeci);
                                            Rounding = Convert.ToString(parameters.Rounding);

                                            if (Rounding == null || Rounding == "")
                                            {
                                                Rounding = "2";
                                            }
                                            if (DeciParse == true)
                                            {
                                                decimal Output = CalculationDeci;
                                                MathematicalFunctions MathematicalFunctions = new MathematicalFunctions();

                                                try
                                                {
                                                    Output = MathematicalFunctions.Rounding(Convert.ToString(parameters.RoundingType), Rounding, Output);
                                                }
                                                catch (Exception ex)
                                                {
                                                    logger.Error(ex);
                                                    throw new HttpException(ex.ToString());
                                                }

                                                item.Output = Convert.ToString(Output);
                                            }
                                            else
                                            {
                                                item.Output = "0";
                                            }
                                        }
                                        paramCount = paramCount + 1;
                                    }
                                    else if (item.Function == "ErrorsWarnings")
                                    {
                                        ErrorsWarnings Errors = new ErrorsWarnings();
                                        ErrorsWarnings parameters = (ErrorsWarnings)javaScriptSerializ­er.Deserialize(jparameters, typeof(ErrorsWarnings));
                                        item.Name = parameters.Type;
                                        item.Output = parameters.String1;
                                    }
                                    else if (item.Function == "Comments")
                                    {
                                        Comments Errors = new Comments();
                                        Comments parameters = (Comments)javaScriptSerializ­er.Deserialize(jparameters, typeof(Comments));
                                        item.Output = parameters.String1;
                                    }
                                    else if (item.Function == "Period")
                                    {
                                        DateFunctions DateFunctions = new DateFunctions();
                                        Period Periods = new Period();
                                        try
                                        {
                                            item.Output = Periods.Output(jparameters, jCategory, group.ID, item.ID);
                                        }
                                        catch (Exception ex)
                                        {
                                            logger.Error(ex);
                                            throw new HttpException(ex.ToString());
                                        }
                                    }
                                    else if (item.Function == "Factors")
                                    {
                                        Factors Factors = new Factors();
                                        Factors parameters = (Factors)javaScriptSerializ­er.Deserialize(jparameters, typeof(Factors));
                                        try
                                        {
                                            item.Output = Factors.Output(jparameters, jCategory, group.ID, item.ID);
                                        }
                                        catch (Exception ex)
                                        {
                                            logger.Error(ex);
                                            throw new HttpException(ex.ToString());
                                        }

                                        item.Type = parameters.OutputType;
                                    }
                                    else if (item.Function == "DateAdjustment")
                                    {
                                        Dates Dates = new Dates();
                                        try
                                        {
                                            item.Output = Dates.Output(jparameters, jCategory, group.ID, item.ID);
                                        }
                                        catch (Exception ex)
                                        {
                                            logger.Error(ex);
                                            throw new HttpException(ex.ToString());
                                        }
                                    }
                                    else if (item.Function == "DatePart")
                                    {
                                        DatePart DateParts = new DatePart();
                                        try
                                        {
                                            item.Output = DateParts.Output(jparameters, jCategory, group.ID, item.ID);
                                        }
                                        catch (Exception ex)
                                        {
                                            logger.Error(ex);
                                            throw new HttpException(ex.ToString());
                                        }
                                    }

                                    else if (item.Function == "MathsFunctions")
                                    {
                                        MathsFunctions MathsFunctions = new MathsFunctions();
                                        try
                                        {
                                            item.Output = MathsFunctions.Output(jparameters, jCategory, group.ID, item.ID);
                                        }
                                        catch (Exception ex)
                                        {
                                            logger.Error(ex);
                                            throw new HttpException(ex.ToString());
                                        }
                                    }
                                    else if (item.Function == "ArrayFunctions")
                                    {
                                        ArrayFunctions ArrayFunctions = new ArrayFunctions();
                                        ArrayFunctions parameters = (ArrayFunctions)javaScriptSerializ­er.Deserialize(jparameters, typeof(ArrayFunctions));
                                        try
                                        {
                                            item.Output = ArrayFunctions.Output(jparameters, jCategory, group.ID, item.ID);
                                        }
                                        catch (Exception ex)
                                        {
                                            logger.Error(ex);
                                            throw new HttpException(ex.ToString());
                                        }

                                        if(parameters.Function == "Count")
                                        {
                                            item.Type = "Decimal";
                                        }
                                        else
                                        {
                                            item.Type = parameters.LookupType;
                                        }

                                    }
                                    else if (item.Function == "StringFunctions")
                                    {
                                        StringFunctions StringFunctions = new StringFunctions();
                                        StringFunctions  parameters = (StringFunctions)javaScriptSerializ­er.Deserialize(jparameters, typeof(StringFunctions));
                                        try
                                        {
                                            item.Output = StringFunctions.Output(jparameters, jCategory, group.ID, item.ID);
                                        }
                                        catch (Exception ex)
                                        {
                                            logger.Error(ex);
                                            throw new HttpException(ex.ToString());
                                        }

                                        if(parameters.Type == "Len")
                                        {
                                            item.Type = "Decimal";
                                        }
                                        else
                                        {
                                            item.Type = "String";
                                        }
                                    }
                                }
                                //Expected results on the builder this sets the required ones
                                if (item.ExpectedResult == null || item.ExpectedResult == "")
                                {
                                    item.Pass = "******";
                                }
                                else if (item.ExpectedResult == item.Output)
                                {
                                    item.Pass = "******";
                                }
                                else
                                {
                                    item.Pass = "******";
                                }
                                OutputList.Add(new OutputList { ID = Convert.ToString(item.ID), Field = item.Name, Value = item.Output, Group = group.Name });
                            }
                            else
                            {
                                //Ignores the row if logic is not met
                                dynamic LogicReplace = Config.VariableReplace(jCategory, item.Name, group.ID, item.ID);

                                if(Convert.ToString(LogicReplace) == Convert.ToString(item.Name))
                                {
                                    item.Output = null;
                                }
                                else
                                {
                                    item.Output = Convert.ToString(LogicReplace);
                                }
                                item.Pass = "******";

                                OutputList.Add(new OutputList { ID = Convert.ToString(item.ID), Field = item.Name, Value = item.Output, Group = group.Name });
                            }
                        }
                    }
                }
            }
        }