Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args.Length != 2)
            {
                Console.WriteLine("Usage: TrainerDB.exe dbfile outfile");
                return;
            }

            AtomDictionary atoms = null;
            StubAnnotatedSummaryDictionary candidates = null;

            using (var fs = new System.IO.FileStream(args[0], System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
            {
                var serializer = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
                var obj        = serializer.Deserialize(fs);
                atoms = obj as AtomDictionary;
                if (atoms != null)
                {
                    atoms.Print(args[1]);
                }
                candidates = obj as StubAnnotatedSummaryDictionary;
                if (candidates != null)
                {
                    candidates.Print(args[1]);
                }
            }
        }
Ejemplo n.º 2
0
        public static StubAnnotatedSummaryDictionary Merge(IEnumerable <StubAnnotatedSummaryDictionary> dbs)
        {
            Debug.Assert(!Driver.useStubs, "stubs annotation net yet supported");

            var ret   = new StubAnnotatedSummaryDictionary();
            var preds = new HashSet <string>();

            foreach (var db in dbs)
            {
                foreach (var tup in db.table)
                {
                    if (preds.Contains(tup.Item3))
                    {
                        continue;
                    }
                    preds.Add(tup.Item3);
                    ret.table.Add(tup);
                }
            }
            return(ret);
        }