using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json.Linq; namespace HeuristicLab.JsonInterface { public class NamedMatrixJsonItemBase : MatrixJsonItemBase, INamedMatrixJsonItem { IList rows = new List(); public IEnumerable RowNames { get => rows; set => rows = new List(value); } IList cols = new List(); public IEnumerable ColumnNames { get => cols; set => cols = new List(value); } public void AddColumn(string col) { cols.Add(col); } public void AddRow(string row) { rows.Add(row); } public override void SetFromJObject(JObject jObject) { base.SetFromJObject(jObject); RowNames = jObject[nameof(INamedMatrixJsonItem.RowNames)]?.ToObject>(); ColumnNames = jObject[nameof(INamedMatrixJsonItem.ColumnNames)]?.ToObject>(); } } }