using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HeuristicLab.JsonInterface {
///
/// Base Class for ResultFormatter
///
public abstract class ResultFormatter : IResultFormatter {
public abstract int Priority { get; }
public abstract bool CanFormatType(Type t);
public abstract string Format(object o);
///
/// static property to get all existing result formatters
///
public static IEnumerable All { get; } =
PluginInfrastructure.ApplicationManager.Manager.GetInstances();
///
/// static method to get all existing result formatters for a specific type
///
/// target type
/// collection of found result formatters or null if none was found
public static IEnumerable ForType(Type t) =>
All?.Where(x => x.CanFormatType(t)).OrderBy(x => x.Priority);
}
}