boolean findCellForSpanThatIntersectsIgnoring(int[] cellXY,int spanX,int spanY,int intersectX,int intersectY,View ignoreView,boolean occupied[][]){
  markCellsAsUnoccupiedForView(ignoreView,occupied);
  boolean foundCell=false;
  while (true) {
    int startX=0;
    if (intersectX >= 0) {
      startX=Math.max(startX,intersectX - (spanX - 1));
    }
    int endX=mCountX - (spanX - 1);
    if (intersectX >= 0) {
      endX=Math.min(endX,intersectX + (spanX - 1) + (spanX == 1 ? 1 : 0));
    }
    int startY=0;
    if (intersectY >= 0) {
      startY=Math.max(startY,intersectY - (spanY - 1));
    }
    int endY=mCountY - (spanY - 1);
    if (intersectY >= 0) {
      endY=Math.min(endY,intersectY + (spanY - 1) + (spanY == 1 ? 1 : 0));
    }
    for (int y=startY; y < endY && !foundCell; y++) {
      inner:       for (int x=startX; x < endX; x++) {
        for (int i=0; i < spanX; i++) {
          for (int j=0; j < spanY; j++) {
            if (occupied[x + i][y + j]) {
              x+=i;
              continue inner;
            }
          }
        }
        if (cellXY != null) {
          cellXY[0]=x;
          cellXY[1]=y;
        }
        foundCell=true;
        break;
      }
    }
    if (intersectX == -1 && intersectY == -1) {
      break;
    }
 else {
      intersectX=-1;
      intersectY=-1;
      continue;
    }
  }
  markCellsAsOccupiedForView(ignoreView,occupied);
  return foundCell;
}

boolean findCellForSpanThatIntersectsIgnoring ( int [ ] cellXY , int spanX , int spanY , int intersectX , int intersectY , View ignoreView , boolean occupied [ ] [ ] ) { markCellsAsUnoccupiedForView ( ignoreView , occupied ) ; boolean foundCell = false ; while ( true ) { int startX = 0 ; if ( intersectX >= 0 ) { startX = Math . max ( startX , intersectX - ( spanX - 1 ) ) ; } int endX = mCountX - ( spanX - 1 ) ; if ( intersectX >= 0 ) { endX = Math . min ( endX , intersectX + ( spanX - 1 ) + ( spanX == 1 ? 1 : 0 ) ) ; } int startY = 0 ; if ( intersectY >= 0 ) { startY = Math . max ( startY , intersectY - ( spanY - 1 ) ) ; } int endY = mCountY - ( spanY - 1 ) ; if ( intersectY >= 0 ) { endY = Math . min ( endY , intersectY + ( spanY - 1 ) + ( spanY == 1 ? 1 : 0 ) ) ; } for ( int y = startY ; y < endY && ! foundCell ; y ++ ) { inner : for ( int x = startX ; x < endX ; x ++ ) { for ( int i = 0 ; i < spanX ; i ++ ) { for ( int j = 0 ; j < spanY ; j ++ ) { if ( occupied [ x + i ] [ y + j ] ) { x += i ; continue inner ; } } } if ( cellXY != null ) { cellXY [ 0 ] = x ; cellXY [ 1 ] = y ; } foundCell = true ; break ; } } if ( intersectX == - 1 && intersectY == - 1 ) { break ; } else { intersectX = - 1 ; intersectY = - 1 ; continue ; } } markCellsAsOccupiedForView ( ignoreView , occupied ) ; return foundCell ; }
the superset of the above two methods
