public void AddPattern(UInt32[] pattern)
            {
                if (pattern.Length != length)
                {
                    throw new InvalidOperationException();
                }

                totalPatternCount++;

                // Check if this pattern already exists
                for (int i = 0; i < uniquePatterns.Count; i++)
                {
                    PatternAndCount existingPattern  = uniquePatterns[i];
                    Boolean         allElementsMatch = true;
                    for (UInt32 compareIndex = 0; compareIndex < length; compareIndex++)
                    {
                        if (existingPattern.pattern[compareIndex] != pattern[compareIndex])
                        {
                            allElementsMatch = false;
                            break;
                        }
                    }
                    if (allElementsMatch)
                    {
                        existingPattern.extraCount++;
                        return;
                    }
                }

                //
                // Did not match any existing pattern
                //
                uniquePatterns.Add(new PatternAndCount(pattern));
            }
            public void Print(Boolean printPatterns)
            {
                if (totalPatternCount == 0)
                {
                    return;
                }

                Console.WriteLine("{0} patterns of length {1}", totalPatternCount, length);
                if (printPatterns)
                {
                    for (int i = 0; i < uniquePatterns.Count; i++)
                    {
                        PatternAndCount pattern = uniquePatterns[i];
                        Console.WriteLine("  {0}: {1}", pattern.extraCount + 1, pattern.pattern.SerializeObject());
                    }
                }
            }