Last change
on this file since 18055 was
18055,
checked in by dpiringe, 3 years ago
|
#3026
- added StorableTypeAttribute and StorableConstructorAttribute to all JsonItems
- added a new JsonItem ListJsonItem + Interfaces IListJsonItem
- renamed SymRegPythonProcessor to RunCollectionSRSolutionPythonFormatter
- removed Interface IResultCollectionProcessor -> using the interface IRunCollectionModifier now (has aleady implementations)
- renamed all related variables/fields/properties with a connection to ResultCollectionProcessor
- added new implementations for IRunCollectionModifier
|
File size:
1008 bytes
|
Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 | using System.Linq;
|
---|
3 | using HEAL.Attic;
|
---|
4 |
|
---|
5 | namespace HeuristicLab.JsonInterface {
|
---|
6 | [StorableType("4B3B7E23-4317-4804-BB51-88ABFD58CD03")]
|
---|
7 | public abstract class ConcreteRestrictedValueJsonItem<T> : ValueJsonItem<T>, IConcreteRestrictedJsonItem<T> {
|
---|
8 |
|
---|
9 | public IEnumerable<T> ConcreteRestrictedItems { get; set; }
|
---|
10 |
|
---|
11 | protected override ValidationResult Validate() {
|
---|
12 | if (ConcreteRestrictedItems == null) return ValidationResult.Successful();
|
---|
13 | foreach (var x in ConcreteRestrictedItems)
|
---|
14 | if (Value.Equals(x)) return ValidationResult.Successful();
|
---|
15 | return ValidationResult.Faulty(
|
---|
16 | $"[{Path}]: Value {Value} is not one of the allowed values: " +
|
---|
17 | $"'{ string.Join(",", ConcreteRestrictedItems.Select(s => s.ToString()).ToArray()) }'.");
|
---|
18 | }
|
---|
19 |
|
---|
20 | public ConcreteRestrictedValueJsonItem() { }
|
---|
21 |
|
---|
22 | [StorableConstructor]
|
---|
23 | protected ConcreteRestrictedValueJsonItem(StorableConstructorFlag _) : base(_) { }
|
---|
24 | }
|
---|
25 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.