public DefaultAssetRecommendationEngine(AssetsDataManager assetsDataManager, SkillsDataManager skillsDataManager,
                                         GroupLinkageManager glm, ProblemLinkageManager plm)
 {
     this.assetsDataManager     = assetsDataManager;
     this.skillsDataManager     = skillsDataManager;
     this.groupLinkageManager   = glm;
     this.problemLinkageManager = plm;
     iahe = null;
 }
 private IAssetHeuristicEngine getAssetHeuristicEngine(ICollection <string> assetTypes, IList <AssetRecomendation> pastAssets)
 {
     if (iahe == null)
     {
         iahe = new AssetHeuristicEngine(assetTypes, pastAssets);
     }
     else
     {
         iahe.generateAssetScores(assetTypes, pastAssets);
     }
     return(iahe);
 }
        public IList <AssetRecomendation> GetRecommendationsFor(string skillIndex)
        {
            ICollection <string>     assetTypes    = assetsDataManager.GetAssetsTypes();
            Dictionary <string, int> typeScoresMap = new Dictionary <string, int>();

            foreach (string type in assetTypes)
            {
                typeScoresMap.Add(type, 0);
            }

            skillsDataManager.Visit(delegate(string skillId, bool isComplete){
                if (isComplete)
                {
                    IAssetHeuristicEngine engine = getAssetHeuristicEngine(assetTypes, assetsDataManager.GetAssetsFor(skillId));
                    foreach (string type in assetTypes)
                    {
                        typeScoresMap[type] += engine.getScoreForType(type);
                    }
                }
            });

            IList <AssetRecomendation>          unsortedList   = assetsDataManager.GetAssetsFor(skillIndex);
            List <ComparableAssetRecomendation> comparableList = new List <ComparableAssetRecomendation>();

            foreach (AssetRecomendation ar in unsortedList)
            {
                comparableList.Add(new ComparableAssetRecomendation(ar, typeScoresMap[ar.GetAssetType()]));
            }

            comparableList.Sort(new ComparableAssetRecomendationComparer());

            IList <AssetRecomendation> arList = new List <AssetRecomendation>();

            foreach (AssetRecomendation ar in comparableList)
            {
                arList.Add(ar);
            }

            return(arList);
        }
 public void setHeuristicsEngine(IAssetHeuristicEngine iahe)
 {
     this.iahe = iahe;
 }