internal static PatchTable GetInstanceWithUniformWeightByLength(IList <PatchPattern> patchPatternCollection)
        {
            PatchTable patchTable = new PatchTable();

            patchTable.PatchTableScorer = PatchTableScorer.GetInstance("normal");

            int totalLength = 0;

            foreach (PatchPattern patchPattern in patchPatternCollection)
            {
                totalLength += patchPattern.FullLength;
            }


            foreach (PatchPattern patchPattern in patchPatternCollection)
            {
                double weight = (double)patchPattern.FullLength / (double)totalLength;

                patchTable.SetMaxPatchLength(patchPattern);

                Patch aPatch = Patch.GetInstance(patchPattern, weight);
                patchTable.Add(aPatch);
                patchTable.CreateSortedArrays();
            }

            return(patchTable);
        }
        static public PatchTable GetInstanceFromFile(PatchPatternFactory patchPatternFactory,
                                                     TextReader patchTableTextReader, string scorerName)
        {
            PatchTable patchTable = new PatchTable();

            patchTable.PatchTableScorer = PatchTableScorer.GetInstance(scorerName);

            foreach (Dictionary <string, string> row in SpecialFunctions.TabFileTable(patchTableTextReader, "Patch\tWeight", false))
            {
                PatchPattern patchPattern = patchPatternFactory.GetInstance(row["Patch"]);
                double       weight       = double.Parse(row["Weight"]);
                patchTable.SetMaxPatchLength(patchPattern);
                Patch patch = Patch.GetInstance(patchPattern, weight);
                patchTable.Add(patch);
            }

            patchTable.CreateSortedArrays();

            return(patchTable);
        }