Exemple #1
0
		public void BuildLookupTable()
		{
			IComparer comparer = new PatternComparer();
			this.tmpSimplePatterns.Sort(comparer);
			foreach (Pattern p in tmpSimplePatterns)
			{
				if (p.StringPattern.Length <= 2)
				{
					char c = p.StringPattern[0];

					if (!p.Parent.CaseSensitive)
					{
						char c1 = char.ToLower(c);
						if (LookupTable[c1] == null)
							LookupTable[c1] = new PatternCollection();

						PatternCollection patterns = LookupTable[c1] as PatternCollection;
						if (!patterns.Contains(p))
							patterns.Add(p);

						char c2 = char.ToUpper(c);
						if (LookupTable[c2] == null)
							LookupTable[c2] = new PatternCollection();

						patterns = LookupTable[c2] as PatternCollection;
						if (!patterns.Contains(p))
							patterns.Add(p);
					}
					else
					{
						if (LookupTable[c] == null)
							LookupTable[c] = new PatternCollection();

						PatternCollection patterns = LookupTable[c] as PatternCollection;
						if (!patterns.Contains(p))
							patterns.Add(p);
					}
				}
				else
				{
					string c = p.StringPattern.Substring(0, 3).ToLower();

					if (LookupTable[c] == null)
						LookupTable[c] = new PatternCollection();

					PatternCollection patterns = LookupTable[c] as PatternCollection;
					if (!patterns.Contains(p))
						patterns.Add(p);
				}
			}
		}
Exemple #2
0
        public void BuildLookupTable()
        {
            IComparer comparer = new PatternComparer();

            this.tmpSimplePatterns.Sort(comparer);
            foreach (Pattern p in tmpSimplePatterns)
            {
                if (p.StringPattern.Length <= 2)
                {
                    char c = p.StringPattern[0];

                    if (!p.Parent.CaseSensitive)
                    {
                        char c1 = char.ToLower(c);
                        if (LookupTable[c1] == null)
                        {
                            LookupTable[c1] = new PatternCollection();
                        }

                        PatternCollection patterns = LookupTable[c1] as PatternCollection;
                        if (!patterns.Contains(p))
                        {
                            patterns.Add(p);
                        }

                        char c2 = char.ToUpper(c);
                        if (LookupTable[c2] == null)
                        {
                            LookupTable[c2] = new PatternCollection();
                        }

                        patterns = LookupTable[c2] as PatternCollection;
                        if (!patterns.Contains(p))
                        {
                            patterns.Add(p);
                        }
                    }
                    else
                    {
                        if (LookupTable[c] == null)
                        {
                            LookupTable[c] = new PatternCollection();
                        }

                        PatternCollection patterns = LookupTable[c] as PatternCollection;
                        if (!patterns.Contains(p))
                        {
                            patterns.Add(p);
                        }
                    }
                }
                else
                {
                    string c = p.StringPattern.Substring(0, 3).ToLower();

                    if (LookupTable[c] == null)
                    {
                        LookupTable[c] = new PatternCollection();
                    }

                    PatternCollection patterns = LookupTable[c] as PatternCollection;
                    if (!patterns.Contains(p))
                    {
                        patterns.Add(p);
                    }
                }
            }
        }