Esempio n. 1
0
        public Containers <decimal> BuildContainersExampl1()
        {
            Containers <decimal> a = new Containers <decimal>(3, 1, 1, 0, 100);

            a.AllocateMemoryForPoints2DInEachContainer(1, 0, 50);
            a.AllocateMemoryForPoints2DInEachContainer(1, 1, 200);
            for (int i = 0; i < 3; i++)
            {
                a.SetRaingPoint2DInAllocatedMemory(i, 1, 0, GenereteColectionPoint2D(50));
                a.SetRaingPoint2DInAllocatedMemory(i, 1, 1, GenereteColectionPoint2D(200));
                a.AddRangePoint1D(i, 0, 0, GenereteColectionPoint1D(rnd1.Next(15, 250)));
                a.AddRangePoint1D(i, 0, 1, GenereteColectionPoint1D(rnd1.Next(60, 250)));
            }
            return(a);
        }
Esempio n. 2
0
        public Containers <double> BuildContainersExampl2()
        {
            Containers <double> a = new Containers <double>(10, 5, 5, 0, 10);

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    a.AllocateMemoryForPoints2DInEachContainer(5 + i, j, rnd1.Next(5, 15));
                }
            }
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    for (int k = 0; k < 10; k++)
                    {
                        a.SetRaingPoint2DInAllocatedMemory(i, j + 5, k, GenereteColectionPoint2D(rnd1.Next(5, 15)));
                        a.AddRangePoint1D(i, j, k, GenereteColectionPoint1D(rnd1.Next(1, 20)));
                    }
                }
            }
            return(a);
        }
Esempio n. 3
0
        public void TestAddContainers()
        {
            int countAddedContainers       = 2;
            Containers <int> TestContainer = new Containers <int>(6, 10, 20, 30, 50);

            TestContainer.AllocateMemoryForPoints2DInEachContainer(10, 48, 200);
            TestContainer.SetRaingPoint2DInAllocatedMemory(2, 10, 48, new List <Point2D <int> >()
            {
                new Point2D <int>(1, 1),
                new Point2D <int>(1, 2), new Point2D <int>(1, 3), new Point2D <int>(1, 4), new Point2D <int>(1, 5)
            });
            TestContainer.AllocateMemoryForPoints3D(120);
            TestContainer.SetRaingPoint3DInAllocatedMemory(1, 49, 0, new List <Point3D <int> >()
            {
                new Point3D <int>(1, 2, 3),
                new Point3D <int>(1, 2, 3), new Point3D <int>(1, 2, 3)
            });
            Assert.AreEqual(1, (TestContainer[1][49] as MatrixXYZ <int>)[0][0].ValueX);
            Assert.AreEqual(2, (TestContainer[1][49] as MatrixXYZ <int>)[0][0].ValueY);
            Assert.AreEqual(3, (TestContainer[1][49] as MatrixXYZ <int>)[0][0].ValueZ);
            Assert.AreEqual(0, (TestContainer[1][49] as MatrixXYZ <int>)[0][3].ValueX);

            TestContainer.AddContainers(countAddedContainers);

            int NumbMatrixX   = 0;
            int NumbMatrixXY  = 0;
            int NumbMatrixXYZ = 0;
            int NumbPositions = 0;

            foreach (var matrix in TestContainer[7])
            {
                if (matrix is MatrixX <int> )
                {
                    NumbMatrixX++;
                    NumbPositions = 0;
                    foreach (var positionX in (MatrixX <int>)matrix)
                    {
                        NumbPositions++;
                    }
                    Assert.AreEqual(50, NumbPositions); //перевіряє чи в кожній матриці кількість позицій =50
                }
                if (matrix is MatrixXY <int> )
                {
                    NumbMatrixXY++;
                    NumbPositions = 0;
                    foreach (var positionXY in (MatrixXY <int>)matrix)
                    {
                        NumbPositions++;
                    }
                    Assert.AreEqual(50, NumbPositions);
                }
                if (matrix is MatrixXYZ <int> )
                {
                    NumbMatrixXYZ++;
                    NumbPositions = 0;
                    foreach (var positionXYZ in (MatrixXYZ <int>)matrix)
                    {
                        NumbPositions++;
                    }
                    Assert.AreEqual(50, NumbPositions);
                }
            }
            Assert.AreEqual(10, NumbMatrixX);
            Assert.AreEqual(20, NumbMatrixXY);
            Assert.AreEqual(30, NumbMatrixXYZ);
        }