예제 #1
0
 public AnalyzerCanvas(int numRows, int numColumns, AnalyzerCanvasNode[] nodes)
 {
     this.currentPosition = new RowColumnPosition(0, 0);
     this.numRows = numRows;
     this.numColumns = numColumns;
     this.nodes = nodes;
 }
예제 #2
0
 private AnalyzerCanvasNode this[RowColumnPosition position]
 {
     get { return nodes[position.Row * numColumns + position.Column]; }
 }
예제 #3
0
 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;
     }
 }
예제 #4
0
 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;
     }
 }