Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/07/18 16:12:04 (6 years ago)
Author:
mkommend
Message:

#2935:

  • Implemented ModifiableDataset.InsertVariable
  • Added ModifiableDataset.ToDataset for convience reasons
  • Altered ModifiableDataset ctor to allow specification of whether the values should be cloned
  • Simplified code of Dataset.ToModifiable
  • Added protected setter to Rows in the Dataset and made the corresponding field private
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs

    r15829 r16063  
    116116
    117117    public ModifiableDataset ToModifiable() {
    118       var values = new List<IList>();
    119       foreach (var v in variableNames) {
    120         if (VariableHasType<double>(v)) {
    121           values.Add(new List<double>((IList<double>)variableValues[v]));
    122         } else if (VariableHasType<string>(v)) {
    123           values.Add(new List<string>((IList<string>)variableValues[v]));
    124         } else if (VariableHasType<DateTime>(v)) {
    125           values.Add(new List<DateTime>((IList<DateTime>)variableValues[v]));
    126         } else {
    127           throw new ArgumentException("Unknown variable type.");
    128         }
    129       }
    130       return new ModifiableDataset(variableNames, values);
     118      return new ModifiableDataset(variableNames, variableNames.Select(v => variableValues[v]),true);
    131119    }
    132120
     
    141129    }
    142130
    143     protected Dataset(Dataset dataset) : this(dataset.variableNames, dataset.variableValues.Values) { }
     131
    144132
    145133    #region Backwards compatible code, remove with 3.5
     
    318306    #region IStringConvertibleMatrix Members
    319307    [Storable]
    320     protected int rows;
     308    private int rows;
    321309    public int Rows {
    322310      get { return rows; }
     311      protected set { rows = value; }
    323312    }
    324313    int IStringConvertibleMatrix.Rows {
Note: See TracChangeset for help on using the changeset viewer.