Last change
on this file since 17464 was
17451,
checked in by dpiringe, 4 years ago
|
#3026:
- renamed ResultItem to ResultJsonItem
- implemented RegressionProblemDataConverter
- added support for "named matrices" (named = rows and columns have names) -> INamedMatrixJsonItem incl. base classes and views
- added a bool property Active in IJsonItem -> marks items, which should be written into the template
|
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 | using Newtonsoft.Json.Linq;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.JsonInterface {
|
---|
9 | public class NamedMatrixJsonItemBase<T> : MatrixJsonItemBase<T>, INamedMatrixJsonItem {
|
---|
10 | IList<string> rows = new List<string>();
|
---|
11 | public IEnumerable<string> RowNames {
|
---|
12 | get => rows;
|
---|
13 | set => rows = new List<string>(value);
|
---|
14 | }
|
---|
15 |
|
---|
16 | IList<string> cols = new List<string>();
|
---|
17 | public IEnumerable<string> ColumnNames {
|
---|
18 | get => cols;
|
---|
19 | set => cols = new List<string>(value);
|
---|
20 | }
|
---|
21 |
|
---|
22 | public void AddColumn(string col) {
|
---|
23 | cols.Add(col);
|
---|
24 | }
|
---|
25 |
|
---|
26 | public void AddRow(string row) {
|
---|
27 | rows.Add(row);
|
---|
28 | }
|
---|
29 |
|
---|
30 | public override void SetFromJObject(JObject jObject) {
|
---|
31 | base.SetFromJObject(jObject);
|
---|
32 | RowNames = jObject[nameof(INamedMatrixJsonItem.RowNames)]?.ToObject<IEnumerable<string>>();
|
---|
33 | ColumnNames = jObject[nameof(INamedMatrixJsonItem.ColumnNames)]?.ToObject<IEnumerable<string>>();
|
---|
34 | }
|
---|
35 | }
|
---|
36 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.