/// <summary>Remove the cell from this region.</summary> /// <param name="cell">Cell to remove from this region.</param> public virtual void Remove(Cell cell) { _cells.Remove(cell); }
/// <summary>Add a cell to this region.</summary> /// <remarks>We maintain a set of cells. So adding the same cell twice will do nothing.</remarks> /// <param name="cell">Cell to add to this region.</param> public virtual void Add(Cell cell) { _cells.Add(cell); }
/// <summary>Check if this Region contains a cell.</summary> /// <param name="cell">The cell to check for.</param> /// <returns>True if contained, False otherwise.</returns> public virtual bool Contains(Cell cell) { return _cells.Contains(cell); }
/// <summary>A generic way to find a cell in a list of CellRegions</summary> /// <param name="cell">The cell to find.</param> /// <param name="regions">The regions to search.</param> /// <returns>The region containing the cell, null if none of the regions.</returns> protected virtual CellRegion GetRegionContainingCell(Cell cell, CellRegion[] regions) { foreach (CellRegion region in regions) { if (region.Contains(cell)) { return region; } } return null; }