Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12578 for trunk


Ignore:
Timestamp:
07/02/15 17:02:48 (9 years ago)
Author:
mkommend
Message:

#2276: Corrected shrink menu item to only consider objects of type Dataset.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/ShrinkDataAnalysisRunsMenuItem.cs

    r12509 r12578  
    8282        var variableValuesMapping = new Dictionary<ValuesType, ValuesType>();
    8383        foreach (var problemData in view.Content.GetObjectGraphObjects(excludeStaticMembers: true).OfType<IDataAnalysisProblemData>()) {
    84           var originalValues = variableValuesGetter(problemData.Dataset);
     84          var dataset = problemData.Dataset as Dataset;
     85          if (dataset == null) continue;
     86          var originalValues = variableValuesGetter(dataset);
    8587          var matchingValues = GetEqualValues(originalValues, variableValuesMapping);
    86           variableValuesSetter(problemData.Dataset, matchingValues);
     88          variableValuesSetter(dataset, matchingValues);
    8789        }
    8890      };
     
    116118    }
    117119
    118     private static readonly Action<IDataset, Dictionary<string, IList>> variableValuesSetter;
    119     private static readonly Func<IDataset, Dictionary<string, IList>> variableValuesGetter;
     120    private static readonly Action<Dataset, Dictionary<string, IList>> variableValuesSetter;
     121    private static readonly Func<Dataset, Dictionary<string, IList>> variableValuesGetter;
    120122    /// <summary>
    121123    /// The static initializer is used to create expressions for getting and setting the private variableValues field in the dataset.
     
    123125    /// </summary>
    124126    static ShrinkDataAnalysisRunsMenuItem() {
    125       var dataset = Expression.Parameter(typeof(IDataset));
     127      var dataset = Expression.Parameter(typeof(Dataset));
    126128      var variableValues = Expression.Parameter(typeof(ValuesType));
    127129      var valuesExpression = Expression.Field(dataset, "variableValues");
    128130      var assignExpression = Expression.Assign(valuesExpression, variableValues);
    129131
    130       var variableValuesSetExpression = Expression.Lambda<Action<IDataset, ValuesType>>(assignExpression, dataset, variableValues);
     132      var variableValuesSetExpression = Expression.Lambda<Action<Dataset, ValuesType>>(assignExpression, dataset, variableValues);
    131133      variableValuesSetter = variableValuesSetExpression.Compile();
    132134
    133       var variableValuesGetExpression = Expression.Lambda<Func<IDataset, ValuesType>>(valuesExpression, dataset);
     135      var variableValuesGetExpression = Expression.Lambda<Func<Dataset, ValuesType>>(valuesExpression, dataset);
    134136      variableValuesGetter = variableValuesGetExpression.Compile();
    135137    }
Note: See TracChangeset for help on using the changeset viewer.