/// <summary> /// Add a cellobject to the collection /// </summary> /// <param name="cell">Cellobject</param> public void addCell(AbstractCellData cell) { if (!this.checkCellExists(cell)) { this.cells.Add(cell); } }
/// <summary> /// method checks if a cell exists or not /// </summary> /// <param name="cell"></param> /// <returns>true if the cell exists and false if not</returns> public bool checkCellExists(AbstractCellData cell) { foreach (AbstractCellData var in this.cells) { if (var.Col == cell.Col) { return(true); } } return(false); }
/// <summary> /// Implements the compareble interface /// </summary> /// <param name="obj"></param> /// <returns></returns> int IComparable.CompareTo(object obj) { AbstractCellData cell = (AbstractCellData)obj; if (this.col > cell.col) { return(1); } if (this.col < cell.col) { return(-1); } else { return(0); } }