Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/09/10 03:57:18 (15 years ago)
Author:
swagner
Message:

Adapted Permutation and renamed IStringConvertibleArrayData.Rows to IStringConvertibleArrayData.Length (#899)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.Permutation/3.3/Permutation.cs

    r2906 r2974  
    3131  [Item("Permutation", "Represents a permutation of integer values.")]
    3232  [Creatable("Test")]
    33   public sealed class Permutation : ValueTypeArrayData<int>, IStringConvertibleMatrixData {
     33  public sealed class Permutation : ValueTypeArrayData<int>, IStringConvertibleArrayData {
    3434    public Permutation() : base() { }
    3535    public Permutation(int length)
     
    8585    }
    8686
    87     #region IStringConvertibleMatrixData Members
    88     StringConvertibleArrayDataDimensions IStringConvertibleMatrixData.Dimensions {
    89       get { return StringConvertibleArrayDataDimensions.Rows; }
    90     }
    91     int IStringConvertibleMatrixData.Rows {
     87    #region IStringConvertibleArrayData Members
     88    int IStringConvertibleArrayData.Length {
    9289      get { return Length; }
    9390      set { Length = value; }
    9491    }
    95     int IStringConvertibleMatrixData.Columns {
    96       get { return 1; }
    97       set { throw new NotSupportedException("The number of columns cannot be changed."); }
    98     }
    9992
    100     bool IStringConvertibleMatrixData.Validate(string value, out string errorMessage) {
     93    bool IStringConvertibleArrayData.Validate(string value, out string errorMessage) {
    10194      int val;
    10295      bool valid = int.TryParse(value, out val);
     
    111104      return valid;
    112105    }
    113     string IStringConvertibleMatrixData.GetValue(int rowIndex, int columIndex) {
    114       return this[rowIndex].ToString();
     106    string IStringConvertibleArrayData.GetValue(int index) {
     107      return this[index].ToString();
    115108    }
    116     bool IStringConvertibleMatrixData.SetValue(string value, int rowIndex, int columnIndex) {
     109    bool IStringConvertibleArrayData.SetValue(string value, int index) {
    117110      int val;
    118111      if (int.TryParse(value, out val)) {
    119         this[rowIndex] = val;
     112        this[index] = val;
    120113        return true;
    121114      } else {
     
    123116      }
    124117    }
    125     event EventHandler<EventArgs<int, int>> IStringConvertibleMatrixData.ItemChanged {
    126       add { base.ItemChanged += value; }
    127       remove { base.ItemChanged -= value; }
    128     }
    129     event EventHandler IStringConvertibleMatrixData.Reset {
    130       add { base.Reset += value; }
    131       remove { base.Reset -= value; }
    132     }
    133118    #endregion
    134119  }
Note: See TracChangeset for help on using the changeset viewer.