/// <summary> /// Initializes a new instance of the CellClass. /// </summary> /// <param name="index">Index of the cell to create.</param> /// <param name="answer">The answer value for this cell.</param> internal CellClass(Int32 index, Int32 answer) { InitCell(); // Initialize the variables of this instance. CellIndex = new CellIndex(index); // Instantiate a new CellIndex class and save it. Answer = answer; // Save the answer. CellState = CellStateEnum.Answer; // Set the cell's state to Answer. }
/// <summary> /// Indicates whether this specified CellIndex is in the same region as this instance. /// </summary> /// <param name="uIndex">Another CellIndex instance to compare to.</param> /// <returns>Returns true if both instances are in the same region. Returns false otherwise.</returns> internal bool IsSameRegion(CellIndex uIndex) { if (uIndex != null) // IS the input parameter null? { return(uIndex.Region == Region); // No, then check if the region is the same. } return(false); // Yes, then return false. }
/// <summary> /// Indicates whether the specified CellIndex is on the same column as this instance. /// </summary> /// <param name="uIndex">Another CellIndex instance to compare to.</param> /// <returns>Returns true if both instances are on the same column. Returns false otherwise.</returns> internal bool IsSameColumn(CellIndex uIndex) { if (uIndex != null) // Is the input parameter null? { return(uIndex.Column == Column); // No, then check if the column is the same. } return(false); // Yes, then return false. }
/// <summary> /// Indicates whether the specified CellIndex is on the same row as this instance. /// </summary> /// <param name="uIndex">Another CellIndex instance to compare to.</param> /// <returns>Returns true if both instances are on the same row. Returns false otherwise.</returns> internal bool IsSameRow(CellIndex uIndex) { if (uIndex != null) // Is the input parameter null? { return(uIndex.Row == Row); // No, then check if the row is the same. } return(false); // Yes, then return false. }
/// <summary> /// Indicates whether the specified cell is in the same region as this instance. /// </summary> /// <param name="cell">The CellClass object to compare to.</param> /// <returns>Returns true if they are in the same region. Returns false otherwise.</returns> internal bool IsSameRegion(CellClass cell) { if (cell != null) // Is the input parameter null? { return(CellIndex.IsSameRegion(cell.CellIndex)); // No, then compare the region values. } return(false); // Yes, return false. }
private void InitCell(Int32 col, Int32 row) { InitCell(); // Initialize the cell instance. CellIndex = new CellIndex(col, row); // Instantiate the cell index. }