private RegularArrayAccessor(Array array, RegularArrayInfo arrayInfo, bool asRanges, bool zeroBased, int[] transpose, bool readOnly) : base(array != null ? indices => GetValue(array, arrayInfo, asRanges, zeroBased, transpose, indices) : (FuncParams <int, T>)null, array != null && !array.IsReadOnly ? (value, indices) => SetValue(array, arrayInfo, value, asRanges, zeroBased, transpose, indices) : (ActionParams <int, T>)null) { if (array == null) { throw new ArgumentNullException("array"); } if (!typeof(T).IsAssignableFrom(array.GetType().GetElementType())) { throw new ArgumentException("Invalid array element type"); } // if (transpose != null) { bool[] occurs = new bool[transpose.Length]; for (int i = 0; i < transpose.Length; i++) { if (transpose[i] < 0 && transpose[i] >= transpose.Length) { throw new ArgumentRegularArrayElementException("transpose", "Transpose index is out of range", i); } else if (occurs[transpose[i]]) { throw new ArgumentRegularArrayElementException("transpose", "Duplicate transpose index", i); } else { occurs[transpose[i]] = true; } } } }
public SqlRangeRegularArray(int[] lengths) { if (lengths != null && lengths.Any(l => l < 0)) { throw new ArgumentException("One or many items have invalid values.", "lengths"); } _array = PwrArray.CreateAsRegular <Range?>(lengths); _arrayInfo = new RegularArrayInfo(lengths); }
public SqlStringRegularArray(int[] lengths, Encoding encoding) { if (lengths != null && lengths.Any(t => t < 0)) { throw new ArgumentException("One or many items have invalid values.", "lengths"); } _array = PwrArray.CreateAsRegular <String>(lengths); _arrayInfo = new RegularArrayInfo(lengths); _encoding = encoding; }
protected StoredFlaggedStreamedRegularArray(Stream stream, SizeEncoding countSizing, SizeEncoding itemSizing, Func <T, int> dataSizer, SizeEncoding flagSizing, int flagSize, Func <T, F> itemFlag, Func <F, bool> hasData, Func <Stream, F> flagReader, Action <Stream, F> flagWriter, Func <Stream, F, int, T> dataReader, Action <Stream, F, int, T> dataWriter, Equality <T> itemEquality, RegularArrayInfo arrayInfo, ICollection <T> coll, bool leaveOpen, bool boostAccess, bool initialize) : base(stream, countSizing, itemSizing, dataSizer, flagSize, itemFlag, hasData, flagReader, flagWriter, dataReader, dataWriter, itemEquality, arrayInfo, coll, leaveOpen, boostAccess, false) { if (flagSize < 0) { throw new ArgumentOutOfRangeException("flagSize"); } _flagSizing = flagSizing; if (initialize) { BaseStream.Position = 0; Initialize(coll ?? default(T).Repeat(ArrayInfo.Length)); } }
protected CustomStreamedRegularArray(Stream stream, SizeEncoding countSizing, SizeEncoding itemSizing, Func <T, int> dataSizer, Func <Stream, int, T> dataReader, Action <Stream, int, T> dataWriter, Equality <T> itemEquality, RegularArrayInfo arrayInfo, ICollection <T> coll, bool leaveOpen, bool boostAccess, bool initialize) : base(stream, leaveOpen, boostAccess) { if (arrayInfo == null) { throw new ArgumentNullException("arrayInfo"); } if (dataSizer == null) { throw new ArgumentNullException("dataSizer"); } if (dataReader == null) { throw new ArgumentNullException("dataReader"); } if (dataWriter == null) { throw new ArgumentNullException("dataWriter"); } _countSizing = countSizing; _itemSizing = itemSizing; _dataSize = null; _dataSizer = dataSizer; _dataReader = dataReader; _dataWriter = dataWriter; _dataEquality = itemEquality != null ? itemEquality : EqualityComparer <T> .Default.Equals; _arrayInfo = arrayInfo; if (initialize) { BaseStream.Position = 0; Initialize(coll ?? default(T).Repeat(ArrayInfo.Length)); } }
public SqlSexagesimalAngleRegularArray() { _array = null; _arrayInfo = null; }
private SqlStringRegularArray(Array array, Encoding encoding) { _array = array; _arrayInfo = _array != null ? new RegularArrayInfo(array.GetRegularArrayDimensions()) : null; _encoding = encoding; }
public SqlSingleRegularArray() { _array = null; _arrayInfo = null; }
protected CustomFlaggedStreamedRegularArray(Stream stream, SizeEncoding countSizing, SizeEncoding itemSizing, int dataSize, bool compact, int flagSize, Func <T, F> itemFlag, Func <F, bool> hasData, Func <Stream, F> flagReader, Action <Stream, F> flagWriter, Func <Stream, F, int, T> dataReader, Action <Stream, F, int, T> dataWriter, Equality <T> itemEquality, RegularArrayInfo arrayInfo, ICollection <T> coll, bool leaveOpen, bool boostAccess, bool initialize) : base(stream, leaveOpen, boostAccess && !compact) { if (arrayInfo == null) { throw new ArgumentNullException("arrayInfo"); } if (dataSize < 0) { throw new ArgumentOutOfRangeException("dataSize"); } if (flagSize < 0) { throw new ArgumentOutOfRangeException("flagSize"); } if (itemFlag == null) { throw new ArgumentNullException("itemFlag"); } if (hasData == null) { throw new ArgumentNullException("hasData"); } if (flagReader == null) { throw new ArgumentNullException("flagReader"); } if (flagWriter == null) { throw new ArgumentNullException("flagWriter"); } if (dataReader == null) { throw new ArgumentNullException("dataReader"); } if (dataWriter == null) { throw new ArgumentNullException("dataWriter"); } _countSizing = countSizing; _itemSizing = itemSizing; _flagSize = flagSize; _dataSize = dataSize; _dataSizer = t => dataSize; _compact = compact; _itemFlag = itemFlag; _hasData = hasData; _flagReader = flagReader; _flagWriter = flagWriter; _dataReader = dataReader; _dataWriter = dataWriter; _dataEquality = itemEquality != null ? itemEquality : EqualityComparer <T> .Default.Equals; _arrayInfo = arrayInfo; if (initialize) { BaseStream.Position = 0; Initialize(coll ?? default(T).Repeat(ArrayInfo.Length)); } }
public SqlDoubleRegularArray() { _array = null; _arrayInfo = null; }
public SqlDateTimeRegularArray() { _array = null; _arrayInfo = null; }
public SqlGuidRegularArray() { _array = null; _arrayInfo = null; }
public SqlGradAngleRegularArray() { _array = null; _arrayInfo = null; }
private static T GetValue(Array array, RegularArrayInfo arrayInfo, bool asRanges, bool zeroBased, int[] transpose, int[] indices) { return(arrayInfo.GetValue <T>(array, asRanges, zeroBased, transpose != null ? Transpose(indices, transpose) : indices)); }
public SqlByteRegularArray() { _array = null; _arrayInfo = null; }
public SqlHourAngleRegularArray() { _array = null; _arrayInfo = null; }
private static void SetValue(Array array, RegularArrayInfo arrayInfo, T value, bool asRanges, bool zeroBased, int[] transpose, int[] indices) { arrayInfo.SetValue <T>(array, value, asRanges, zeroBased, transpose != null ? Transpose(indices, transpose) : indices); }
public SqlBinaryRegularArray() { _array = null; _arrayInfo = null; }
private SqlSexagesimalAngleRegularArray(Array array) { _array = array; _arrayInfo = _array != null ? new RegularArrayInfo(array.GetRegularArrayDimensions()) : null; }
public SqlBooleanRegularArray() { _array = null; _arrayInfo = null; }
protected StoredStreamedRegularArray(Stream stream, SizeEncoding countSizing, SizeEncoding itemSizing, Func <T, int> dataSizer, Func <Stream, int, T> dataReader, Action <Stream, int, T> dataWriter, Equality <T> itemEquality, RegularArrayInfo arrayInfo, ICollection <T> coll, bool leaveOpen, bool boostAccess, bool initialize) : base(stream, countSizing, itemSizing, dataSizer, dataReader, dataWriter, itemEquality, arrayInfo, coll, leaveOpen, boostAccess, initialize) { }
public SqlInt16RegularArray() { _array = null; _arrayInfo = null; }
public SqlBigIntegerRegularArray() { _array = null; _arrayInfo = null; }
public SqlRangeRegularArray() { _array = null; _arrayInfo = null; }
public SqlStringRegularArray() { _array = null; _arrayInfo = null; _encoding = null; }
private SqlRangeRegularArray(Array array) { _array = array; _arrayInfo = _array != null ? new RegularArrayInfo(array.GetRegularArrayDimensions()) : null; }
public SqlComplexRegularArray() { _array = null; _arrayInfo = null; }