Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.Data/3.3/StringConvertibleArray.cs @ 17712

Last change on this file since 17712 was 17181, checked in by swagner, 5 years ago

#2875: Merged r17180 from trunk to stable

File size: 2.2 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 HeuristicLab.Common;
25using HeuristicLab.Core;
26using HEAL.Attic;
27
28namespace HeuristicLab.Data {
29  [Item("StringConvertibleArray", "Represents an array of string convertible values.")]
30  [StorableType("68FCA40B-4ACF-4D7A-B4FA-67DBA481125E")]
31  public abstract class StringConvertibleArray<T> : ValueTypeArray<T>, IStringConvertibleArray where T : struct {
32    [StorableConstructor]
33    protected StringConvertibleArray(StorableConstructorFlag _) : base(_) { }
34    protected StringConvertibleArray(StringConvertibleArray<T> original, Cloner cloner)
35      : base(original, cloner) { }
36
37    protected StringConvertibleArray() : base() { }
38    protected StringConvertibleArray(int length) : base(length) { }
39    protected StringConvertibleArray(T[] elements) : base(elements) { }
40
41    protected abstract bool Validate(string value, out string errorMessage);
42    protected abstract string GetValue(int index);
43    protected abstract bool SetValue(string value, int index);
44
45    #region IStringConvertibleArray Members
46    bool IStringConvertibleArray.Validate(string value, out string errorMessage) {
47      return Validate(value, out errorMessage);
48    }
49    string IStringConvertibleArray.GetValue(int index) {
50      return GetValue(index);
51    }
52    bool IStringConvertibleArray.SetValue(string value, int index) {
53      return SetValue(value, index);
54    }
55    #endregion
56  }
57}
Note: See TracBrowser for help on using the repository browser.