Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problem.ProgramSynthesis.BenchmarkSuite/Views/ViewHelper.cs @ 14908

Last change on this file since 14908 was 14898, checked in by pkimmesw, 8 years ago

#2665 Set name properties of ERC values

File size: 3.2 KB
RevLine 
[14777]1namespace HeuristicLab.BenchmarkSuite.Views {
2  public static class ViewHelper {
3    public static string StringifyInput(ExampleArgumentType type, Example example, string valueSeparator) {
4      switch (type) {
[14898]5        case ExampleArgumentType.Integer: return string.Join(valueSeparator, example.InputInteger);
6        //case ExampleArgumentType.IntegerVector: return string.Join(valueSeparator, example.InputInteger);
[14777]7
[14898]8        case ExampleArgumentType.Float: return string.Join(valueSeparator, example.InputFloat);
9        //case ExampleArgumentType.FloatVector: return string.Join(valueSeparator, example.InputFloat);
[14777]10
[14875]11        case ExampleArgumentType.Boolean: return string.Join(valueSeparator, example.InputBoolean);
[14777]12        case ExampleArgumentType.Char: return string.Join(valueSeparator, example.InputChar);
13
[14898]14        case ExampleArgumentType.String: return string.Join(valueSeparator, example.InputString);
15        //case ExampleArgumentType.StringVector: return string.Join(valueSeparator, example.InputString);
[14777]16        default: return string.Empty;
17      }
18    }
19
20    public static string StringifyOutput(ExampleArgumentType type, Example example, string valueSeparator) {
21      switch (type) {
[14898]22        case ExampleArgumentType.Integer: return string.Join(valueSeparator, example.OutputInteger);
23        //case ExampleArgumentType.IntegerVector: return string.Join(valueSeparator, example.OutputIntegerVector);
[14777]24
[14898]25        case ExampleArgumentType.Float: return string.Join(valueSeparator, example.OutputFloat);
26        //case ExampleArgumentType.FloatVector: return string.Join(valueSeparator, example.OutputFloat);
[14777]27
[14875]28        case ExampleArgumentType.Boolean: return string.Join(valueSeparator, example.OutputBoolean);
[14777]29        case ExampleArgumentType.Char: return string.Join(valueSeparator, example.OutputChar);
30
[14898]31        case ExampleArgumentType.String: return string.Join(valueSeparator, example.OutputString);
32        //case ExampleArgumentType.StringVector: return string.Join(valueSeparator, example.OutputString);
[14777]33        default: return string.Empty;
34      }
35    }
36
37    private const string IntegerColumnHeader = "int";
38    private const string IntegersColumnHeader = "int[]";
[14834]39    private const string DoubleColumnHeader = "float";
40    private const string DoublesColumnHeader = "float[]";
[14777]41    private const string BooleanColumnHeader = "bool";
42    private const string CharColumnHeader = "char";
43    private const string StringColumnHeader = "string";
44    private const string StringsColumnHeader = "string[]";
45    public static string GetHeaderTypeName(ExampleArgumentType type) {
46      switch (type) {
47        case ExampleArgumentType.Integer: return IntegerColumnHeader;
48        case ExampleArgumentType.Float: return DoubleColumnHeader;
[14875]49        case ExampleArgumentType.Boolean: return BooleanColumnHeader;
[14777]50        case ExampleArgumentType.Char: return CharColumnHeader;
51        case ExampleArgumentType.String: return StringColumnHeader;
[14875]52        case ExampleArgumentType.IntegerVector: return IntegersColumnHeader;
53        case ExampleArgumentType.FloatVector: return DoublesColumnHeader;
54        case ExampleArgumentType.StringVector: return StringsColumnHeader;
[14777]55        default: return string.Empty;
56      }
57    }
58  }
59}
Note: See TracBrowser for help on using the repository browser.