1 | namespace HeuristicLab.Problems.ProgramSynthesis.Base.Erc {
|
---|
2 | using System.Collections.Generic;
|
---|
3 |
|
---|
4 | using Boolean;
|
---|
5 | using Char;
|
---|
6 | using Common;
|
---|
7 | using Core;
|
---|
8 | using Data;
|
---|
9 | using Float;
|
---|
10 | using FloatVector;
|
---|
11 | using Integer;
|
---|
12 | using IntegerVector;
|
---|
13 | using Parameters;
|
---|
14 | using Persistence.Default.CompositeSerializers.Storable;
|
---|
15 | using String;
|
---|
16 | using StringVector;
|
---|
17 |
|
---|
18 | [StorableClass]
|
---|
19 | public class ErcOptions : ParameterizedNamedItem, IReadOnlyErcOptions {
|
---|
20 | public const string ProbabilityParameterName = "Probability";
|
---|
21 | public const string IntegerParameterName = "Integer";
|
---|
22 | public const string FloatParameterName = "Float";
|
---|
23 | public const string CharParameterName = "Char";
|
---|
24 | public const string BooleanParameterName = "Boolean";
|
---|
25 | public const string StringParameterName = "String";
|
---|
26 | public const string NameParameterName = "Name";
|
---|
27 | public const string IntegerVectorParameterName = "IntegerVector";
|
---|
28 | public const string FloatVectorParameterName = "FloatVector";
|
---|
29 | public const string StringVectorParameterName = "StringVector";
|
---|
30 |
|
---|
31 | public ErcOptions() {
|
---|
32 | Name = "ERC Options";
|
---|
33 |
|
---|
34 | Parameters.Add(new FixedValueParameter<PercentValue>(ProbabilityParameterName));
|
---|
35 | Parameters.Add(new ValueParameter<IntegerErcOptions>(IntegerParameterName));
|
---|
36 | Parameters.Add(new ValueParameter<FloatErcOptions>(FloatParameterName));
|
---|
37 | Parameters.Add(new ValueParameter<BooleanErcOptions>(BooleanParameterName));
|
---|
38 | Parameters.Add(new ValueParameter<StringErcOptions>(StringParameterName));
|
---|
39 | Parameters.Add(new ValueParameter<CharErcOptions>(CharParameterName));
|
---|
40 | Parameters.Add(new ValueParameter<StringErcOptions>(NameParameterName));
|
---|
41 | Parameters.Add(new ValueParameter<IntegerVectorErcOptions>(IntegerVectorParameterName));
|
---|
42 | Parameters.Add(new ValueParameter<FloatVectorErcOptions>(FloatVectorParameterName));
|
---|
43 | Parameters.Add(new ValueParameter<StringVectorErcOptions>(StringVectorParameterName));
|
---|
44 | }
|
---|
45 |
|
---|
46 | [StorableConstructor]
|
---|
47 | public ErcOptions(bool deserializing) : base(deserializing) { }
|
---|
48 |
|
---|
49 | public ErcOptions(ErcOptions origin, Cloner cloner) : base(origin, cloner) { }
|
---|
50 |
|
---|
51 | public IValueParameter<PercentValue> ErcProbabilityParameter
|
---|
52 | {
|
---|
53 | get { return (IValueParameter<PercentValue>)Parameters[ProbabilityParameterName]; }
|
---|
54 | }
|
---|
55 |
|
---|
56 | public double ErcProbability
|
---|
57 | {
|
---|
58 | get { return ErcProbabilityParameter.Value.Value; }
|
---|
59 | set { ErcProbabilityParameter.Value.Value = value; }
|
---|
60 | }
|
---|
61 |
|
---|
62 | IErcValueItem<int> IReadOnlyErcOptions.IntegerErcOptions { get { return IntegerErcOptions; } }
|
---|
63 | IErcValueItem<double> IReadOnlyErcOptions.FloatErcOptions { get { return FloatErcOptions; } }
|
---|
64 | IErcValueItem<bool> IReadOnlyErcOptions.BooleanErcOptions { get { return BooleanErcOptions; } }
|
---|
65 | IErcValueItem<char> IReadOnlyErcOptions.CharErcOptions { get { return CharErcOptions; } }
|
---|
66 | IErcValueItem<string> IReadOnlyErcOptions.StringErcOptions { get { return StringErcOptions; } }
|
---|
67 | IErcValueItem<string> IReadOnlyErcOptions.NameErcOptions { get { return NameErcOptions; } }
|
---|
68 | IErcValueItem<IReadOnlyList<int>> IReadOnlyErcOptions.IntegerVectorErcOptions { get { return IntegerVectorErcOptions; } }
|
---|
69 | IErcValueItem<IReadOnlyList<double>> IReadOnlyErcOptions.FloatVectorErcOptions { get { return FloatVectorErcOptions; } }
|
---|
70 | IErcValueItem<IReadOnlyList<string>> IReadOnlyErcOptions.StringVectorErcOptions { get { return StringVectorErcOptions; } }
|
---|
71 |
|
---|
72 | public IValueParameter<IntegerErcOptions> IntegerErcOptionsParameter
|
---|
73 | {
|
---|
74 | get { return (IValueParameter<IntegerErcOptions>)Parameters[IntegerParameterName]; }
|
---|
75 | }
|
---|
76 |
|
---|
77 | public IntegerErcOptions IntegerErcOptions
|
---|
78 | {
|
---|
79 | get { return this.IntegerErcOptionsParameter.Value; }
|
---|
80 | set { this.IntegerErcOptionsParameter.Value = value; }
|
---|
81 | }
|
---|
82 |
|
---|
83 | public IValueParameter<FloatErcOptions> FloatErcOptionsParameter
|
---|
84 | {
|
---|
85 | get { return (IValueParameter<FloatErcOptions>)Parameters[FloatParameterName]; }
|
---|
86 | }
|
---|
87 |
|
---|
88 | public FloatErcOptions FloatErcOptions
|
---|
89 | {
|
---|
90 | get { return this.FloatErcOptionsParameter.Value; }
|
---|
91 | set { this.FloatErcOptionsParameter.Value = value; }
|
---|
92 | }
|
---|
93 |
|
---|
94 | /// <summary>
|
---|
95 | /// Integer represents ASCII value
|
---|
96 | /// </summary>
|
---|
97 | public IValueParameter<CharErcOptions> CharErcOptionsParameter
|
---|
98 | {
|
---|
99 | get { return (IValueParameter<CharErcOptions>)Parameters[CharParameterName]; }
|
---|
100 | }
|
---|
101 |
|
---|
102 | public CharErcOptions CharErcOptions
|
---|
103 | {
|
---|
104 | get { return CharErcOptionsParameter.Value; }
|
---|
105 | set { CharErcOptionsParameter.Value = value; }
|
---|
106 | }
|
---|
107 |
|
---|
108 | public IValueParameter<BooleanErcOptions> BooleanErcOptionsParameter
|
---|
109 | {
|
---|
110 | get { return (IValueParameter<BooleanErcOptions>)Parameters[BooleanParameterName]; }
|
---|
111 | }
|
---|
112 |
|
---|
113 | public BooleanErcOptions BooleanErcOptions
|
---|
114 | {
|
---|
115 | get { return BooleanErcOptionsParameter.Value; }
|
---|
116 | set { BooleanErcOptionsParameter.Value = value; }
|
---|
117 | }
|
---|
118 |
|
---|
119 | public IValueParameter<StringErcOptions> StringErcOptionsParameter
|
---|
120 | {
|
---|
121 | get { return (IValueParameter<StringErcOptions>)Parameters[StringParameterName]; }
|
---|
122 | }
|
---|
123 |
|
---|
124 | public StringErcOptions StringErcOptions
|
---|
125 | {
|
---|
126 | get { return StringErcOptionsParameter.Value; }
|
---|
127 | set { StringErcOptionsParameter.Value = value; }
|
---|
128 | }
|
---|
129 |
|
---|
130 | public IValueParameter<StringErcOptions> NameParameter
|
---|
131 | {
|
---|
132 | get { return (IValueParameter<StringErcOptions>)Parameters[NameParameterName]; }
|
---|
133 | }
|
---|
134 |
|
---|
135 | public StringErcOptions NameErcOptions
|
---|
136 | {
|
---|
137 | get { return NameParameter.Value; }
|
---|
138 | set { NameParameter.Value = value; }
|
---|
139 | }
|
---|
140 |
|
---|
141 | public IValueParameter<IntegerVectorErcOptions> IntegerVectorParameter
|
---|
142 | {
|
---|
143 | get { return (IValueParameter<IntegerVectorErcOptions>)Parameters[IntegerVectorParameterName]; }
|
---|
144 | }
|
---|
145 |
|
---|
146 | public IntegerVectorErcOptions IntegerVectorErcOptions
|
---|
147 | {
|
---|
148 | get { return IntegerVectorParameter.Value; }
|
---|
149 | set { IntegerVectorParameter.Value = value; }
|
---|
150 | }
|
---|
151 |
|
---|
152 | public IValueParameter<StringVectorErcOptions> StringVectorParameter
|
---|
153 | {
|
---|
154 | get { return (IValueParameter<StringVectorErcOptions>)Parameters[StringVectorParameterName]; }
|
---|
155 | }
|
---|
156 |
|
---|
157 | public StringVectorErcOptions StringVectorErcOptions
|
---|
158 | {
|
---|
159 | get { return StringVectorParameter.Value; }
|
---|
160 | set { StringVectorParameter.Value = value; }
|
---|
161 | }
|
---|
162 |
|
---|
163 | public IValueParameter<FloatVectorErcOptions> FloatVectorParameter
|
---|
164 | {
|
---|
165 | get { return (IValueParameter<FloatVectorErcOptions>)Parameters[FloatVectorParameterName]; }
|
---|
166 | }
|
---|
167 |
|
---|
168 | public FloatVectorErcOptions FloatVectorErcOptions
|
---|
169 | {
|
---|
170 | get { return FloatVectorParameter.Value; }
|
---|
171 | set { FloatVectorParameter.Value = value; }
|
---|
172 | }
|
---|
173 |
|
---|
174 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
175 | return new ErcOptions(this, cloner);
|
---|
176 | }
|
---|
177 | }
|
---|
178 | }
|
---|