Ignore:
Timestamp:
04/29/13 11:36:00 (6 years ago)
Author:
sforsten
Message:

#2018: renamed "column" to "element" in array types

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/StringArray.cs

    r9308 r9401  
    4242
    4343    [Storable]
    44     protected List<string> columnNames;
    45     public virtual IEnumerable<string> ColumnNames {
    46       get { return this.columnNames; }
     44    protected List<string> elementNames;
     45    public virtual IEnumerable<string> ElementNames {
     46      get { return this.elementNames; }
    4747      set {
    48         if (ReadOnly) throw new NotSupportedException("ColumnNames cannot be set. ValueTypeArray is read-only.");
     48        if (ReadOnly) throw new NotSupportedException("ElementNames cannot be set. ValueTypeArray is read-only.");
    4949        if (value == null || value.Count() == 0)
    50           columnNames = new List<string>();
     50          elementNames = new List<string>();
    5151        else if (value.Count() != Length)
    52           throw new ArgumentException("A column name must be specified for each column.");
     52          throw new ArgumentException("An element name must be specified for each element.");
    5353        else
    54           columnNames = new List<string>(value);
    55         OnColumnNamesChanged();
     54          elementNames = new List<string>(value);
     55        OnElementNamesChanged();
    5656      }
    5757    }
     
    6363        if (value != Length) {
    6464          Array.Resize<string>(ref array, value);
    65           while (columnNames.Count > value)
    66             columnNames.RemoveAt(columnNames.Count - 1);
    67           while (columnNames.Count < value)
    68             columnNames.Add("Column " + columnNames.Count);
    69           OnColumnNamesChanged();
     65          while (elementNames.Count > value)
     66            elementNames.RemoveAt(elementNames.Count - 1);
     67          while (elementNames.Count < value)
     68            elementNames.Add("Element " + elementNames.Count);
     69          OnElementNamesChanged();
    7070          OnReset();
    7171        }
     
    9393    [StorableHook(HookType.AfterDeserialization)]
    9494    private void AfterDeserialization() {
    95       if (columnNames == null) {
    96         columnNames = new List<string>(array.Length);
    97         while (columnNames.Count < array.Length)
    98           columnNames.Add("Column " + columnNames.Count);
     95      if (elementNames == null) {
     96        elementNames = new List<string>(array.Length);
     97        while (elementNames.Count < array.Length)
     98          elementNames.Add("Element " + elementNames.Count);
    9999      }
    100100    }
     
    105105      : base(original, cloner) {
    106106      this.array = (string[])original.array.Clone();
    107       this.columnNames = new List<string>(original.columnNames);
     107      this.elementNames = new List<string>(original.elementNames);
    108108      this.readOnly = original.readOnly;
    109109    }
    110110    public StringArray() {
    111111      array = new string[0];
    112       columnNames = new List<string>();
     112      elementNames = new List<string>();
    113113      readOnly = false;
    114114    }
     
    117117      for (int i = 0; i < array.Length; i++)
    118118        array[i] = string.Empty;
    119       columnNames = new List<string>();
     119      elementNames = new List<string>();
    120120      readOnly = false;
    121121    }
     
    125125      for (int i = 0; i < array.Length; i++)
    126126        array[i] = elements[i] == null ? string.Empty : elements[i];
    127       columnNames = new List<string>();
     127      elementNames = new List<string>();
    128128      readOnly = false;
    129129    }
     
    194194    }
    195195
    196     public event EventHandler ColumnNamesChanged;
    197     protected virtual void OnColumnNamesChanged() {
    198       EventHandler handler = ColumnNamesChanged;
     196    public event EventHandler ElementNamesChanged;
     197    protected virtual void OnElementNamesChanged() {
     198      EventHandler handler = ElementNamesChanged;
    199199      if (handler != null)
    200200        handler(this, EventArgs.Empty);
Note: See TracChangeset for help on using the changeset viewer.