[15771] | 1 | using System.Collections.Generic;
|
---|
| 2 | using HeuristicLab.Common;
|
---|
| 3 | using HeuristicLab.Core;
|
---|
| 4 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; |
---|
| 5 | |
---|
| 6 | namespace HeuristicLab.Problems.ProgramSynthesis { |
---|
[14875] | 7 | [StorableClass]
|
---|
[14952] | 8 | public class ErcOptions : NamedItem, IReadOnlyErcOptions {
|
---|
[14875] | 9 |
|
---|
| 10 | public ErcOptions() {
|
---|
| 11 | Name = "ERC Options";
|
---|
| 12 |
|
---|
[14952] | 13 | ErcProbability = 0d;
|
---|
| 14 | IntegerErcOptions = new IntegerErcOptions();
|
---|
| 15 | FloatErcOptions = new FloatErcOptions();
|
---|
| 16 | BooleanErcOptions = new BooleanErcOptions();
|
---|
| 17 | CharErcOptions = new CharErcOptions();
|
---|
| 18 | StringErcOptions = new StringErcOptions();
|
---|
| 19 | NameErcOptions = new NameErcOptions();
|
---|
| 20 | IntegerVectorErcOptions = new IntegerVectorErcOptions();
|
---|
| 21 | StringVectorErcOptions = new StringVectorErcOptions();
|
---|
| 22 | FloatVectorErcOptions = new FloatVectorErcOptions();
|
---|
[14875] | 23 | }
|
---|
| 24 |
|
---|
| 25 | [StorableConstructor]
|
---|
[14906] | 26 | protected ErcOptions(bool deserializing)
|
---|
| 27 | : base(deserializing) {
|
---|
| 28 | }
|
---|
[14875] | 29 |
|
---|
[14905] | 30 | public ErcOptions(ErcOptions origin, Cloner cloner)
|
---|
| 31 | : base(origin, cloner) {
|
---|
[14952] | 32 | ErcProbability = origin.ErcProbability;
|
---|
| 33 | IntegerErcOptions = cloner.Clone(origin.IntegerErcOptions);
|
---|
| 34 | FloatErcOptions = cloner.Clone(origin.FloatErcOptions);
|
---|
| 35 | BooleanErcOptions = cloner.Clone(origin.BooleanErcOptions);
|
---|
| 36 | CharErcOptions = cloner.Clone(origin.CharErcOptions);
|
---|
| 37 | StringErcOptions = cloner.Clone(origin.StringErcOptions);
|
---|
| 38 | NameErcOptions = cloner.Clone(origin.NameErcOptions);
|
---|
| 39 | IntegerVectorErcOptions = cloner.Clone(origin.IntegerVectorErcOptions);
|
---|
| 40 | StringVectorErcOptions = cloner.Clone(origin.StringVectorErcOptions);
|
---|
| 41 | FloatVectorErcOptions = cloner.Clone(origin.FloatVectorErcOptions);
|
---|
[14905] | 42 | }
|
---|
| 43 |
|
---|
[14952] | 44 | [Storable]
|
---|
| 45 | public double ErcProbability { get; set; }
|
---|
[14875] | 46 |
|
---|
| 47 |
|
---|
[14952] | 48 | [Storable]
|
---|
| 49 | public IntegerErcOptions IntegerErcOptions { get; set; }
|
---|
| 50 | [Storable]
|
---|
| 51 | public FloatErcOptions FloatErcOptions { get; set; }
|
---|
[14875] | 52 |
|
---|
| 53 | /// <summary>
|
---|
[14906] | 54 | /// Integer represents ASCII value
|
---|
[14875] | 55 | /// </summary>
|
---|
[14952] | 56 | [Storable]
|
---|
| 57 | public CharErcOptions CharErcOptions { get; set; }
|
---|
| 58 | [Storable]
|
---|
| 59 | public BooleanErcOptions BooleanErcOptions { get; set; }
|
---|
| 60 | [Storable]
|
---|
| 61 | public StringErcOptions StringErcOptions { get; set; }
|
---|
| 62 | [Storable]
|
---|
| 63 | public NameErcOptions NameErcOptions { get; set; }
|
---|
| 64 | [Storable]
|
---|
| 65 | public IntegerVectorErcOptions IntegerVectorErcOptions { get; set; }
|
---|
| 66 | [Storable]
|
---|
| 67 | public StringVectorErcOptions StringVectorErcOptions { get; set; }
|
---|
| 68 | [Storable]
|
---|
| 69 | public FloatVectorErcOptions FloatVectorErcOptions { get; set; }
|
---|
[14875] | 70 |
|
---|
[15771] | 71 | IErcItem<int> IReadOnlyErcOptions.IntegerErcOptions {
|
---|
| 72 | get {
|
---|
[14906] | 73 | return IntegerErcOptions;
|
---|
| 74 | }
|
---|
| 75 | }
|
---|
| 76 |
|
---|
[15771] | 77 | IErcItem<double> IReadOnlyErcOptions.FloatErcOptions {
|
---|
| 78 | get {
|
---|
[14906] | 79 | return FloatErcOptions;
|
---|
| 80 | }
|
---|
| 81 | }
|
---|
| 82 |
|
---|
[15771] | 83 | IErcItem<bool> IReadOnlyErcOptions.BooleanErcOptions {
|
---|
| 84 | get {
|
---|
[14906] | 85 | return BooleanErcOptions;
|
---|
| 86 | }
|
---|
| 87 | }
|
---|
| 88 |
|
---|
[15771] | 89 | IErcItem<char> IReadOnlyErcOptions.CharErcOptions {
|
---|
| 90 | get {
|
---|
[14906] | 91 | return CharErcOptions;
|
---|
| 92 | }
|
---|
| 93 | }
|
---|
| 94 |
|
---|
[15771] | 95 | IErcItem<string> IReadOnlyErcOptions.StringErcOptions {
|
---|
| 96 | get {
|
---|
[14906] | 97 | return StringErcOptions;
|
---|
| 98 | }
|
---|
| 99 | }
|
---|
| 100 |
|
---|
[15771] | 101 | IErcItem<string> IReadOnlyErcOptions.NameErcOptions {
|
---|
| 102 | get {
|
---|
[14906] | 103 | return NameErcOptions;
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
[15771] | 107 | IErcItem<IReadOnlyList<int>> IReadOnlyErcOptions.IntegerVectorErcOptions {
|
---|
| 108 | get {
|
---|
[14906] | 109 | return IntegerVectorErcOptions;
|
---|
| 110 | }
|
---|
| 111 | }
|
---|
| 112 |
|
---|
[15771] | 113 | IErcItem<IReadOnlyList<double>> IReadOnlyErcOptions.FloatVectorErcOptions {
|
---|
| 114 | get {
|
---|
[14906] | 115 | return FloatVectorErcOptions;
|
---|
| 116 | }
|
---|
| 117 | }
|
---|
| 118 |
|
---|
[15771] | 119 | IErcItem<IReadOnlyList<string>> IReadOnlyErcOptions.StringVectorErcOptions {
|
---|
| 120 | get {
|
---|
[14906] | 121 | return StringVectorErcOptions;
|
---|
| 122 | }
|
---|
| 123 | }
|
---|
| 124 |
|
---|
[14875] | 125 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 126 | return new ErcOptions(this, cloner);
|
---|
| 127 | }
|
---|
[14905] | 128 |
|
---|
| 129 | public void DisableAllOptions() {
|
---|
| 130 | SetOptionsState(false);
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | public void EnableAllOptions() {
|
---|
| 134 | SetOptionsState(true);
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | public void SetOptionsState(bool state) {
|
---|
[14952] | 138 | IntegerErcOptions.IsEnabled = state;
|
---|
| 139 | FloatErcOptions.IsEnabled = state;
|
---|
| 140 | CharErcOptions.IsEnabled = state;
|
---|
| 141 | BooleanErcOptions.IsEnabled = state;
|
---|
| 142 | StringErcOptions.IsEnabled = state;
|
---|
| 143 | NameErcOptions.IsEnabled = state;
|
---|
| 144 | IntegerVectorErcOptions.IsEnabled = state;
|
---|
| 145 | FloatVectorErcOptions.IsEnabled = state;
|
---|
| 146 | StringVectorErcOptions.IsEnabled = state;
|
---|
[14905] | 147 | }
|
---|
[14875] | 148 | }
|
---|
[14906] | 149 | } |
---|