Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/02/16 14:03:54 (8 years ago)
Author:
gkronber
Message:

#2589: merged r13695 from trunk to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Data/3.3

  • stable/HeuristicLab.Data/3.3/StringArray.cs

    r12009 r13979  
    6161    public virtual int Length {
    6262      get { return array.Length; }
    63       protected set {
     63      set {
    6464        if (ReadOnly) throw new NotSupportedException("Length cannot be set. StringArray is read-only.");
    6565        if (value != Length) {
     
    7272      }
    7373    }
     74    [Storable]
     75    protected bool resizable = true;
     76    public bool Resizable {
     77      get { return resizable; }
     78      set {
     79        if (resizable != value) {
     80          resizable = value;
     81          OnResizableChanged();
     82        }
     83      }
     84    }
     85
    7486    public virtual string this[int index] {
    7587      get { return array[index]; }
     
    102114      this.array = (string[])original.array.Clone();
    103115      this.readOnly = original.readOnly;
     116      this.resizable = original.resizable;
    104117      this.elementNames = new List<string>(original.elementNames);
    105118    }
     
    107120      array = new string[0];
    108121      readOnly = false;
     122      resizable = true;
    109123      elementNames = new List<string>();
    110124    }
     
    114128        array[i] = string.Empty;
    115129      readOnly = false;
     130      resizable = true;
    116131      elementNames = new List<string>();
    117132    }
     
    122137        array[i] = elements[i] == null ? string.Empty : elements[i];
    123138      readOnly = false;
     139      resizable = true;
    124140      elementNames = new List<string>();
    125141    }
     
    133149      readOnlyStringArray.readOnly = true;
    134150      return readOnlyStringArray;
     151    }
     152    IValueTypeArray IValueTypeArray.AsReadOnly() {
     153      return AsReadOnly();
    135154    }
    136155
     
    155174      return array.Cast<string>().GetEnumerator();
    156175    }
    157 
    158176    IEnumerator IEnumerable.GetEnumerator() {
    159177      return GetEnumerator();
     
    181199    }
    182200
     201    public event EventHandler ResizableChanged;
     202    protected virtual void OnResizableChanged() {
     203      EventHandler handler = ResizableChanged;
     204      if (handler != null)
     205        handler(this, EventArgs.Empty);
     206    }
    183207    public event EventHandler ElementNamesChanged;
    184208    protected virtual void OnElementNamesChanged() {
     
    187211        handler(this, EventArgs.Empty);
    188212    }
    189 
    190213    public event EventHandler<EventArgs<int>> ItemChanged;
    191214    protected virtual void OnItemChanged(int index) {
     
    203226
    204227    #region IStringConvertibleArray Members
    205     int IStringConvertibleArray.Length {
    206       get { return Length; }
    207       set { Length = value; }
    208     }
    209228    bool IStringConvertibleArray.Validate(string value, out string errorMessage) {
    210229      return Validate(value, out errorMessage);
Note: See TracChangeset for help on using the changeset viewer.