コード例 #1
0
        private bool FitsInItsWall(Opening newOpening)
        {
            Wall itsWall = materials.GetWalls().FirstOrDefault(w => w.DoesContainComponent(newOpening));
            Wall pieceThatWouldOccupy = PieceOfOccupiedWall(newOpening, itsWall);

            bool fits = false;

            if (!OutOfWallBorder(pieceThatWouldOccupy, itsWall))
            {
                ICollection <Opening> thatWallsOpenings = materials.GetOpenings().Where(o => itsWall.DoesContainComponent(o)).ToList();
                fits = !thatWallsOpenings.Any(o => PieceOfOccupiedWall(o, itsWall).Overlaps(pieceThatWouldOccupy));
            }
            return(fits);
        }
コード例 #2
0
 public override ICollection <Wall> GetWalls()
 {
     return((ICollection <Wall>)materials.GetWalls());
 }
コード例 #3
0
 private bool TakesOtherWallsPlace(Wall newWall)
 {
     return(materials.GetWalls().Any(wall => wall.Overlaps(newWall)));
 }