Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Converters/ThreeValuesMultiConverter.cs @ 13401

Last change on this file since 13401 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.1 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Data;
6
7namespace Microsoft.Research.DynamicDataDisplay.Converters
8{
9  public abstract class ThreeValuesMultiConverter<T1, T2, T3> : IMultiValueConverter
10  {
11    #region IMultiValueConverter Members
12
13    public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
14    {
15      if (values != null && values.Length == 3)
16      {
17        if (values[0] is T1 && values[1] is T2 && values[2] is T3)
18        {
19          T1 param1 = (T1)values[0];
20          T2 param2 = (T2)values[1];
21          T3 param3 = (T3)values[2];
22
23          var result = ConvertCore(param1, param2, param3, targetType, parameter, culture);
24          return result;
25        }
26      }
27      return null;
28    }
29
30    protected abstract object ConvertCore(T1 value1, T2 value2, T3 value3, Type targetType, object parameter, System.Globalization.CultureInfo culture);
31
32    public virtual object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
33    {
34      throw new NotSupportedException();
35    }
36
37    #endregion
38  }
39}
Note: See TracBrowser for help on using the repository browser.