Esempio n. 1
0
        /// <summary>
        /// Adds new position into matrix
        /// </summary>
        /// <param name="position">Position</param>
        public override void Add(Position <T> position)
        {
            if (position == null)
            {
                throw new ArgumentNullException("The argument is null");
            }

            if (ElementsList.Count > 0)
            {
                if (!AreTheSameType(ElementsList.Last(), position))
                {
                    throw new ArgumentException("All positions should be the same type");
                }

                if (IsMatrix3D())
                {
                    if (!Check3DMatrix(ElementsList.Last(), position))
                    {
                        string message = "For 3D matrix amount of data points in each position should be equal.";
                        throw new ArgumentException(message);
                    }
                }
            }

            base.AddElement(position);
        }
Esempio n. 2
0
        /// <summary>
        /// Adds new element to the collection
        /// </summary>
        /// <param name="container">Element for adding</param>
        public override void Add(Container <T> container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("The argument is null");
            }

            if (ElementsList.Count > 0)
            {
                var lastContainer = ElementsList.Last();

                if (CheckContainersOnMatrixAmount(container, lastContainer) &&
                    CheckTypeOfEachIndexedMatrix(container, lastContainer) &&
                    CheckNumberofDataPointsIn3dMatrix(container, lastContainer))
                {
                    base.AddElement(container);
                }
                else
                {
                    string message = "Each container should have the same number of matrix and each indexed matrix should have the same type";
                    throw new ArgumentException(message);
                }
            }
            else
            {
                base.AddElement(container);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Adds element to the collection
        /// </summary>
        /// <param name="matrix">Element for adding</param>
        public override void Add(Matrix <T> matrix)
        {
            if (matrix == null || matrix.Count == 0)
            {
                throw new ArgumentNullException("The argument is null");
            }

            if (ElementsList.Count > 0)
            {
                if (!CheckMatrix(ElementsList.Last(), matrix))
                {
                    string message = "Every matrix in container should have the same amount of positions.";
                    throw new ArgumentException(message);
                }
            }
            base.AddElement(matrix);
        }