// Path: tileview/src/main/java/com/moagrius/tileview/io/StreamProvider.java
// public interface StreamProvider {
//   InputStream getStream(int column, int row, Context context, Object data) throws Exception;
// }


import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Looper;
import android.os.Process;
import android.util.Log;
import com.moagrius.tileview.io.StreamProvider;
import java.io.InputStream;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
package com.moagrius.tileview;




public class Tile implements Runnable {

  private static final int UNSCALED_SAMPLE_SIZE = 1;

  enum State {
    IDLE, DECODING, DECODED
  }

  // variable (settable)
  private int mRow;
  private int mColumn;
  private int mImageSample = 1;
  private Detail mDetail;

  // variable (computed)
  private volatile State mState = State.IDLE;
  private Bitmap mBitmap;
  private int mRetries;

  // lazy
  private String mCacheKey;

  // final default
  private final Rect mDestinationRect = new Rect();
  private final BitmapFactory.Options mDrawingOptions = new TileOptions(false);
  private final BitmapFactory.Options mMeasureOptions = new TileOptions(true);

  // final
  private final int mSize;
  private final DrawingView mDrawingView;
  private final Listener mListener;
  private final StreamProvider mStreamProvider;
  private final TileView.BitmapCache mMemoryCache;
  private final TileView.BitmapCache mDiskCache;
  private final TileView.BitmapPool mBitmapPool;
  private final TileView.DiskCachePolicy mDiskCachePolicy;
  private final ThreadPoolExecutor mThreadPoolExecutor;
  private final ThreadPoolExecutor mDiskCacheExecutor;

// Path: tileview/src/main/java/com/moagrius/tileview/io/StreamProvider.java
// public interface StreamProvider {
//   InputStream getStream(int column, int row, Context context, Object data) throws Exception;
// }


// Path: tileview/src/main/java/com/moagrius/tileview/Tile.java
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.os.Looper;
import android.os.Process;
import android.util.Log;
import com.moagrius.tileview.io.StreamProvider;
import java.io.InputStream;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor;

package com.moagrius.tileview;




public class Tile implements Runnable {

  private static final int UNSCALED_SAMPLE_SIZE = 1;

  enum State {
    IDLE, DECODING, DECODED
  }

  // variable (settable)
  private int mRow;
  private int mColumn;
  private int mImageSample = 1;
  private Detail mDetail;

  // variable (computed)
  private volatile State mState = State.IDLE;
  private Bitmap mBitmap;
  private int mRetries;

  // lazy
  private String mCacheKey;

  // final default
  private final Rect mDestinationRect = new Rect();
  private final BitmapFactory.Options mDrawingOptions = new TileOptions(false);
  private final BitmapFactory.Options mMeasureOptions = new TileOptions(true);

  // final
  private final int mSize;
  private final DrawingView mDrawingView;
  private final Listener mListener;
  private final StreamProvider mStreamProvider;
  private final TileView.BitmapCache mMemoryCache;
  private final TileView.BitmapCache mDiskCache;
  private final TileView.BitmapPool mBitmapPool;
  private final TileView.DiskCachePolicy mDiskCachePolicy;
  private final ThreadPoolExecutor mThreadPoolExecutor;
  private final ThreadPoolExecutor mDiskCacheExecutor;

  public Tile(int size, Bitmap.Config bitmapConfig, DrawingView drawingView, Listener listener, ThreadPoolExecutor threadPoolExecutor, ThreadPoolExecutor diskCacheExecutor, StreamProvider streamProvider, TileView.BitmapCache memoryCache, TileView.BitmapCache diskCache, TileView.BitmapPool bitmapPool, TileView.DiskCachePolicy diskCachePolicy) {