Changeset 12578 for trunk/sources
- Timestamp:
- 07/02/15 17:02:48 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/MenuItems/ShrinkDataAnalysisRunsMenuItem.cs
r12509 r12578 82 82 var variableValuesMapping = new Dictionary<ValuesType, ValuesType>(); 83 83 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); 85 87 var matchingValues = GetEqualValues(originalValues, variableValuesMapping); 86 variableValuesSetter( problemData.Dataset, matchingValues);88 variableValuesSetter(dataset, matchingValues); 87 89 } 88 90 }; … … 116 118 } 117 119 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; 120 122 /// <summary> 121 123 /// The static initializer is used to create expressions for getting and setting the private variableValues field in the dataset. … … 123 125 /// </summary> 124 126 static ShrinkDataAnalysisRunsMenuItem() { 125 var dataset = Expression.Parameter(typeof( IDataset));127 var dataset = Expression.Parameter(typeof(Dataset)); 126 128 var variableValues = Expression.Parameter(typeof(ValuesType)); 127 129 var valuesExpression = Expression.Field(dataset, "variableValues"); 128 130 var assignExpression = Expression.Assign(valuesExpression, variableValues); 129 131 130 var variableValuesSetExpression = Expression.Lambda<Action< IDataset, ValuesType>>(assignExpression, dataset, variableValues);132 var variableValuesSetExpression = Expression.Lambda<Action<Dataset, ValuesType>>(assignExpression, dataset, variableValues); 131 133 variableValuesSetter = variableValuesSetExpression.Compile(); 132 134 133 var variableValuesGetExpression = Expression.Lambda<Func< IDataset, ValuesType>>(valuesExpression, dataset);135 var variableValuesGetExpression = Expression.Lambda<Func<Dataset, ValuesType>>(valuesExpression, dataset); 134 136 variableValuesGetter = variableValuesGetExpression.Compile(); 135 137 }
Note: See TracChangeset
for help on using the changeset viewer.