Ejemplo n.º 1
0
 public AssetController(IAssetManager assetManager, IConfiguration configuration, IBlobManager blobManager, IAnalysisManager analysisManager)
 {
     _assetManager    = assetManager;
     _configuration   = configuration;
     _blobManager     = blobManager;
     _analysisManager = analysisManager;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Get ids for taxa that matches search criteria.
 /// </summary>
 /// <param name="analysisManager">Analysis manager.</param>
 /// <param name="searchCriteria">Analysis search critera.</param>
 /// <param name="taxonIds">
 /// Limit search to these taxa.
 /// This parameter is ignored if value is null.
 /// </param>
 /// <returns>Ids for taxa that matches search criteria.</returns>
 public static TaxonIdList GetTaxonIds(
     this IAnalysisManager analysisManager,
     AnalysisSearchCriteria searchCriteria,
     TaxonIdList taxonIds)
 {
     return(mCache.GetTaxonIds(searchCriteria, taxonIds));
 }
        public AnalysisController(IAnalysisManager analysisManager, IUserManager userManager)
        {
            this._analysisManager = analysisManager;
            this._userManager     = userManager;

            _csvLocations = Directory.EnumerateFiles(HttpContext.Current.Server.MapPath("~/Content/Csv/")).ToList();
        }
Ejemplo n.º 4
0
 public GeneratePredictionCommand(ILogger <GeneratePredictionCommand> log, GeneratePredictionConfig config, IAnalysisManager instance)
     : base(log)
 {
     this.log      = log;
     this.config   = config;
     this.instance = instance;
 }
Ejemplo n.º 5
0
 public MainViewModel(IFolderScanner folderScanner, ICodeParser codeParser, IAnalysisManager analysisManager)
 {
     _folderScanner             = folderScanner;
     _codeParser                = codeParser;
     _analysisManager           = analysisManager;
     SourceCodeFilesCollection  = new ObservableCollection <DocumentData>();
     ViolationSummaryCollection = new ObservableCollection <SummaryData>();
     CodeRootLocation           = string.Empty;//@"b:\samplefile";
     InitializeCommands();
     PointLabel = chartPoint =>
                  string.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Participation);
     InitializePieChartProperties();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Get ids for taxa that matches search criteria.
        /// </summary>
        /// <param name="analysisManager">Analysis manager.</param>
        /// <param name="searchCriteria">Analysis search critera.</param>
        /// <param name="taxa">
        /// Limit search to these taxa.
        /// This parameter is ignored if value is null.
        /// </param>
        /// <returns>Ids for taxa that matches search criteria.</returns>
        public static TaxonIdList GetTaxonIds(
            this IAnalysisManager analysisManager,
            AnalysisSearchCriteria searchCriteria,
            TaxonList taxa)
        {
            TaxonIdList taxonIds = null;

            if (taxa.IsNotNull())
            {
                taxonIds = new TaxonIdList();
                taxonIds.Merge(taxa);
            }

            return(mCache.GetTaxonIds(searchCriteria, taxonIds));
        }
Ejemplo n.º 7
0
        ///// <summary>
        ///// Calculate total taxa count by red list category.
        ///// </summary>
        ///// <param name="analysisManager">Analysis manager.</param>
        ///// <param name="redListTaxonCategories"></param>
        ///// <returns>Red listed taxa count.</returns>
        //public static long GetTotalRedListTaxaCount(this IAnalysisManager analysisManager, List<string> redListTaxonCategories)
        //{
        //    var criteria = new AnalysisSearchCriteria();

        //    if (redListTaxonCategories.IsNotNull() && redListTaxonCategories.Count > 0)
        //    {
        //        criteria.TaxonCategories = redListTaxonCategories;
        //    }

        //    criteria.RedListCategories = new List<int>();

        //    var categories = RedListedHelper.GetRedListCategoriesDdToNt();
        //    foreach (var cat in categories)
        //    {
        //        criteria.RedListCategories.Add((int)cat);
        //    }

        //    var result = GetTaxonIds(analysisManager, criteria);
        //    if (result.IsNotEmpty())
        //    {
        //        return result.Count;
        //    }

        //    return 0;
        //}

        /// <summary>
        /// Init analysis cache.
        /// </summary>
        /// <param name="analysisManager">Analysis manager.</param>
        /// <param name="userContext">The user context.</param>
        public static void InitAnalysisCache(this IAnalysisManager analysisManager, IUserContext userContext)
        {
            mCache = null;
            string cacheFileName = GetCacheFileName();

            try
            {
                // Try to read from cached file.
                if (File.Exists(cacheFileName))
                {
                    using (FileStream stream = File.Open(
                               cacheFileName,
                               FileMode.Open,
                               FileAccess.Read,
                               FileShare.Read))
                    {
                        var formatter = new BinaryFormatter();
                        mCache = (AnalysisCache)formatter.Deserialize(stream);
                        stream.Close();
                        if (!mCache.IsOk())
                        {
                            mCache = null;
                        }
                    }
                }
            }
            // ReSharper disable once EmptyGeneralCatchClause
            catch (Exception)
            {
            }

            if (mCache.IsNull())
            {
                //Logger.Debug("Invalid definition of AnalysisCache, start updating...");
                UpdateCache();
                //Logger.Debug("AnalysisCache updated...");
            }

            if (!Configuration.Debug)
            {
                // Start cache update thread.
                var thread = new Thread(StartCacheUpdate);
                thread.Start();
            }
        }
Ejemplo n.º 8
0
 public OrganisationController(IUserManager userManager, IAnalysisManager analysisManager)
 {
     this._userManager     = userManager;
     this._analysisManager = analysisManager;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Stop automatic analysis cache update.
 /// </summary>
 /// <param name="analysisManager">Analysis manager.</param>
 public static void StopCacheUpdate(this IAnalysisManager analysisManager)
 {
     mStopUpdate = true;
 }
Ejemplo n.º 10
0
        ///// <summary>
        ///// The get taxon ids selected by scope.
        ///// </summary>
        ///// <param name="analysisManager"></param>
        ///// <param name="searchCriteria">
        ///// The search criteria.
        ///// </param>
        ///// <returns>
        ///// Ids for taxa that matches scope/search criteria.
        ///// </returns>
        //public static TaxonIdList GetTaxonIdsByScope(this IAnalysisManager analysisManager, AnalysisSearchCriteria searchCriteria)
        //{
        //    return mCache.GetTaxonIdsByScope(searchCriteria);
        //}

        /// <summary>
        /// Gets the redlist category for a specific taxon
        /// </summary>
        /// <param name="analysisManager"></param>
        /// <param name="taxonId"></param>
        /// <param name="category"></param>
        /// <returns></returns>
        public static bool GetRedListCategoryForTaxonId(this IAnalysisManager analysisManager, int taxonId, out RedListCategory category)
        {
            return(mCache.GetRedListCategoryForTaxonId(taxonId, out category));
        }