Example #1
0
        /// <summary>
        /// Copies from another instance.
        /// </summary>
        /// <param name="obj">The object to copy from.</param>
        /// <returns><c>True</c> if anything could be copied from the object, otherwise <c>false</c>.</returns>
        public bool CopyFrom(object obj)
        {
            if (object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            var from = obj as DataTableTransposeDataSource;

            if (null != from)
            {
                using (var token = SuspendGetToken())
                {
                    DataTableTransposeOptions dataSourceOptions = null;
                    DataTableProxy            inputData         = null;
                    IDataSourceImportOptions  importOptions     = null;

                    CopyHelper.Copy(ref importOptions, from._importOptions);
                    CopyHelper.Copy(ref dataSourceOptions, from._processOptions);
                    CopyHelper.Copy(ref inputData, from._processData);

                    TransposeOptions = dataSourceOptions;
                    ImportOptions    = importOptions;
                    InputData        = inputData;

                    return(true);
                }
            }
            return(false);
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataTableMultipleColumnProxy"/> class.
        /// The table and group number of this instance are set, but no columns are set with this constructor.
        /// </summary>
        /// <param name="table">The underlying table.</param>
        /// <param name="groupNumber">The group number of the data columns this instance should hold.</param>
        /// <exception cref="System.ArgumentNullException">table must not be null.</exception>
        public DataTableMultipleColumnProxy(DataTable table, int groupNumber)
        {
            if (null == table)
            {
                throw new ArgumentNullException("table");
            }

            _dataTable = new DataTableProxy(table)
            {
                ParentObject = this
            };

            _groupNumber = groupNumber;
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataTableTransposeDataSource"/> class.
        /// </summary>
        /// <param name="inputData">The input data designates the original source of data (used then for the processing).</param>
        /// <param name="dataSourceOptions">The Fourier transformation options.</param>
        /// <param name="importOptions">The data source import options.</param>
        /// <exception cref="System.ArgumentNullException">
        /// inputData
        /// or
        /// transformationOptions
        /// or
        /// importOptions
        /// </exception>
        public DataTableTransposeDataSource(DataTableProxy inputData, DataTableTransposeOptions dataSourceOptions, IDataSourceImportOptions importOptions)
        {
            if (null == inputData)
            {
                throw new ArgumentNullException(nameof(inputData));
            }
            if (null == dataSourceOptions)
            {
                throw new ArgumentNullException(nameof(dataSourceOptions));
            }
            if (null == importOptions)
            {
                throw new ArgumentNullException(nameof(importOptions));
            }

            using (var token = SuspendGetToken())
            {
                TransposeOptions = dataSourceOptions;
                ImportOptions    = importOptions;
                InputData        = inputData;
            }
        }
Example #4
0
 private void InternalSetDataTable(DataTableProxy proxy)
 {
     ChildSetMember(ref _dataTable, proxy ?? new DataTableProxy((DataTable)null));
 }
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataTableMultipleColumnProxy"/> class. The selected collections determine which columns and rows contribute to this instance.
        /// The group number is determined by the first selected column (or, if no column is selected, by the first column of the data table).
        /// </summary>
        /// <param name="identifier">The identifier of the bundle of columns that are initially set with this constructor.</param>
        /// <param name="table">The underlying table.</param>
        /// <param name="selectedDataRows">The selected data rows.</param>
        /// <param name="selectedDataColumns">The selected data columns.</param>
        /// <exception cref="System.ArgumentNullException">table must not be null.</exception>
        public DataTableMultipleColumnProxy(string identifier, DataTable table, IAscendingIntegerCollection selectedDataRows, IAscendingIntegerCollection selectedDataColumns)
        {
            if (null == identifier)
            {
                throw new ArgumentNullException("identifier");
            }

            if (null == table)
            {
                throw new ArgumentNullException("table");
            }

            _dataColumnBundles = new Dictionary <string, ColumnBundleInfo>();

            _dataTable = new DataTableProxy(table)
            {
                ParentObject = this
            };

            _groupNumber = 0;

            if (null != selectedDataColumns && selectedDataColumns.Count > 0)
            {
                _groupNumber = table.DataColumns.GetColumnGroup(table[selectedDataColumns[0]]);
            }

            var bundle = new ColumnBundleInfo();

            _dataColumnBundles.Add(identifier, bundle);

            int maxRowCount = 0;

            if (selectedDataColumns != null && selectedDataColumns.Count > 0)
            {
                for (int i = 0; i < selectedDataColumns.Count; ++i)
                {
                    var col = table[selectedDataColumns[i]];
                    if (table.DataColumns.GetColumnGroup(col) == _groupNumber)
                    {
                        InternalAddDataColumnNoClone(bundle, ReadableColumnProxyBase.FromColumn(col));
                        maxRowCount = Math.Max(maxRowCount, col.Count);
                    }
                }
            }
            else // nothing selected - use all columns of group number 0
            {
                for (int i = 0; i < table.DataColumnCount; ++i)
                {
                    var col = table[i];
                    if (table.DataColumns.GetColumnGroup(col) == _groupNumber)
                    {
                        InternalAddDataColumnNoClone(bundle, ReadableColumnProxyBase.FromColumn(col));
                        maxRowCount = Math.Max(maxRowCount, col.Count);
                    }
                }
            }

            _useAllAvailableDataRows = null == selectedDataRows || selectedDataRows.Count == 0;

            _participatingDataRows = new AscendingIntegerCollection(_useAllAvailableDataRows ? ContiguousIntegerRange.FromStartAndCount(0, maxRowCount) : selectedDataRows);
        }
Example #6
0
 /// <summary>
 /// Cloning constructor.
 /// </summary>
 /// <param name="from">Object to clone from.</param>
 public DataTableProxy(DataTableProxy from)
     : base(from)
 {
 }