Changeset 3994
- Timestamp:
- 07/05/10 11:16:55 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.3/Dataset.cs
r3981 r3994 36 36 public sealed class Dataset : NamedItem, IStringConvertibleMatrix { 37 37 // empty constructor for cloning 38 private Dataset() : base() { 39 } 40 38 private Dataset() 39 : base() { 40 } 41 41 42 [StorableConstructor] 42 43 protected Dataset(bool deserializing) … … 70 71 get { return data[rowIndex, columnIndex]; } 71 72 } 72 73 73 public double this[string variableName, int rowIndex] { 74 74 get { … … 81 81 return GetVariableValues(variableIndex, 0, Rows); 82 82 } 83 84 83 public double[] GetVariableValues(int variableIndex, int start, int end) { 85 84 if (start < 0 || !(start <= end)) … … 93 92 return values; 94 93 } 95 96 94 public double[] GetVariableValues(string variableName) { 97 95 return GetVariableValues(GetVariableIndex(variableName), 0, Rows); 98 96 } 99 100 97 public double[] GetVariableValues(string variableName, int start, int end) { 101 98 return GetVariableValues(GetVariableIndex(variableName), start, end); 102 99 } 103 100 104 #region Variable name methods 101 public IEnumerable<double> GetEnumeratedVariableValues(int variableIndex) { 102 return GetEnumeratedVariableValues(variableIndex, 0, Rows); 103 } 104 public IEnumerable<double> GetEnumeratedVariableValues(int variableIndex, int start, int end) { 105 if (start < 0 || !(start <= end)) 106 throw new ArgumentException("Start must be between 0 and end (" + end + ")."); 107 if (end > Rows || end < start) 108 throw new ArgumentException("End must be between start (" + start + ") and dataset rows (" + Rows + ")."); 109 for (int i = 0; i < end - start; i++) 110 yield return data[i + start, variableIndex]; 111 } 112 public IEnumerable<double> GetEnumeratedVariableValues(string variableName) { 113 return GetEnumeratedVariableValues(GetVariableIndex(variableName), 0, Rows); 114 } 115 public IEnumerable<double> GetEnumeratedVariableValues(string variableName, int start, int end) { 116 return GetEnumeratedVariableValues(GetVariableIndex(variableName), start, end); 117 } 118 119 120 105 121 public string GetVariableName(int variableIndex) { 106 122 return variableNames[variableIndex]; … … 113 129 throw new ArgumentException("The variable name " + variableName + " was not found."); 114 130 } 115 #endregion116 131 117 132 public double[,] GetClonedData() {
Note: See TracChangeset
for help on using the changeset viewer.