ApproxIndexes.Indexes.Execute C# (CSharp) Method

Execute() public static method

public static Execute ( IndexArgumentSetup setup, string nick, string idxname, Index>.Func create ) : string
setup IndexArgumentSetup
nick string
idxname string
create Index>.Func
return string
        public static string Execute(IndexArgumentSetup setup, string nick, string idxname, Func<MetricDB, Index> create)
        {
            var resname = GetResultName (nick, idxname, setup, "");
            if (File.Exists (resname)) {
                return resname;
            }
            MetricDB db = SpaceGenericIO.Load (setup.BINARY_DATABASE);
            Index idx;

            if (!File.Exists (idxname)) {
                Console.WriteLine ("*** creating index {0}", idxname);
                var s = DateTime.Now.Ticks;
                var c = db.NumberDistances;
                idx = create (db);
                SaveConstructionTime (idxname, DateTime.Now.Ticks - s, db.NumberDistances - c);
                IndexGenericIO.Save (idxname, idx);
            } else {
                idx = IndexGenericIO.Load (idxname);
            }

            if (!File.Exists (resname)) {
                PerformSearch (resname, idx, idxname, setup);
            }

            return resname;
        }