Last change
on this file since 17477 was
17477,
checked in by dpiringe, 4 years ago
|
#3026:
- refactored JsonTemplateInstantiator -> now returns a InstantiatorResult which contains the optimizer and an IEnumerable of IResultJsonItem
- code cleanup in JCGenerator
- relocated the serialization of json items into IJsonItem with method GenerateJObject (virtual base implementation in JsonItem)
- this allows custom serialization for json items (example: ValueLookupJsonItem)
- items of interface IIntervalRestrictedJsonItem have a custom implementation of GenerateJObject -> hides Minimum and Maximum if the values are the physically min/max of their type
- code cleanup in BaseConverter
|
File size:
1.2 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 abstract class MatrixJsonItem<T> : ValueJsonItem<T[][]>, IMatrixJsonItem {
|
---|
10 | public virtual bool RowsResizable { get; set; }
|
---|
11 | public virtual bool ColumnsResizable { get; set; }
|
---|
12 |
|
---|
13 | IList<string> rows = new List<string>();
|
---|
14 | public IEnumerable<string> RowNames {
|
---|
15 | get => rows;
|
---|
16 | set => rows = new List<string>(value);
|
---|
17 | }
|
---|
18 |
|
---|
19 | IList<string> cols = new List<string>();
|
---|
20 | public IEnumerable<string> ColumnNames {
|
---|
21 | get => cols;
|
---|
22 | set => cols = new List<string>(value);
|
---|
23 | }
|
---|
24 |
|
---|
25 | public override void SetJObject(JObject jObject) {
|
---|
26 | base.SetJObject(jObject);
|
---|
27 | RowsResizable = (jObject[nameof(IMatrixJsonItem.RowsResizable)]?.ToObject<bool>()).GetValueOrDefault();
|
---|
28 | ColumnsResizable = (jObject[nameof(IMatrixJsonItem.ColumnsResizable)]?.ToObject<bool>()).GetValueOrDefault();
|
---|
29 | RowNames = jObject[nameof(IMatrixJsonItem.RowNames)]?.ToObject<IEnumerable<string>>();
|
---|
30 | ColumnNames = jObject[nameof(IMatrixJsonItem.ColumnNames)]?.ToObject<IEnumerable<string>>();
|
---|
31 | }
|
---|
32 | }
|
---|
33 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.