Example #1
0
        public void BoundPositionTest(Molecule molecule, int boundNr, double xExp, double yExp)
        {
            var poz = molecule.BoundPosition(boundNr);

            var poz_expected = new Position(xExp, yExp);

            AssertExtensions.AreAlmostEqual(poz_expected, poz);
        }
Example #2
0
        public void TryToAttachDefinitely(Molecule boundMember1)
        {
            int? bound1 = boundMember1.FreeBound(this);
            if (bound1 != null)
            {
                int count2 = 0, bound2 = 0;
                var boundMember2 = boundMember1.LastInCell((int)bound1, true, ref count2, ref bound2);
                int count3 = 0, bound3 = 0;
                var boundMember3 = boundMember1.LastInCell((int)bound1, true, ref count3, ref bound3);

                AttachedIteration = habitat.Iteration;
                boundMember1.Neigbours[(int)bound1] = this;
                this.Neigbours[(int)bound1] = boundMember1;
                this.BoundType = boundMember1.BoundType == BoundType.I ? BoundType.II : BoundType.I;
                this.Position = boundMember1.BoundPosition((int)bound1);
                if (count2 == 5)
                {
                    boundMember2.Neigbours[bound2] = this;
                    this.Neigbours[bound2] = boundMember2;
                }
                if (count3 == 5)
                {
                    boundMember3.Neigbours[bound3] = this;
                    this.Neigbours[bound3] = boundMember3;
                }
                FireMoleculeAttached();
                habitat.Logger.Log("ATTACHED");
            }
        }
Example #3
0
        public void TryToAttachDefinitelyTest(Molecule mTo, Molecule mAttach, int boundNr_expected, BoundType boudType_expected)
        {
            mAttach.TryToAttachDefinitely(mTo);

            Assert.AreEqual(boundNr_expected, mTo.GetBoundNr(mAttach));

            Assert.AreEqual(boundNr_expected, mAttach.GetBoundNr(mTo));

            Assert.AreEqual(boudType_expected, mAttach.BoundType);

            var poz_expected = mTo.BoundPosition(boundNr_expected);

            AssertExtensions.AreAlmostEqual(poz_expected, mAttach.Position);

            // Assert.AreEqual(tetraNr_expected, mAttach.Position.TetrahedronPart(mTo.Position));
        }