Changeset 17253 for branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3
- Timestamp:
- 09/16/19 16:12:21 (5 years ago)
- Location:
- branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/BoolArray.cs
r17226 r17253 21 21 22 22 using System.Text; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using HEAL.Attic;26 26 27 27 namespace HeuristicLab.Data { … … 36 36 public BoolArray() : base() { } 37 37 public BoolArray(int length) : base(length) { } 38 public BoolArray(bool[] elements ) : base(elements) { }38 public BoolArray(bool[] elements, bool @readonly = false) : base(elements, @readonly) { } 39 39 40 40 public override IDeepCloneable Clone(Cloner cloner) { … … 67 67 } 68 68 } 69 70 public new BoolArray AsReadOnly() { 71 return (BoolArray)base.AsReadOnly(); 72 } 69 73 } 70 74 } -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/BoolMatrix.cs
r17226 r17253 22 22 using System.Collections.Generic; 23 23 using System.Text; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Data { … … 39 39 public BoolMatrix(int rows, int columns, IEnumerable<string> columnNames) : base(rows, columns, columnNames) { } 40 40 public BoolMatrix(int rows, int columns, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(rows, columns, columnNames, rowNames) { } 41 public BoolMatrix(bool[,] elements ) : base(elements) { }42 public BoolMatrix(bool[,] elements, IEnumerable<string> columnNames ) : base(elements, columnNames) { }43 public BoolMatrix(bool[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames ) : base(elements, columnNames, rowNames) { }41 public BoolMatrix(bool[,] elements, bool @readonly = false) : base(elements, @readonly) { } 42 public BoolMatrix(bool[,] elements, IEnumerable<string> columnNames, bool @readonly = false) : base(elements, columnNames, @readonly) { } 43 public BoolMatrix(bool[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames, bool @readonly = false) : base(elements, columnNames, rowNames, @readonly) { } 44 44 45 45 public override IDeepCloneable Clone(Cloner cloner) { … … 73 73 } 74 74 75 public new BoolMatrix AsReadOnly() { 76 return (BoolMatrix)base.AsReadOnly(); 77 } 78 75 79 #region IStringConvertibleMatrix Members 76 80 int IStringConvertibleMatrix.Rows { -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/BoolValue.cs
r17226 r17253 23 23 using System.Drawing; 24 24 using System.Text; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Data { … … 41 41 } 42 42 public BoolValue() : base() { } 43 public BoolValue(bool value ) : base(value) { }43 public BoolValue(bool value, bool @readonly = false) : base(value, @readonly) { } 44 44 45 45 public override IDeepCloneable Clone(Cloner cloner) { … … 81 81 } 82 82 83 public new BoolValue AsReadOnly() { 84 return (BoolValue)base.AsReadOnly(); 85 } 86 83 87 #region IStringConvertibleValue Members 84 88 bool IStringConvertibleValue.Validate(string value, out string errorMessage) { -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/DoubleArray.cs
r17226 r17253 21 21 22 22 using System.Text; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using HEAL.Attic;26 26 27 27 namespace HeuristicLab.Data { … … 36 36 public DoubleArray() : base() { } 37 37 public DoubleArray(int length) : base(length) { } 38 public DoubleArray(double[] elements ) : base(elements) { }38 public DoubleArray(double[] elements, bool @readonly = false) : base(elements, @readonly) { } 39 39 40 40 public override IDeepCloneable Clone(Cloner cloner) { … … 67 67 } 68 68 } 69 70 public new DoubleArray AsReadOnly() { 71 return (DoubleArray)base.AsReadOnly(); 72 } 69 73 } 70 74 } -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/DoubleMatrix.cs
r17248 r17253 73 73 } 74 74 75 public new DoubleMatrix AsReadOnly() { 76 return (DoubleMatrix)base.AsReadOnly(); 77 } 78 75 79 #region IStringConvertibleMatrix Members 76 80 int IStringConvertibleMatrix.Rows { -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/DoubleValue.cs
r17226 r17253 23 23 using System.Drawing; 24 24 using System.Text; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Data { … … 41 41 } 42 42 public DoubleValue() : base() { } 43 public DoubleValue(double value ) : base(value) { }43 public DoubleValue(double value, bool @readonly = false) : base(value, @readonly) { } 44 44 45 45 public override IDeepCloneable Clone(Cloner cloner) { … … 85 85 } 86 86 87 public new DoubleValue AsReadOnly() { 88 return (DoubleValue)base.AsReadOnly(); 89 } 90 87 91 #region IStringConvertibleValue Members 88 92 bool IStringConvertibleValue.Validate(string value, out string errorMessage) { -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/EnumValue.cs
r17226 r17253 22 22 using System; 23 23 using System.Drawing; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Data { … … 39 39 } 40 40 41 public EnumValue() { 42 this.value = default(T); 43 this.readOnly = false; 44 } 45 public EnumValue(T value) { 46 this.value = value; 47 this.readOnly = false; 48 } 41 public EnumValue() : base(default(T)) { } 42 public EnumValue(T value, bool @readonly = false) : base(value, @readonly) { } 49 43 50 44 [StorableConstructor] … … 61 55 return Value.CompareTo(other.Value); 62 56 } 57 58 public new EnumValue<T> AsReadOnly() { 59 return (EnumValue<T>)base.AsReadOnly(); 60 } 63 61 } 64 62 } -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/IntArray.cs
r17226 r17253 21 21 22 22 using System.Text; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using HEAL.Attic;26 26 27 27 namespace HeuristicLab.Data { … … 36 36 public IntArray() : base() { } 37 37 public IntArray(int length) : base(length) { } 38 public IntArray(int[] elements ) : base(elements) { }38 public IntArray(int[] elements, bool @readonly = false) : base(elements, @readonly) { } 39 39 40 40 public override IDeepCloneable Clone(Cloner cloner) { … … 67 67 } 68 68 } 69 70 public new IntArray AsReadOnly() { 71 return (IntArray)base.AsReadOnly(); 72 } 69 73 } 70 74 } -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/IntMatrix.cs
r17226 r17253 22 22 using System.Collections.Generic; 23 23 using System.Text; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Data { … … 39 39 public IntMatrix(int rows, int columns, IEnumerable<string> columnNames) : base(rows, columns, columnNames) { } 40 40 public IntMatrix(int rows, int columns, IEnumerable<string> columnNames,IEnumerable<string> rowNames) : base(rows, columns, columnNames,rowNames) { } 41 public IntMatrix(int[,] elements ) : base(elements) { }42 public IntMatrix(int[,] elements, IEnumerable<string> columnNames ) : base(elements,columnNames) { }43 public IntMatrix(int[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames ) : base(elements,columnNames,rowNames) { }41 public IntMatrix(int[,] elements, bool @readonly = false) : base(elements, @readonly) { } 42 public IntMatrix(int[,] elements, IEnumerable<string> columnNames, bool @readonly = false) : base(elements, columnNames, @readonly) { } 43 public IntMatrix(int[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames, bool @readonly = false) : base(elements, columnNames, rowNames, @readonly) { } 44 44 45 45 public override IDeepCloneable Clone(Cloner cloner) { … … 73 73 } 74 74 75 public new IntMatrix AsReadOnly() { 76 return (IntMatrix)base.AsReadOnly(); 77 } 78 75 79 #region IStringConvertibleMatrix Members 76 80 int IStringConvertibleMatrix.Rows { -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/IntValue.cs
r17226 r17253 23 23 using System.Drawing; 24 24 using System.Text; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Data { … … 41 41 } 42 42 public IntValue() : base() { } 43 public IntValue(int value ) : base(value) { }43 public IntValue(int value, bool @readonly = false) : base(value, @readonly) { } 44 44 45 45 public override IDeepCloneable Clone(Cloner cloner) { … … 81 81 } 82 82 83 public new IntValue AsReadOnly() { 84 return (IntValue)base.AsReadOnly(); 85 } 86 83 87 #region IStringConvertibleValue Members 84 88 bool IStringConvertibleValue.Validate(string value, out string errorMessage) { -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/PercentArray.cs
r17226 r17253 21 21 22 22 using System.Text; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using HEAL.Attic;26 26 27 27 namespace HeuristicLab.Data { … … 36 36 public PercentArray() : base() { } 37 37 public PercentArray(int length) : base(length) { } 38 public PercentArray(double[] elements ) : base(elements) { }38 public PercentArray(double[] elements, bool @readonly = false) : base(elements, @readonly) { } 39 39 40 40 public override IDeepCloneable Clone(Cloner cloner) { … … 77 77 } 78 78 } 79 80 public new PercentArray AsReadOnly() { 81 return (PercentArray)base.AsReadOnly(); 82 } 79 83 } 80 84 } -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/PercentMatrix.cs
r17226 r17253 22 22 using System.Collections.Generic; 23 23 using System.Text; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Data { … … 39 39 public PercentMatrix(int rows, int columns, IEnumerable<string> columnNames) : base(rows, columns, columnNames) { } 40 40 public PercentMatrix(int rows, int columns, IEnumerable<string> columnNames, IEnumerable<string> rowNames) : base(rows, columns, columnNames, rowNames) { } 41 public PercentMatrix(double[,] elements ) : base(elements) { }42 public PercentMatrix(double[,] elements, IEnumerable<string> columnNames ) : base(elements, columnNames) { }43 public PercentMatrix(double[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames ) : base(elements, columnNames, rowNames) { }41 public PercentMatrix(double[,] elements, bool @readonly = false) : base(elements, @readonly) { } 42 public PercentMatrix(double[,] elements, IEnumerable<string> columnNames, bool @readonly = false) : base(elements, columnNames, @readonly) { } 43 public PercentMatrix(double[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames, bool @readonly = false) : base(elements, columnNames, rowNames, @readonly) { } 44 44 45 45 public override IDeepCloneable Clone(Cloner cloner) { … … 85 85 } 86 86 } 87 88 public new PercentMatrix AsReadOnly() { 89 return (PercentMatrix)base.AsReadOnly(); 90 } 87 91 } 88 92 } -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/PercentValue.cs
r17226 r17253 21 21 22 22 using System; 23 using HEAL.Attic; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 using HEAL.Attic;26 26 27 27 namespace HeuristicLab.Data { … … 51 51 } 52 52 public PercentValue() : base() { } 53 public PercentValue(double value ) : base(value) { }54 55 public PercentValue(double value, bool restrictToUnitInterval )53 public PercentValue(double value, bool @readonly = false) : base(value, @readonly) { } 54 // TODO: suggest to remove the following constructor [ABE] 55 public PercentValue(double value, bool restrictToUnitInterval, bool @readonly = false) 56 56 : base() { 57 57 this.restrictToUnitInterval = restrictToUnitInterval; … … 59 59 throw new ArgumentException("Value must lie in the interval [0,1]."); 60 60 this.value = value; 61 this.readOnly = @readonly; 61 62 } 62 63 … … 101 102 } 102 103 } 104 105 public new PercentValue AsReadOnly() { 106 return (PercentValue)base.AsReadOnly(); 107 } 103 108 } 104 109 } -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/StringArray.cs
r17226 r17253 26 26 using System.Linq; 27 27 using System.Text; 28 using HEAL.Attic; 28 29 using HeuristicLab.Common; 29 30 using HeuristicLab.Core; 30 using HEAL.Attic;31 31 32 32 namespace HeuristicLab.Data { … … 131 131 elementNames = new List<string>(); 132 132 } 133 public StringArray(string[] elements ) {133 public StringArray(string[] elements, bool @readonly = false) { 134 134 if (elements == null) throw new ArgumentNullException(); 135 135 array = new string[elements.Length]; 136 136 for (int i = 0; i < array.Length; i++) 137 137 array[i] = elements[i] == null ? string.Empty : elements[i]; 138 readOnly = false;138 readOnly = @readonly; 139 139 resizable = true; 140 140 elementNames = new List<string>(); … … 146 146 147 147 public virtual StringArray AsReadOnly() { 148 StringArray readOnlyStringArray = (StringArray)this.Clone(); 149 readOnlyStringArray.readOnly = true; 150 return readOnlyStringArray; 148 if (ReadOnly) return this; 149 var clone = (StringArray)this.Clone(); 150 clone.readOnly = true; 151 return clone; 151 152 } 152 153 IValueTypeArray IValueTypeArray.AsReadOnly() { -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/StringConvertibleArray.cs
r17226 r17253 22 22 #endregion 23 23 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Data { … … 37 37 protected StringConvertibleArray() : base() { } 38 38 protected StringConvertibleArray(int length) : base(length) { } 39 protected StringConvertibleArray(T[] elements ) : base(elements) { }39 protected StringConvertibleArray(T[] elements, bool @readonly = false) : base(elements, @readonly) { } 40 40 41 41 protected abstract bool Validate(string value, out string errorMessage); -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/StringMatrix.cs
r17226 r17253 26 26 using System.Linq; 27 27 using System.Text; 28 using HEAL.Attic; 28 29 using HeuristicLab.Common; 29 30 using HeuristicLab.Core; 30 using HEAL.Attic;31 31 32 32 namespace HeuristicLab.Data { … … 178 178 RowNames = rowNames; 179 179 } 180 public StringMatrix(string[,] elements ) {180 public StringMatrix(string[,] elements, bool @readonly = false) { 181 181 if (elements == null) throw new ArgumentNullException(); 182 182 matrix = new string[elements.GetLength(0), elements.GetLength(1)]; … … 188 188 rowNames = new List<string>(); 189 189 sortableView = false; 190 readOnly = false;191 } 192 protected StringMatrix(string[,] elements, IEnumerable<string> columnNames )193 : this(elements ) {190 readOnly = @readonly; 191 } 192 protected StringMatrix(string[,] elements, IEnumerable<string> columnNames, bool @readonly = false) 193 : this(elements, @readonly) { 194 194 ColumnNames = columnNames; 195 195 } 196 protected StringMatrix(string[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames )197 : this(elements, columnNames ) {196 protected StringMatrix(string[,] elements, IEnumerable<string> columnNames, IEnumerable<string> rowNames, bool @readonly = false) 197 : this(elements, columnNames, @readonly ) { 198 198 RowNames = rowNames; 199 199 } … … 204 204 205 205 public virtual StringMatrix AsReadOnly() { 206 StringMatrix readOnlyStringMatrix = (StringMatrix)this.Clone(); 207 readOnlyStringMatrix.readOnly = true; 208 return readOnlyStringMatrix; 206 if (ReadOnly) return this; 207 var clone = (StringMatrix)this.Clone(); 208 clone.readOnly = true; 209 return clone; 209 210 } 210 211 -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/StringValue.cs
r17226 r17253 22 22 using System; 23 23 using System.Drawing; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Data { … … 66 66 this.readOnly = false; 67 67 } 68 public StringValue(string value ) {68 public StringValue(string value, bool @readonly = false) { 69 69 this.value = value != null ? value : string.Empty; 70 this.readOnly = false;70 this.readOnly = @readonly; 71 71 } 72 72 … … 76 76 77 77 public virtual StringValue AsReadOnly() { 78 StringValue readOnlyStringValue = (StringValue)this.Clone(); 79 readOnlyStringValue.readOnly = true; 80 return readOnlyStringValue; 78 if (ReadOnly) return this; 79 var clone = (StringValue)this.Clone(); 80 clone.readOnly = true; 81 return clone; 81 82 } 82 83 -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/TextValue.cs
r17226 r17253 20 20 #endregion 21 21 22 using HEAL.Attic; 22 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 using HEAL.Attic;25 25 26 26 namespace HeuristicLab.Data { … … 29 29 public class TextValue : StringValue, ITextValue { 30 30 31 public TextValue() { 32 this.value = string.Empty; 33 this.readOnly = false; 34 } 35 36 public TextValue(string value) { 37 this.value = value ?? string.Empty; 38 this.readOnly = false; 39 } 31 public TextValue() : base() { } 32 public TextValue(string value, bool @readonly = false) : base(value ?? string.Empty, @readonly) { } 40 33 41 34 [StorableConstructor] 42 35 protected TextValue(StorableConstructorFlag _) : base(_) { } 43 36 44 protected TextValue(TextValue original, Cloner cloner) 45 : base(original, cloner) { 46 this.value = original.value ?? string.Empty; 47 this.readOnly = original.readOnly; 48 } 37 protected TextValue(TextValue original, Cloner cloner) : base(original, cloner) { } 49 38 50 39 public override IDeepCloneable Clone(Cloner cloner) { -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/TimeSpanValue.cs
r17226 r17253 23 23 using System.Globalization; 24 24 using System.Text; 25 using HEAL.Attic; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; 27 using HEAL.Attic;28 28 29 29 namespace HeuristicLab.Data { … … 37 37 } 38 38 public TimeSpanValue() : base() { } 39 public TimeSpanValue(TimeSpan value ) : base(value) { }39 public TimeSpanValue(TimeSpan value, bool @readonly = false) : base(value, @readonly) { } 40 40 41 41 public override IDeepCloneable Clone(Cloner cloner) { … … 80 80 } 81 81 82 public new TimeSpanValue AsReadOnly() { 83 return (TimeSpanValue)base.AsReadOnly(); 84 } 85 82 86 #region IStringConvertibleValue Members 83 87 bool IStringConvertibleValue.Validate(string value, out string errorMessage) { -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/ValueTypeArray.cs
r17226 r17253 26 26 using System.Linq; 27 27 using System.Text; 28 using HEAL.Attic; 28 29 using HeuristicLab.Common; 29 30 using HeuristicLab.Core; 30 using HEAL.Attic;31 31 32 32 namespace HeuristicLab.Data { … … 137 137 elementNames = new List<string>(); 138 138 } 139 protected ValueTypeArray(T[] elements ) {139 protected ValueTypeArray(T[] elements, bool @readonly = false) { 140 140 if (elements == null) throw new ArgumentNullException(); 141 141 array = (T[])elements.Clone(); 142 readOnly = false;142 readOnly = @readonly; 143 143 resizable = true; 144 144 elementNames = new List<string>(); … … 146 146 147 147 public virtual IValueTypeArray AsReadOnly() { 148 ValueTypeArray<T> readOnlyValueTypeArray = (ValueTypeArray<T>)this.Clone(); 149 readOnlyValueTypeArray.readOnly = true; 150 return readOnlyValueTypeArray; 148 if (ReadOnly) return this; 149 var clone = (ValueTypeArray<T>)this.Clone(); 150 clone.readOnly = true; 151 return clone; 151 152 } 152 153 -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/ValueTypeMatrix.cs
r17251 r17253 190 190 191 191 public virtual ValueTypeMatrix<T> AsReadOnly() { 192 if ( readOnly) return this;193 var readOnlyValueTypeMatrix= (ValueTypeMatrix<T>)this.Clone();194 readOnlyValueTypeMatrix.readOnly = true;195 return readOnlyValueTypeMatrix;192 if (ReadOnly) return this; 193 var clone = (ValueTypeMatrix<T>)this.Clone(); 194 clone.readOnly = true; 195 return clone; 196 196 } 197 197 -
branches/2521_ProblemRefactoring/HeuristicLab.Data/3.3/ValueTypeValue.cs
r17226 r17253 22 22 using System; 23 23 using System.Drawing; 24 using HEAL.Attic; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 using HEAL.Attic;27 27 28 28 namespace HeuristicLab.Data { … … 64 64 this.readOnly = false; 65 65 } 66 protected ValueTypeValue(T value ) {66 protected ValueTypeValue(T value, bool @readonly = false) { 67 67 this.value = value; 68 this.readOnly = false;68 this.readOnly = @readonly; 69 69 } 70 70 71 71 public virtual ValueTypeValue<T> AsReadOnly() { 72 ValueTypeValue<T> readOnlyValueTypeValue = (ValueTypeValue<T>)this.Clone(); 73 readOnlyValueTypeValue.readOnly = true; 74 return readOnlyValueTypeValue; 72 if (ReadOnly) return this; 73 var clone = (ValueTypeValue<T>)this.Clone(); 74 clone.readOnly = true; 75 return clone; 75 76 } 76 77
Note: See TracChangeset
for help on using the changeset viewer.