コード例 #1
0
        public void unionAndResetPassageID()
        {
            HashSet <String> oldCurrentPassageID   = new HashSet <String>(this.CurrentCell.getPassageID());
            HashSet <String> oldNeighbourPassageID = new HashSet <String>(this.NeighbourCell.getPassageID());

            HashSet <String> newPassageID = new HashSet <String>();

            newPassageID = this.CurrentCell.getPassageID();
            newPassageID.UnionWith(this.NeighbourCell.getPassageID());

            CellProperties xwalkCell = new CellProperties();
            CellProperties ywalkCell = new CellProperties();

            for (Int32 xWalk = 0; xWalk < this.Cell0x0.getGrid().getXLength(); xWalk++)
            {
                xwalkCell = xWalk == 0 ? this.Cell0x0 : xwalkCell.getRightCell();
                for (Int32 yWalk = 0; yWalk < this.Cell0x0.getGrid().getYLength(); yWalk++)
                {
                    xwalkCell.setBottomWall(xWalk == 0 && yWalk == 0 ? false : xwalkCell.getBottomWall());
                    xwalkCell.setBottomWall(xWalk == this.Cell0x0.getGrid().getXLength() - 1 && yWalk == this.Cell0x0.getGrid().getYLength() - 1 ? false : xwalkCell.getBottomWall());
                    ywalkCell = yWalk == 0 ? xwalkCell : ywalkCell.getTopCell();

                    if (ywalkCell.getPassageID().SetEquals(oldCurrentPassageID) ||
                        ywalkCell.getPassageID().SetEquals(oldNeighbourPassageID))
                    {
                        ywalkCell.setPassageID(newPassageID);
                    }
                }
            }
        }
コード例 #2
0
        private void xWalk(Int32 yWalk)
        {
            for (Int32 xWalk = 0; xWalk < this.Cell0x0.getGrid().getXLength(); xWalk++)
            {
                this.xWalkBuffer = xWalk == 0 ? this.yWalkBuffer : this.xWalkBuffer.getRightCell();

                if (yWalk == 0)
                {
                    this.bottomWall = xWalkBuffer.getBottomWall() ? this.bottomWall + "----" : this.bottomWall + "    ";
                    this.topWall    = xWalkBuffer.getTopWall() ? this.topWall + "----" : this.topWall + "    ";
                }
                else
                {
                    this.topWall = this.xWalkBuffer.getTopWall() ? this.topWall + "----" : this.topWall + "    ";
                }
                if (xWalk == 0)
                {
                    leftAndrightWalls = this.xWalkBuffer.getLeftWall() ? this.leftAndrightWalls + "|   " : this.leftAndrightWalls + "    ";
                    leftAndrightWalls = this.xWalkBuffer.getRightWall() ? this.leftAndrightWalls + "|   " : this.leftAndrightWalls + "    ";
                }
                else
                {
                    leftAndrightWalls = this.xWalkBuffer.getRightWall() ? this.leftAndrightWalls + "|   " : this.leftAndrightWalls + "    ";
                }
            }
        }