/// <summary>
        /// Processes the specified information point
        /// </summary>
        /// <param name="info">The information on cell content</param>
        public virtual void Assign(CellContentInfo info)
        {
            var             types = info.type.getEnumListFromFlags <CellContentType>();
            CellContentType t     = info.type;


            foreach (CellContentType mt in measuredTypes)
            {
                if (t.HasFlag(mt))
                {
                    cellContentTypeCounter.Count(mt);
                    break;
                }
            }

            cellContentRealTypeCounter.Count(t);

            if (cellContentTypeCounter.DistinctCount() > 0)
            {
                dominantType = cellContentTypeCounter.GetItemsWithTopFrequency().FirstOrDefault();
            }
            results.Add(t);
            results_real.Add(info.type);

            //frequency[t]++;

            min_width = Math.Min(min_width, info.length);
            max_width = Math.Max(max_width, info.length);
        }
 public void Assign(CellContentInfo info, Int32 x, Int32 y)
 {
     SetToRegistry(x, y, info);
     row_stats[y].Assign(info);
     column_stats[x].Assign(info);
     total.Assign(info);
 }
        protected void SetToRegistry(Int32 x, Int32 y, CellContentInfo info)
        {
            String key = GetRegistryKey(x, y);

            if (!registry.ContainsKey(key))
            {
                registry.Add(key, info);
            }
        }
 protected void SetZoneCornerUL(coordinateXY zone)
 {
     for (int x = 0; x < column_stats.Count; x++)
     {
         for (int y = 0; y < row_stats.Count; y++)
         {
             CellContentInfo info = Get(x, y);
             if (info != null)
             {
                 if (info.type == total.dominantType)
                 {
                     zone.x = x;
                     zone.y = y;
                     return;
                 }
             }
         }
     }
 }
 public override void Assign(CellContentInfo info)
 {
     ContentInfos.Add(info);
     base.Assign(info);
 }
Пример #6
0
        /// <summary>
        /// Determines type of the content.
        /// </summary>
        /// <param name="cellValue">The cell value.</param>
        /// <returns></returns>
        public CellContentInfo DetermineContentType(String cellValue, Boolean UseNoDataWillCards = true)
        {
            CellContentInfo output = new CellContentInfo();

            String input = cellValue;

            input = valueExtraction.ProcessInput(cellValue, null, null);

            output.content = input;

            if (input.isNullOrEmpty())
            {
                output.type = CellContentType.empty;
                return(output);
            }
            else
            {
                output.length = input.Length;
            }

            if (input == FORMAT_WILLCARD)
            {
                output.type = CellContentType.Any;
            }

            if (RegexText.IsMatch(input))
            {
                output.type = CellContentType.textual;
            }
            else if (RegexFormatedNumber.IsMatch(input))
            {
                if (_select_FORMAT_BANKACCOUNTNUMBER.IsMatch(input))
                {
                    output.type = CellContentType.bank_account;
                }
                else if (_select_DATE_UNIVERSAL.IsMatch(input))
                {
                    output.type = CellContentType.date_format;
                }
                else
                {
                    output.type = CellContentType.numeric;

                    if (input.Contains("."))
                    {
                        output.type |= CellContentType.withDot;

                        if (input.ToArray().Count(x => x == '.') > 1)
                        {
                            //  output.type |= CellContentType.formatted;
                        }
                    }

                    if (input.Contains(","))
                    {
                        output.type |= CellContentType.withComma;
                        if (input.ToArray().Count(x => x == ',') > 1)
                        {
                            output.type |= CellContentType.formatted;
                        }
                    }
                    if (input.Contains("-"))
                    {
                        output.type |= CellContentType.withMinus;
                        if (input.ToArray().Count(x => x == '-') > 1)
                        {
                            output.type |= CellContentType.formatted;
                        }
                    }

                    if (input.Contains(" "))
                    {
                        output.type |= CellContentType.withSpace;
                        if (input.ToArray().Count(x => x == ' ') > 1)
                        {
                            output.type |= CellContentType.formatted;
                        }
                    }

                    if (input.Contains("+"))
                    {
                        output.type |= CellContentType.withPlus;
                    }

                    if (input.Contains("%"))
                    {
                        output.type |= CellContentType.withPercentage;
                    }

                    if (input.StartsWith("0"))
                    {
                        if (input.Length > 1)
                        {
                            var mc = RegexSelectCleanNumber.Match(input.Substring(1));
                            if (mc.Success)
                            {
                                if (mc.Index == 0)
                                {
                                    output.type |= CellContentType.formatted;
                                }
                            }
                        }
                    }

                    if (input.Contains(Environment.NewLine))
                    {
                        output.type |= CellContentType.formatted;
                    }
                }
            }
            else
            {
                output.type = CellContentType.mixed;
            }

            return(output);
        }