Last change
on this file since 17843 was
17843,
checked in by dpiringe, 3 years ago
|
#3026
- removed property ConvertableType from all converters
- removed the option to fixate or loosen the path of JsonItems (obsolete)
- added a abstract formatter SymbolicRegressionSolutionFormatterBase as base formatter for ISymbolicRegressionSolution
- unified the construction of exporter controls
- code cleanup
|
File size:
1.1 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Linq;
|
---|
4 | using System.Text;
|
---|
5 | using System.Threading.Tasks;
|
---|
6 |
|
---|
7 | namespace HeuristicLab.JsonInterface {
|
---|
8 |
|
---|
9 | /// <summary>
|
---|
10 | /// Base Class for ResultFormatter
|
---|
11 | /// </summary>
|
---|
12 | public abstract class ResultFormatter : IResultFormatter {
|
---|
13 | public abstract int Priority { get; }
|
---|
14 | public abstract bool CanFormatType(Type t);
|
---|
15 | public abstract string Format(object o);
|
---|
16 |
|
---|
17 | /// <summary>
|
---|
18 | /// static property to get all existing result formatters
|
---|
19 | /// </summary>
|
---|
20 | public static IEnumerable<IResultFormatter> All { get; } =
|
---|
21 | PluginInfrastructure.ApplicationManager.Manager.GetInstances<IResultFormatter>();
|
---|
22 |
|
---|
23 | /// <summary>
|
---|
24 | /// static method to get all existing result formatters for a specific type
|
---|
25 | /// </summary>
|
---|
26 | /// <param name="t">target type</param>
|
---|
27 | /// <returns>collection of found result formatters or null if none was found</returns>
|
---|
28 | public static IEnumerable<IResultFormatter> ForType(Type t) =>
|
---|
29 | All?.Where(x => x.CanFormatType(t)).OrderBy(x => x.Priority);
|
---|
30 | }
|
---|
31 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.