Last change
on this file since 17530 was
17519,
checked in by dpiringe, 5 years ago
|
#3026:
- added error output for failed runner initialization
- reorganised some final view models
- TargetedJsonItemType (in JsonItemVMBase) now automatically returns the type of the defined JsonItem
- code cleanup
- refactored RegressionProblemDataConverter
- added lots of comments
- added new view for StringArrayJsonItem
- added new UI component for concrete restricted items and used it in JsonItemConcreteItemArrayControl and JsonItemValidValuesControl
|
File size:
1.0 KB
|
Rev | Line | |
---|
[17519] | 1 | using System.Collections.Generic;
|
---|
[17477] | 2 | using Newtonsoft.Json.Linq;
|
---|
[17471] | 3 |
|
---|
| 4 | namespace HeuristicLab.JsonInterface {
|
---|
| 5 | public class ValueLookupJsonItem : LookupJsonItem, IValueLookupJsonItem {
|
---|
[17477] | 6 | public IJsonItem ActualValue { get; set; }
|
---|
[17473] | 7 |
|
---|
[17481] | 8 | protected override ValidationResult Validate() {
|
---|
| 9 | if (ActualValue == null) return ValidationResult.Successful();
|
---|
| 10 | return ActualValue.GetValidator().Validate();
|
---|
[17473] | 11 | }
|
---|
[17477] | 12 |
|
---|
| 13 | public override JObject GenerateJObject() {
|
---|
| 14 | var obj = base.GenerateJObject();
|
---|
| 15 | if(ActualValue != null) {
|
---|
[17483] | 16 | obj.Add(nameof(IValueLookupJsonItem.ActualValue), ActualValue.Path);
|
---|
[17477] | 17 | }
|
---|
| 18 | return obj;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | public override IEnumerator<IJsonItem> GetEnumerator() {
|
---|
| 22 | using (var it = base.GetEnumerator()) {
|
---|
| 23 | while(it.MoveNext()) {
|
---|
| 24 | yield return it.Current;
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
| 27 | if(ActualValue != null) {
|
---|
| 28 | using (var it = ActualValue.GetEnumerator()) {
|
---|
| 29 | while (it.MoveNext()) {
|
---|
| 30 | yield return it.Current;
|
---|
| 31 | }
|
---|
| 32 | }
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
[17471] | 35 | }
|
---|
| 36 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.