- Timestamp:
- 08/17/18 09:35:52 (6 years ago)
- Location:
- trunk/HeuristicLab.Problems.DataAnalysis/3.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
r16063 r16084 116 116 117 117 public ModifiableDataset ToModifiable() { 118 return new ModifiableDataset(variableNames, variableNames.Select(v => variableValues[v]), true);118 return new ModifiableDataset(variableNames, variableNames.Select(v => variableValues[v]), true); 119 119 } 120 120 -
trunk/HeuristicLab.Problems.DataAnalysis/3.4/ModifiableDataset.cs
r16063 r16084 101 101 // adds a new variable to the dataset 102 102 public void AddVariable(string variableName, IList values) { 103 if (variableValues.ContainsKey(variableName)) 104 throw new ArgumentException(string.Format("Variable {0} is already present in the dataset.", variableName)); 105 106 if (values == null || values.Count == 0) 107 throw new ArgumentException("Cannot add variable with no values."); 108 109 if (values.Count != Rows) 110 throw new ArgumentException(string.Format("{0} values are provided, but {1} rows are present in the dataset.", values.Count, Rows)); 111 112 if (!IsAllowedType(values)) 113 throw new ArgumentException(string.Format("Unsupported type {0} for variable {1}.", GetElementType(values), variableName)); 114 115 variableValues[variableName] = values; 116 variableNames.Add(variableName); 117 118 OnColumnsChanged(); 119 OnColumnNamesChanged(); 120 OnReset(); 103 InsertVariable(variableName, Columns, values); 121 104 } 122 105 … … 129 112 throw new ArgumentException(string.Format("Incorrect position {0} specified. The position must be between 0 and {1}.", position, Columns)); 130 113 131 if (values == null || values.Count == 0)132 throw new Argument Exception("Cannot add variable with no values.");114 if (values == null) 115 throw new ArgumentNullException("values", "Values must not be null. At least an empty list of values has to be provided."); 133 116 134 117 if (values.Count != Rows)
Note: See TracChangeset
for help on using the changeset viewer.