예제 #1
0
 public CellSet followStub(Cell cell, Cell blocked) {
   if (!isStub(cell)) return null;
   CellSet result = new CellSet();
   if (isBoundary(cell.getEast())) result.add(cell.getEast());
   else if (isBoundary(cell.getWest())) result.add(cell.getWest());
   else if (isBoundary(cell.getNorth())) result.add(cell.getNorth());
   else if (isBoundary(cell.getSouth())) result.add(cell.getSouth());
   if (result.contains(blocked)) result.remove(blocked);
   return result;
 }
예제 #2
0
 public CellSet followCrossOnLine(Cell cell, Cell blocked) {
   CellSet result = new CellSet();
   if (isHorizontalCrossOnLine(cell)) {
     result.add(cell.getEast());
     result.add(cell.getWest());
   } else if (isVerticalCrossOnLine(cell)) {
     result.add(cell.getNorth());
     result.add(cell.getSouth());
   }
   if (result.contains(blocked)) result.remove(blocked);
   return result;
 }
예제 #3
0
 public CellSet followIntersection(Cell cell, Cell blocked) {
   if (!isIntersection(cell)) return null;
   CellSet result = new CellSet();
   Cell cN = cell.getNorth();
   Cell cS = cell.getSouth();
   Cell cE = cell.getEast();
   Cell cW = cell.getWest();
   if (hasEntryPoint(cN, 6)) result.add(cN);
   if (hasEntryPoint(cS, 2)) result.add(cS);
   if (hasEntryPoint(cE, 8)) result.add(cE);
   if (hasEntryPoint(cW, 4)) result.add(cW);
   if (result.contains(blocked)) result.remove(blocked);
   return result;
 }
예제 #4
0
 public CellSet followLine(Cell cell, Cell blocked) {
   CellSet nextCells = followLine(cell);
   if (nextCells.contains(blocked)) nextCells.remove(blocked);
   return nextCells;
 }