Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 private IEnumerable <IntermediateInferenceItemInternal> GetBruteInferenceCollectionIntermediate(TEntity entity)
 {
     for (int i = 0; i < this.BrokedBooleanExpressionsByOrOperator.Length; i++)
     {
         IntermediateInferenceItemInternal item = new IntermediateInferenceItemInternal()
         {
             PropertiesNeedToChange = new List <string>(),
             RatingsReport          = new List <bool>()
         };
         string[] breakApartExpressionByAndAlso = this.BrokedBooleanExpressionsByOrOperator[i].Split(new string[] { " AndAlso " }, StringSplitOptions.None);
         for (int j = 0; j < breakApartExpressionByAndAlso.Length; j++)
         {
             for (int x = 0; x < this._propertiesNames.Length; x++)
             {
                 if (breakApartExpressionByAndAlso[j].Contains(this._propertiesNames[x]))
                 {
                     bool rating = this.ProcessFilter(breakApartExpressionByAndAlso[j], entity, this._propertiesNames[x]);
                     item.RatingsReport.Add(rating);
                     if (!rating)
                     {
                         item.PropertiesNeedToChange.Add(this._propertiesNames[x]);
                     }
                 }
             }
         }
         yield return(item);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private InferenceInternal <TEntity> GetBruteInferenceCollection(TEntity entity)
        {
            InferenceInternal <TEntity> result = new InferenceInternal <TEntity>()
            {
                RatingsReport          = new List <bool>(),
                PropertiesNeedToChange = new List <string>(),
                Data = entity
            };
            IntermediateInferenceItemInternal minErrors = GetBruteInferenceCollectionIntermediate(entity).OrderBy(x => x.ErrorsQuantity).FirstOrDefault();

            result.RatingsReport          = minErrors.RatingsReport;
            result.PropertiesNeedToChange = minErrors.PropertiesNeedToChange;
            return(result);
        }