Exemplo n.º 1
0
        /// <summary>
        /// The operation to calculate metrics for saved and presented shapes.
        /// </summary>
        /// <param name="options">The options object which contains extra information
        /// which helps during the exeuction of this modus.</param>
        public static void Start(MeasureOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            Logger.Log(I_StartProc_Measure);
            // Load in new shapes to measure.
            if (options.HasDirectories)
            {
                foreach (string dir in options.ShapeDirectories)
                {
                    Settings.FileManager.AddDirectoryDirect(dir);
                }
            }
            // Perform metric calculations.
            IRecordHolder <MeshEntry> recordHolder = MetricCalculator;

            recordHolder.TakeSnapShot(Settings.MeshLibrary);
            // Save results to external file.
            SaveMetrics(recordHolder);
            // Notify the user of the refined shapes.
            Logger.Log(I_ShapeCount, Settings.MeshLibrary.Count);
            Logger.Log(I_EndProc_Measure);
        }
        /// <summary>
        /// The operation to evaluate the result of a query.
        /// </summary>
        /// <param name="options">The options object which contains extra information
        /// which helps during the exeuction of this modus.</param>
        public static void Start(EvaluateOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            Logger.Log(I_StartProc_Evaluate);

            IRecordHolder <QueryResult> records = EvaluationCalculator;

            QueryResult[] results = QueryHandler.LoadQueryResults(options.ShouldImport);
            records.TakeSnapShot(results);

            IRecordHolder holder = null;

            switch (options.EvaluationMode)
            {
            case EvaluationMode.Individual:
                holder = records;
                break;

            case EvaluationMode.Aggregated:
                holder = RecordMerger.Merge(records);
                break;
            }

            if (options.ShouldExport)
            {
                SaveEvaluation(holder);
            }

            Logger.Log(I_EndProc_Evaluate);
        }