示例#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;
     }
 }