code: private CollisionResult computeCollision(CollisionCategory category,
                                               double sh,
                                               double sv,
                                               double sx,
                                               double sy,
                                               int max)
      {
          double x = sh;
          double y = sv;
          double ox = x;
          double oy = y;
  
          boolean collX = false;
          boolean collY = false;
  
          CollisionResult last = null;
          for (int cur = 0; cur < max; cur++)
          {
              CollisionResult current = computeCollision(category, ox, oy, x, y);
              if (current != null)
              {
                  last = current;
                  if (current.getX() != null)
                  {
                      x = current.getX().doubleValue();
                      collX = true;
                  }
                  else
                  {
                      collX = false;
                  }
                  if (current.getY() != null)
                  {
                      y = current.getY().doubleValue();
                      oy = y;
                  }
              }
              else
              {
                  collX = false;
              }
  
              if (!collX)
              {
                  ox = x;
                  x += sx;
              }
  
              current = computeCollision(category, ox, oy, x, y);
              if (current != null)
              {
                  last = current;
                  if (current.getX() != null)
                  {
                      x = current.getX().doubleValue();
                  }
                  if (current.getY() != null)
                  {
                      y = current.getY().doubleValue();
                      collY = true;
                  }
                  else
                  {
                      collY = false;
                  }
              }
              else
              {
                  collY = false;
              }
  
              if (!collY)
              {
                  oy = y;
                  y += sy;
              }
          }
          if (category.isGlue())
          {
              if (last == null)
              {
                  last = computeCollision(category, ox, oy, x, y - 1);
              }
              if (last == null)
              {
                  last = computeCollision(category, ox, oy, x, y - 2);
              }
          }
          return last;
      }
docs: CHECKSTYLE IGNORE LINE: ExecutableStatementCount|CyclomaticComplexity|NPathComplexity