Ejemplo n.º 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);
        }
        public override bool Equals(object obj)
        {
            bool areEqual;

            if (obj == null)
            {
                areEqual = false;
            }
            else
            {
                Opening otherOpening = (Opening)obj;
                areEqual = position.Equals(otherOpening.GetPosition());
            }
            return(areEqual);
        }
Ejemplo n.º 3
0
 public void InsertOpening(Opening newOpening)
 {
     if (!PunctualComponentInRange(newOpening))
     {
         throw new OutOfRangeComponentException();
     }
     else
     {
         bool belongsToWall = BelongsToAWall(newOpening);
         if (!belongsToWall)
         {
             throw new ComponentOutOfWallException();
         }
         else if (!OccupiedPosition(newOpening) && FitsInItsWall(newOpening))
         {
             materials.AddOpening(newOpening);
         }
     }
 }
 public override void RemoveOpening(Opening anOpening)
 {
     punctualComponentManager.RemoveOpening(anOpening);
 }
 public override void InsertOpening(Opening newOpening)
 {
     punctualComponentManager.InsertOpening(newOpening);
 }
Ejemplo n.º 6
0
 public abstract void RemoveOpening(Opening toRemove);
Ejemplo n.º 7
0
 public abstract void InsertOpening(Opening newOpening);