public AnalyzerCanvas(int numRows, int numColumns, AnalyzerCanvasNode[] nodes) { this.currentPosition = new RowColumnPosition(0, 0); this.numRows = numRows; this.numColumns = numColumns; this.nodes = nodes; }
private AnalyzerCanvasNode this[RowColumnPosition position] { get { return nodes[position.Row * numColumns + position.Column]; } }
private bool TryMove(RowColumnPosition position) { if (position.Row < 0 || position.Row >= numRows) { return false; } else if (position.Column < 0 || position.Column >= numColumns) { return false; } else if (this[position].IsVisited) { return false; } else if (this[position].IsWhite) { return false; } else { currentPosition = position; return true; } }
private void ForceMove(RowColumnPosition position) { if (position.Row < 0 || position.Row >= numRows) { throw new ArgumentOutOfRangeException("position.Row"); } else if (position.Column < 0 || position.Column >= numColumns) { throw new ArgumentOutOfRangeException("position.Column"); } else { currentPosition = position; } }