Changeset 9401


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

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

Location:
branches/ImprovingStringConvertibleMatrix
Files:
4 edited

Legend:

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

    r9308 r9401  
    5353
    5454    protected override void DeregisterContentEvents() {
    55       Content.ColumnNamesChanged -= new EventHandler(Content_ColumnNamesChanged);
     55      Content.ElementNamesChanged -= new EventHandler(Content_ElementNamesChanged);
    5656      Content.Reset -= new EventHandler(Content_Reset);
    5757      Content.ItemsChanged -= new EventHandler<ArrayValuesChangedEventArgs>(Content_ItemsChanged);
     
    6363      Content.ItemsChanged += new EventHandler<ArrayValuesChangedEventArgs>(Content_ItemsChanged);
    6464      Content.Reset += new EventHandler(Content_Reset);
    65       Content.ColumnNamesChanged -= new EventHandler(Content_ColumnNamesChanged);
     65      Content.ElementNamesChanged -= new EventHandler(Content_ElementNamesChanged);
    6666    }
    6767
     
    106106    protected virtual void UpdateRowHeaders() {
    107107      for (int i = 0; i < dataGridView.RowCount; i++) {
    108         if (i < Content.ColumnNames.Count())
    109           dataGridView.Rows[i].HeaderCell.Value = Content.ColumnNames.ElementAt(i);
     108        if (i < Content.ElementNames.Count())
     109          dataGridView.Rows[i].HeaderCell.Value = Content.ElementNames.ElementAt(i);
    110110        else
    111           dataGridView.Rows[i].HeaderCell.Value = "Column " + (i + 1);
     111          dataGridView.Rows[i].HeaderCell.Value = "Element " + (i + 1);
    112112      }
    113113    }
     
    124124      }
    125125    }
    126     private void Content_ColumnNamesChanged(object sender, EventArgs e) {
     126    private void Content_ElementNamesChanged(object sender, EventArgs e) {
    127127      if (InvokeRequired)
    128         Invoke(new EventHandler(Content_ColumnNamesChanged), sender, e);
     128        Invoke(new EventHandler(Content_ElementNamesChanged), sender, e);
    129129      else
    130130        UpdateRowHeaders();
  • branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/Interfaces/IStringConvertibleArray.cs

    r9308 r9401  
    2727  public interface IStringConvertibleArray : IContent {
    2828    int Length { get; set; }
    29     IEnumerable<string> ColumnNames { get; set; }
     29    IEnumerable<string> ElementNames { get; set; }
    3030
    3131    bool ReadOnly { get; }
     
    3737    bool SetValues(IEnumerable<ArrayValue<string>> arrayValues);
    3838
    39     event EventHandler ColumnNamesChanged;
     39    event EventHandler ElementNamesChanged;
    4040    event EventHandler<ArrayValuesChangedEventArgs> ItemsChanged;
    4141    event EventHandler Reset;
  • 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);
  • branches/ImprovingStringConvertibleMatrix/HeuristicLab.Data/3.3/ValueTypeArray.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    }
     
    6565        if (value != Length) {
    6666          Array.Resize<T>(ref array, value);
    67           while (columnNames.Count > value)
    68             columnNames.RemoveAt(columnNames.Count - 1);
    69           while (columnNames.Count < value)
    70             columnNames.Add("Column " + columnNames.Count);
    71           OnColumnNamesChanged();
     67          while (elementNames.Count > value)
     68            elementNames.RemoveAt(elementNames.Count - 1);
     69          while (elementNames.Count < value)
     70            elementNames.Add("Element " + elementNames.Count);
     71          OnElementNamesChanged();
    7272          OnReset();
    7373        }
     
    106106    [StorableHook(HookType.AfterDeserialization)]
    107107    private void AfterDeserialization() {
    108       if (columnNames == null) {
    109         columnNames = new List<string>(array.Length);
    110         while (columnNames.Count < array.Length)
    111           columnNames.Add("Column " + columnNames.Count);
     108      if (elementNames == null) {
     109        elementNames = new List<string>(array.Length);
     110        while (elementNames.Count < array.Length)
     111          elementNames.Add("Element " + elementNames.Count);
    112112      }
    113113    }
     
    118118      : base(original, cloner) {
    119119      this.array = (T[])original.array.Clone();
    120       this.columnNames = new List<string>(original.columnNames);
     120      this.elementNames = new List<string>(original.elementNames);
    121121      this.readOnly = original.readOnly;
    122122    }
    123123    protected ValueTypeArray() {
    124124      array = new T[0];
    125       columnNames = new List<string>();
     125      elementNames = new List<string>();
    126126      readOnly = false;
    127127    }
    128128    protected ValueTypeArray(int length) {
    129129      array = new T[length];
    130       columnNames = new List<string>(length);
     130      elementNames = new List<string>(length);
    131131      readOnly = false;
    132132    }
     
    134134      if (elements == null) throw new ArgumentNullException();
    135135      array = (T[])elements.Clone();
    136       columnNames = new List<string>(elements.Length);
     136      elementNames = new List<string>(elements.Length);
    137137      readOnly = false;
    138138    }
     
    164164    }
    165165
    166     public event EventHandler ColumnNamesChanged;
    167     protected virtual void OnColumnNamesChanged() {
    168       EventHandler handler = ColumnNamesChanged;
     166    public event EventHandler ElementNamesChanged;
     167    protected virtual void OnElementNamesChanged() {
     168      EventHandler handler = ElementNamesChanged;
    169169      if (handler != null)
    170170        handler(this, EventArgs.Empty);
Note: See TracChangeset for help on using the changeset viewer.