}  if (((pm != null) && (pm.isCanceled())) || stopFlag == true) { finished(); return;
   public void run()   {      int tileX;      int tileY;      int xoffset;      int yoffset;      int xcount;      int ycount;      int xleftover;      int yleftover;      int i;      theMachines = new Machine[3];      for (i = 0; i < expressions.length; i++)      {         theMachines[i] = expressions[i].getMachine();      }      // calculate how many tiles there will be      xcount = width / tileSize;      ycount = height / tileSize;      // calculate how much space is left over in the image      // after it's been broken into tiles      xleftover = width % tileSize;      yleftover = height % tileSize;      for (tileY = 0; tileY < ycount; tileY++)      {         yoffset = tileY * tileSize;         for (tileX = 0; tileX < xcount; tileX++)         {            xoffset = tileX * tileSize;            drawTile(xoffset, yoffset, tileSize, tileSize);            if (pm != null)            {               pm.incrementProgress(pmIncrement);            }         }         if (xleftover != 0)         {            xoffset = xcount * tileSize;            drawTile(xoffset, yoffset, xleftover, tileSize);            if (pm != null)            {               pm.incrementProgress(tileSize * xleftover);            }         }      }      if (yleftover != 0)      {         yoffset = ycount * tileSize;         for (tileX = 0; tileX < xcount; tileX++)         {            xoffset = tileX * tileSize;            drawTile(xoffset, yoffset, tileSize, yleftover);                        if (pm != null)            {               pm.incrementProgress(tileSize * yleftover);            }         }         if (xleftover != 0)         {            xoffset = xcount * tileSize;            drawTile(xoffset, yoffset, xleftover, yleftover);                        if (pm != null)            {               pm.incrementProgress(xleftover * yleftover);            }         }      }      finished();   }