Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/StringConvertibleArray.cs @ 17309

Last change on this file since 17309 was 17309, checked in by abeham, 5 years ago

#2521: Refactored maximization property for multi-objective problems

File size: 2.4 KB
Line 
1#region License Information
2
3/* HeuristicLab
4 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
5 *
6 * This file is part of HeuristicLab.
7 *
8 * HeuristicLab is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * HeuristicLab is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#endregion
23
24using System.Collections.Generic;
25using HEAL.Attic;
26using HeuristicLab.Common;
27using HeuristicLab.Core;
28
29namespace HeuristicLab.Data {
30  [Item("StringConvertibleArray", "Represents an array of string convertible values.")]
31  [StorableType("68FCA40B-4ACF-4D7A-B4FA-67DBA481125E")]
32  public abstract class StringConvertibleArray<T> : ValueTypeArray<T>, IStringConvertibleArray where T : struct {
33    [StorableConstructor]
34    protected StringConvertibleArray(StorableConstructorFlag _) : base(_) { }
35    protected StringConvertibleArray(StringConvertibleArray<T> original, Cloner cloner)
36      : base(original, cloner) { }
37
38    protected StringConvertibleArray() : base() { }
39    protected StringConvertibleArray(int length) : base(length) { }
40    protected StringConvertibleArray(T[] elements, bool @readonly = false) : base(elements, @readonly) { }
41    protected StringConvertibleArray(IReadOnlyList<T> elements) : base(elements) { }
42
43    protected abstract bool Validate(string value, out string errorMessage);
44    protected abstract string GetValue(int index);
45    protected abstract bool SetValue(string value, int index);
46
47    #region IStringConvertibleArray Members
48    bool IStringConvertibleArray.Validate(string value, out string errorMessage) {
49      return Validate(value, out errorMessage);
50    }
51    string IStringConvertibleArray.GetValue(int index) {
52      return GetValue(index);
53    }
54    bool IStringConvertibleArray.SetValue(string value, int index) {
55      return SetValue(value, index);
56    }
57    #endregion
58  }
59}
Note: See TracBrowser for help on using the repository browser.