Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/16/10 04:24:01 (14 years ago)
Author:
swagner
Message:

Refactored classes of HeuristicLab.Data and implemented encoding specific data classes (#909)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data/3.3/DoubleMatrix.cs

    r3048 r3054  
    2828  [Creatable("Test")]
    2929  [StorableClass]
    30   public sealed class DoubleMatrix : ValueTypeMatrix<double>, IStringConvertibleMatrix {
     30  public class DoubleMatrix : ValueTypeMatrix<double>, IStringConvertibleMatrix {
    3131    public DoubleMatrix() : base() { }
    3232    public DoubleMatrix(int rows, int columns) : base(rows, columns) { }
    3333    public DoubleMatrix(double[,] elements) : base(elements) { }
    34     private DoubleMatrix(DoubleMatrix elements) : base(elements) { }
    3534
    3635    public override IDeepCloneable Clone(Cloner cloner) {
    37       DoubleMatrix clone = new DoubleMatrix(this);
     36      DoubleMatrix clone = new DoubleMatrix(matrix);
    3837      cloner.RegisterClonedObject(this, clone);
    3938      return clone;
    4039    }
    4140
    42     #region IStringConvertibleMatrix Members
    43     int IStringConvertibleMatrix.Rows {
    44       get { return Rows; }
    45       set { Rows = value; }
    46     }
    47     int IStringConvertibleMatrix.Columns {
    48       get { return Columns; }
    49       set { Columns = value; }
    50     }
    51 
    52     bool IStringConvertibleMatrix.Validate(string value, out string errorMessage) {
     41    protected virtual bool Validate(string value, out string errorMessage) {
    5342      double val;
    5443      bool valid = double.TryParse(value, out val);
     
    6352      return valid;
    6453    }
    65     string IStringConvertibleMatrix.GetValue(int rowIndex, int columIndex) {
     54    protected virtual string GetValue(int rowIndex, int columIndex) {
    6655      return this[rowIndex, columIndex].ToString();
    6756    }
    68     bool IStringConvertibleMatrix.SetValue(string value, int rowIndex, int columnIndex) {
     57    protected virtual bool SetValue(string value, int rowIndex, int columnIndex) {
    6958      double val;
    7059      if (double.TryParse(value, out val)) {
     
    7564      }
    7665    }
     66
     67    #region IStringConvertibleMatrix Members
     68    int IStringConvertibleMatrix.Rows {
     69      get { return Rows; }
     70      set { Rows = value; }
     71    }
     72    int IStringConvertibleMatrix.Columns {
     73      get { return Columns; }
     74      set { Columns = value; }
     75    }
     76    bool IStringConvertibleMatrix.Validate(string value, out string errorMessage) {
     77      return Validate(value, out errorMessage);
     78    }
     79    string IStringConvertibleMatrix.GetValue(int rowIndex, int columIndex) {
     80      return GetValue(rowIndex, columIndex);
     81    }
     82    bool IStringConvertibleMatrix.SetValue(string value, int rowIndex, int columnIndex) {
     83      return SetValue(value, rowIndex, columnIndex);
     84    }
    7785    #endregion
    7886  }
Note: See TracChangeset for help on using the changeset viewer.