package com.google.android.m4b.maps.bg;

import android.util.Pair;
import com.google.android.m4b.maps.aa.i;
import com.google.android.m4b.maps.at.a.a;
import com.google.android.m4b.maps.bc.aa;
import com.google.android.m4b.maps.bc.az;
import com.google.android.m4b.maps.bc.ba;
import com.google.android.m4b.maps.bc.bg;
import com.google.android.m4b.maps.be.g;
import com.google.android.m4b.maps.bl.ao;
import com.google.android.m4b.maps.z.b;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map;
import java.util.Queue;

public final class j
  implements c
{
  private static final az a = new aa();
  private static final byte[] b = new byte[0];
  private final String c;
  private final int d;
  private final c e;
  private final HashMap<ba, b> f;
  private e g;
  private final int h;
  private final bg i;
  private int j = 0;
  private b k = new b();
  private a l = null;

  public j(String paramString, int paramInt, c paramc, bg parambg, d paramd)
  {
    this.c = paramString;
    this.d = paramInt;
    this.e = paramc;
    this.h = Math.max(Math.min(256, 32 * (ao.f() >> 3)), 64);
    this.f = Maps.newHashMapWithExpectedSize(this.h);
    this.i = parambg;
    if (paramd != null)
      this.l = new a(this.i, paramd);
  }

  private boolean a(int paramInt, Locale paramLocale)
  {
    try
    {
      synchronized (this.f)
      {
        this.f.clear();
        this.g.a(paramInt, paramLocale);
        f();
        if (this.l != null)
          this.l.b();
        return true;
      }
    }
    catch (IOException localIOException)
    {
      com.google.android.m4b.maps.al.d.a("SDCardTileCache", localIOException);
    }
    return false;
  }

  private boolean b(File paramFile)
  {
    if (this.g != null)
      return true;
    a.a locala = new a.a(paramFile);
    this.k.c();
    try
    {
      this.g = e.a(this.c, locala, this.l);
      m = 0;
      if ((m != 0) || (g() != this.g.b()))
      {
        n = 1;
        if (n == 0);
      }
    }
    catch (IOException localIOException1)
    {
      try
      {
        while (true)
        {
          this.g = e.a(this.c, this.d, -1, new Locale(""), locala, this.l);
          f();
          if (this.l != null)
          {
            this.l.a();
            this.l.b();
          }
          this.k.c();
          return true;
          localIOException1 = localIOException1;
          int m = 1;
        }
        int n = 0;
      }
      catch (IOException localIOException2)
      {
        com.google.android.m4b.maps.al.d.a("SDCardTileCache", "Creating cache: " + localIOException2);
      }
    }
    return false;
  }

  private void f()
  {
    com.google.android.m4b.maps.ak.c localc = new com.google.android.m4b.maps.ak.c();
    localc.writeLong(this.g.b());
    com.google.android.m4b.maps.ak.e.e().c().a(localc.a(), "disk_creation_time_" + this.c);
  }

  @VisibleForTesting
  private long g()
  {
    byte[] arrayOfByte = com.google.android.m4b.maps.ak.e.e().c().c("disk_creation_time_" + this.c);
    if (arrayOfByte == null)
      return 0L;
    com.google.android.m4b.maps.ad.a locala = new com.google.android.m4b.maps.ad.a(arrayOfByte);
    try
    {
      long l1 = locala.readLong();
      return l1;
    }
    catch (IOException localIOException)
    {
      com.google.android.m4b.maps.ak.e.e().c().b("disk_creation_time_" + this.c);
    }
    return 0L;
  }

  public final void a(ba paramba, az paramaz)
  {
    throw new IllegalStateException("Don't store unencrypted tiles into SD cache.");
  }

  // ERROR //
  public final void a(ba paramba, az paramaz, byte[] paramArrayOfByte)
  {
    // Byte code:
    //   0: lconst_0
    //   1: lstore 4
    //   3: aload_0
    //   4: getfield 98	com/google/android/m4b/maps/bg/j:g	Lcom/google/android/m4b/maps/bg/e;
    //   7: ifnonnull +13 -> 20
    //   10: new 204	java/lang/IllegalStateException
    //   13: dup
    //   14: ldc 210
    //   16: invokespecial 207	java/lang/IllegalStateException:<init>	(Ljava/lang/String;)V
    //   19: athrow
    //   20: aload_2
    //   21: instanceof 212
    //   24: ifeq +13 -> 37
    //   27: new 214	java/lang/IllegalArgumentException
    //   30: dup
    //   31: ldc 216
    //   33: invokespecial 217	java/lang/IllegalArgumentException:<init>	(Ljava/lang/String;)V
    //   36: athrow
    //   37: aload_1
    //   38: invokevirtual 221	com/google/android/m4b/maps/bc/ba:b	()I
    //   41: bipush 21
    //   43: if_icmpgt +333 -> 376
    //   46: aload_0
    //   47: getfield 83	com/google/android/m4b/maps/bg/j:i	Lcom/google/android/m4b/maps/bc/bg;
    //   50: aload_1
    //   51: invokestatic 224	com/google/android/m4b/maps/al/d:a	(Lcom/google/android/m4b/maps/bc/bg;Lcom/google/android/m4b/maps/bc/ba;)Landroid/util/Pair;
    //   54: astore 6
    //   56: aload_3
    //   57: arraylength
    //   58: ifle +424 -> 482
    //   61: aload_2
    //   62: instanceof 226
    //   65: ifeq +404 -> 469
    //   68: aload_2
    //   69: checkcast 226	com/google/android/m4b/maps/bc/j
    //   72: invokeinterface 228 1 0
    //   77: lstore 28
    //   79: lload 28
    //   81: ldc2_w 229
    //   84: lcmp
    //   85: ifeq +377 -> 462
    //   88: lload 28
    //   90: aload_0
    //   91: getfield 49	com/google/android/m4b/maps/bg/j:k	Lcom/google/android/m4b/maps/z/b;
    //   94: invokevirtual 231	com/google/android/m4b/maps/z/b:b	()J
    //   97: lsub
    //   98: aload_0
    //   99: getfield 49	com/google/android/m4b/maps/bg/j:k	Lcom/google/android/m4b/maps/z/b;
    //   102: invokevirtual 232	com/google/android/m4b/maps/z/b:a	()J
    //   105: ladd
    //   106: lstore 28
    //   108: lload 28
    //   110: lload 4
    //   112: lcmp
    //   113: ifge +349 -> 462
    //   116: lload 4
    //   118: lstore 18
    //   120: aload_2
    //   121: checkcast 226	com/google/android/m4b/maps/bc/j
    //   124: invokeinterface 233 1 0
    //   129: lstore 30
    //   131: lload 30
    //   133: ldc2_w 229
    //   136: lcmp
    //   137: ifeq +318 -> 455
    //   140: lload 30
    //   142: aload_0
    //   143: getfield 49	com/google/android/m4b/maps/bg/j:k	Lcom/google/android/m4b/maps/z/b;
    //   146: invokevirtual 231	com/google/android/m4b/maps/z/b:b	()J
    //   149: lsub
    //   150: aload_0
    //   151: getfield 49	com/google/android/m4b/maps/bg/j:k	Lcom/google/android/m4b/maps/z/b;
    //   154: invokevirtual 232	com/google/android/m4b/maps/z/b:a	()J
    //   157: ladd
    //   158: lstore 30
    //   160: lload 30
    //   162: lload 4
    //   164: lcmp
    //   165: ifge +290 -> 455
    //   168: new 235	java/io/ByteArrayOutputStream
    //   171: dup
    //   172: bipush 24
    //   174: aload_3
    //   175: arraylength
    //   176: iadd
    //   177: invokespecial 238	java/io/ByteArrayOutputStream:<init>	(I)V
    //   180: astore 20
    //   182: new 240	java/io/DataOutputStream
    //   185: dup
    //   186: aload 20
    //   188: invokespecial 243	java/io/DataOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   191: astore 21
    //   193: aload 21
    //   195: bipush 24
    //   197: invokevirtual 246	java/io/DataOutputStream:writeInt	(I)V
    //   200: aload 21
    //   202: iconst_0
    //   203: invokevirtual 246	java/io/DataOutputStream:writeInt	(I)V
    //   206: aload 21
    //   208: lload 18
    //   210: invokevirtual 247	java/io/DataOutputStream:writeLong	(J)V
    //   213: aload 21
    //   215: lload 4
    //   217: invokevirtual 247	java/io/DataOutputStream:writeLong	(J)V
    //   220: aload 21
    //   222: aload_3
    //   223: invokevirtual 250	java/io/DataOutputStream:write	([B)V
    //   226: aload 20
    //   228: invokevirtual 253	java/io/ByteArrayOutputStream:toByteArray	()[B
    //   231: astore 7
    //   233: aload 21
    //   235: invokevirtual 256	java/io/DataOutputStream:close	()V
    //   238: aload 20
    //   240: invokevirtual 257	java/io/ByteArrayOutputStream:close	()V
    //   243: aload_0
    //   244: getfield 81	com/google/android/m4b/maps/bg/j:f	Ljava/util/HashMap;
    //   247: astore 8
    //   249: aload 8
    //   251: monitorenter
    //   252: aload_0
    //   253: getfield 81	com/google/android/m4b/maps/bg/j:f	Ljava/util/HashMap;
    //   256: aload_1
    //   257: invokevirtual 261	java/util/HashMap:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   260: checkcast 263	com/google/android/m4b/maps/bg/j$b
    //   263: astore 10
    //   265: aload 10
    //   267: ifnull +182 -> 449
    //   270: aload 10
    //   272: getfield 264	com/google/android/m4b/maps/bg/j$b:d	I
    //   275: iconst_0
    //   276: invokestatic 268	com/google/android/m4b/maps/be/g:a	(II)I
    //   279: istore 11
    //   281: aload 6
    //   283: getfield 274	android/util/Pair:first	Ljava/lang/Object;
    //   286: checkcast 276	java/lang/Long
    //   289: invokevirtual 279	java/lang/Long:longValue	()J
    //   292: lstore 12
    //   294: aload 6
    //   296: getfield 282	android/util/Pair:second	Ljava/lang/Object;
    //   299: checkcast 284	java/lang/String
    //   302: astore 14
    //   304: aload 10
    //   306: ifnull +119 -> 425
    //   309: aload 10
    //   311: getfield 287	com/google/android/m4b/maps/bg/j$b:h	Lcom/google/android/m4b/maps/bf/d;
    //   314: astore 15
    //   316: new 263	com/google/android/m4b/maps/bg/j$b
    //   319: dup
    //   320: lload 12
    //   322: aload 14
    //   324: iload 11
    //   326: aload 7
    //   328: aload_2
    //   329: aload 15
    //   331: invokespecial 290	com/google/android/m4b/maps/bg/j$b:<init>	(JLjava/lang/String;I[BLcom/google/android/m4b/maps/bc/az;Lcom/google/android/m4b/maps/bf/d;)V
    //   334: astore 16
    //   336: aload_0
    //   337: getfield 44	com/google/android/m4b/maps/bg/j:j	I
    //   340: aload_0
    //   341: getfield 73	com/google/android/m4b/maps/bg/j:h	I
    //   344: if_icmpge +29 -> 373
    //   347: aload_0
    //   348: getfield 81	com/google/android/m4b/maps/bg/j:f	Ljava/util/HashMap;
    //   351: aload_1
    //   352: aload 16
    //   354: invokevirtual 294	java/util/HashMap:put	(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    //   357: pop
    //   358: aload 10
    //   360: ifnonnull +13 -> 373
    //   363: aload_0
    //   364: iconst_1
    //   365: aload_0
    //   366: getfield 44	com/google/android/m4b/maps/bg/j:j	I
    //   369: iadd
    //   370: putfield 44	com/google/android/m4b/maps/bg/j:j	I
    //   373: aload 8
    //   375: monitorexit
    //   376: return
    //   377: astore 25
    //   379: aload 20
    //   381: invokevirtual 253	java/io/ByteArrayOutputStream:toByteArray	()[B
    //   384: astore 7
    //   386: aload 21
    //   388: invokevirtual 256	java/io/DataOutputStream:close	()V
    //   391: aload 20
    //   393: invokevirtual 257	java/io/ByteArrayOutputStream:close	()V
    //   396: goto -153 -> 243
    //   399: astore 26
    //   401: goto -158 -> 243
    //   404: astore 22
    //   406: aload 20
    //   408: invokevirtual 253	java/io/ByteArrayOutputStream:toByteArray	()[B
    //   411: pop
    //   412: aload 21
    //   414: invokevirtual 256	java/io/DataOutputStream:close	()V
    //   417: aload 20
    //   419: invokevirtual 257	java/io/ByteArrayOutputStream:close	()V
    //   422: aload 22
    //   424: athrow
    //   425: aconst_null
    //   426: astore 15
    //   428: goto -112 -> 316
    //   431: astore 9
    //   433: aload 8
    //   435: monitorexit
    //   436: aload 9
    //   438: athrow
    //   439: astore 24
    //   441: goto -19 -> 422
    //   444: astore 27
    //   446: goto -203 -> 243
    //   449: iconst_0
    //   450: istore 11
    //   452: goto -171 -> 281
    //   455: lload 30
    //   457: lstore 4
    //   459: goto -291 -> 168
    //   462: lload 28
    //   464: lstore 18
    //   466: goto -346 -> 120
    //   469: ldc2_w 229
    //   472: lstore 4
    //   474: ldc2_w 229
    //   477: lstore 18
    //   479: goto -311 -> 168
    //   482: aload_3
    //   483: astore 7
    //   485: goto -242 -> 243
    //
    // Exception table:
    //   from	to	target	type
    //   193	226	377	java/io/IOException
    //   386	396	399	java/io/IOException
    //   193	226	404	finally
    //   252	265	431	finally
    //   270	281	431	finally
    //   281	304	431	finally
    //   309	316	431	finally
    //   316	358	431	finally
    //   363	373	431	finally
    //   373	376	431	finally
    //   412	422	439	java/io/IOException
    //   233	243	444	java/io/IOException
  }

  public final void a(ba paramba, com.google.android.m4b.maps.bf.d paramd, int paramInt)
  {
    if (this.g == null)
      throw new IllegalStateException("Uninitialized");
    while (true)
    {
      synchronized (this.f)
      {
        b localb1 = (b)this.f.get(paramba);
        if (localb1 != null)
        {
          if (localb1.h != null)
          {
            if (paramd != null)
            {
              localObject2 = new com.google.android.m4b.maps.bf.a(localb1.h, paramd);
              if (localb1.f != null)
              {
                localb2 = new b(localb1.b, localb1.c, g.a(localb1.d, paramInt), localb1.e, localb1.f, (com.google.android.m4b.maps.bf.d)localObject2);
                this.f.put(paramba, localb2);
              }
            }
            else
            {
              localObject2 = localb1.h;
              continue;
            }
            b localb2 = new b(localb1.b, localb1.c, g.a(localb1.d, paramInt), paramba, (com.google.android.m4b.maps.bf.d)localObject2);
            continue;
          }
        }
        else
        {
          Pair localPair = com.google.android.m4b.maps.al.d.a(this.i, paramba);
          b localb3 = new b(((Long)localPair.first).longValue(), (String)localPair.second, paramInt, paramba, paramd);
          this.f.put(paramba, localb3);
        }
      }
      Object localObject2 = paramd;
    }
  }

  public final boolean a()
  {
    if (this.g == null)
      throw new IllegalStateException("Uninitialized");
    return a(this.g.a(), this.g.c());
  }

  public final boolean a(int paramInt)
  {
    if (this.g == null)
      throw new IllegalStateException("Uninitialized");
    try
    {
      this.g.a(paramInt);
      return true;
    }
    catch (IOException localIOException)
    {
      com.google.android.m4b.maps.al.d.a("SDCardTileCache", localIOException);
    }
    return false;
  }

  public final boolean a(az paramaz)
  {
    return paramaz == a;
  }

  public final boolean a(File paramFile)
  {
    try
    {
      com.google.android.m4b.maps.au.a.a();
      boolean bool = b(paramFile);
      com.google.android.m4b.maps.au.a.b();
      return bool;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public final boolean a(Locale paramLocale)
  {
    if (this.g == null)
      throw new IllegalStateException("Uninitialized");
    return a(this.g.a(), paramLocale);
  }

  public final byte[] a(ba paramba)
  {
    if (this.g == null)
      throw new IllegalStateException("Uninitialized");
    if (paramba.b() > 21)
      return null;
    while (true)
    {
      synchronized (this.f)
      {
        b localb = (b)this.f.get(paramba);
        if (localb == null)
          break label298;
        arrayOfByte1 = localb.e;
        if (arrayOfByte1 == null)
        {
          Pair localPair = com.google.android.m4b.maps.al.d.a(this.i, paramba);
          arrayOfByte1 = this.g.a(((Long)localPair.first).longValue(), (String)localPair.second);
        }
        if ((arrayOfByte1 == null) || (arrayOfByte1.length == 0))
          return arrayOfByte1;
      }
      try
      {
        int m = new DataInputStream(new ByteArrayInputStream(arrayOfByte1)).readInt();
        int n = arrayOfByte1.length - m;
        if ((n < 0) || (m > 24))
        {
          com.google.android.m4b.maps.al.d.a("SDCardTileCache", "invalid tile data length[" + arrayOfByte1.length + "] in " + this.c + ":" + paramba);
          return null;
        }
        arrayOfByte2 = new byte[n];
        try
        {
          System.arraycopy(arrayOfByte1, m, arrayOfByte2, 0, n);
          return arrayOfByte2;
        }
        catch (IOException localIOException2)
        {
        }
        com.google.android.m4b.maps.al.d.a("SDCardTileCache", "invalid tile data in " + this.c + ":" + paramba + ":" + localIOException2);
        return arrayOfByte2;
      }
      catch (IOException localIOException1)
      {
        while (true)
        {
          Object localObject2 = localIOException1;
          byte[] arrayOfByte2 = null;
        }
      }
      label298: byte[] arrayOfByte1 = null;
    }
  }

  public final void a_(ba paramba)
  {
    a(paramba, a, b);
  }

  public final boolean b()
  {
    return !this.f.isEmpty();
  }

  public final boolean b(ba paramba)
  {
    if (this.g == null)
      throw new IllegalStateException("Uninitialized");
    if (paramba.b() > 21)
      return false;
    Pair localPair = com.google.android.m4b.maps.al.d.a(this.i, paramba);
    if (this.g.b(((Long)localPair.first).longValue(), (String)localPair.second))
      return true;
    while (true)
    {
      synchronized (this.f)
      {
        b localb = (b)this.f.get(paramba);
        if ((localb != null) && (localb.e != null))
        {
          bool = true;
          return bool;
        }
      }
      boolean bool = false;
    }
  }

  public final int c()
  {
    if (this.g == null)
      throw new IllegalStateException("Uninitialized");
    return this.g.a();
  }

  public final az c(ba paramba)
  {
    long l1 = 0L;
    if (this.g == null)
      throw new IllegalStateException("Uninitialized");
    if (paramba.b() > 21)
      return null;
    synchronized (this.f)
    {
      b localb = (b)this.f.get(paramba);
      if (localb != null)
      {
        az localaz1 = localb.f;
        return localaz1;
      }
    }
    Pair localPair = com.google.android.m4b.maps.al.d.a(this.i, paramba);
    byte[] arrayOfByte = this.g.a(((Long)localPair.first).longValue(), (String)localPair.second);
    if (arrayOfByte == null)
      return null;
    while (true)
    {
      long l3;
      try
      {
        if (arrayOfByte.length == 0)
          return a;
        DataInputStream localDataInputStream = new DataInputStream(new ByteArrayInputStream(arrayOfByte));
        int m = localDataInputStream.readInt();
        localDataInputStream.readInt();
        long l2 = localDataInputStream.readLong();
        if (l2 != -1L)
        {
          l2 = l2 - this.k.a() + this.k.b();
          if (l2 < l1)
            l2 = l1;
        }
        if (m <= 16)
          break label341;
        l3 = localDataInputStream.readLong();
        if (l3 != -1L)
        {
          l3 = l3 - this.k.a() + this.k.b();
          if (l3 < l1)
          {
            az localaz2 = this.e.a(paramba, arrayOfByte, m, l2, l1);
            return localaz2;
          }
        }
      }
      catch (IOException localIOException)
      {
        com.google.android.m4b.maps.al.d.a("SDCardTileCache", "Could not unpack tile in " + this.c + ":" + paramba + ":" + localIOException);
        return null;
      }
      l1 = l3;
      continue;
      label341: l1 = -1L;
    }
  }

  public final Locale d()
  {
    if (this.g == null)
      throw new IllegalStateException("Uninitialized");
    return this.g.c();
  }

  public final void d_()
  {
    this.k.c();
    ArrayList localArrayList1 = Lists.newArrayList();
    ArrayList localArrayList2 = Lists.newArrayList();
    ArrayList localArrayList3 = Lists.newArrayList();
    while (true)
    {
      b localb2;
      synchronized (this.f)
      {
        Iterator localIterator1 = this.f.values().iterator();
        if (!localIterator1.hasNext())
          break label204;
        localb2 = (b)localIterator1.next();
        if (localb2.e != null);
        switch (localb2.a)
        {
        case 0:
          localArrayList1.add(e.a(localb2.b, localb2.c, localb2.d, localb2.e));
          if (this.l != null)
            this.l.a(localb2.f);
          if (localb2.h == null)
            continue;
          localArrayList2.add(Pair.create(localb2.h, localb2.f));
        case 1:
        }
      }
      localArrayList3.add(localb2);
      continue;
      label204: this.j = 0;
      this.f.clear();
      if (localArrayList1.size() > 0);
      while (true)
      {
        try
        {
          int i2 = this.g.a(localArrayList1);
          if (i2 != -1)
            break label467;
          i3 = 1;
          i1 = i3;
          Iterator localIterator3 = localArrayList2.iterator();
          if (localIterator3.hasNext())
          {
            Pair localPair = (Pair)localIterator3.next();
            ((com.google.android.m4b.maps.bf.d)localPair.first).a(((az)localPair.second).d(), i1, (az)localPair.second);
            continue;
          }
        }
        catch (IOException localIOException2)
        {
          com.google.android.m4b.maps.al.d.a("SDCardTileCache", localIOException2);
          int i1 = 1;
          continue;
        }
        Iterator localIterator2 = localArrayList3.iterator();
        b localb1;
        if (localIterator2.hasNext())
        {
          localb1 = (b)localIterator2.next();
          if (localb1.d <= 0)
            break label461;
        }
        while (true)
        {
          try
          {
            int n = this.g.a(localb1.b, localb1.c, localb1.d);
            if (n != -1)
              break label461;
            m = 2;
            if (localb1.h == null)
              break;
            localb1.h.a(localb1.g, m, null);
          }
          catch (IOException localIOException1)
          {
            m = 1;
            continue;
          }
          if (this.l != null)
          {
            this.l.c();
            this.l.b();
          }
          return;
          label461: int m = 0;
        }
        label467: int i3 = 0;
      }
    }
  }

  public final void e()
  {
    try
    {
      if (this.g == null)
        throw new IllegalStateException("Uninitialized");
    }
    finally
    {
    }
    try
    {
      this.g.d();
      return;
    }
    catch (IOException localIOException)
    {
      while (true)
        com.google.android.m4b.maps.al.d.a("SDCardTileCache", "shutDown(): " + localIOException);
    }
  }

  @VisibleForTesting
  static final class a
    implements f
  {
    private bg a;
    private Queue<a> b;
    private Map<ba, az> c;
    private d d;

    public a(bg parambg, d paramd)
    {
      this.a = parambg;
      this.b = new LinkedList();
      this.c = new HashMap();
      this.d = paramd;
    }

    public final void a()
    {
      this.b.clear();
      this.b.offer(new b((byte)0));
    }

    public final void a(int paramInt)
    {
      this.b.offer(new d(paramInt));
    }

    public final void a(long paramLong)
    {
      ba localba = com.google.android.m4b.maps.al.d.a(paramLong);
      if (localba != null)
        this.b.offer(new g(localba));
    }

    public final void a(long paramLong, int paramInt)
    {
      ba localba = com.google.android.m4b.maps.al.d.a(paramLong);
      az localaz = (az)this.c.remove(localba);
      if ((localba != null) && (localaz != null))
        this.b.offer(new e(localaz, paramInt));
    }

    public final void a(az paramaz)
    {
      this.c.put(paramaz.d(), paramaz);
    }

    public final void b()
    {
      while (this.b.size() > 0)
        ((a)this.b.poll()).a(this.d);
      if (this.c.size() > 0)
      {
        com.google.android.m4b.maps.al.d.a("SDCardTileCache", this.c.size() + " tiles were not inserted into the disk cache.");
        this.c.clear();
      }
    }

    public final void b(long paramLong, int paramInt)
    {
      ba localba = com.google.android.m4b.maps.al.d.a(paramLong);
      if (localba != null)
        this.b.offer(new f(localba, paramInt));
    }

    public final void c()
    {
      this.b.offer(new c((byte)0));
    }

    static abstract interface a
    {
      public abstract void a(d paramd);
    }

    final class b
      implements j.a.a
    {
      private b()
      {
      }

      public final void a(d paramd)
      {
        j.a.a(j.a.this);
      }
    }

    final class c
      implements j.a.a
    {
      private c()
      {
      }

      public final void a(d paramd)
      {
        j.a.a(j.a.this);
      }
    }

    final class d
      implements j.a.a
    {
      private int a;

      public d(int arg2)
      {
        int i;
        this.a = i;
      }

      public final void a(d paramd)
      {
        j.a.a(j.a.this);
      }
    }

    final class e
      implements j.a.a
    {
      private az a;
      private int b;

      public e(az paramInt, int arg3)
      {
        this.a = paramInt;
        int i;
        this.b = i;
      }

      public final void a(d paramd)
      {
        j.a.a(j.a.this);
      }
    }

    final class f
      implements j.a.a
    {
      private ba a;
      private int b;

      public f(ba paramInt, int arg3)
      {
        this.a = paramInt;
        int i;
        this.b = i;
      }

      public final void a(d paramd)
      {
        j.a.a(j.a.this);
      }
    }

    final class g
      implements j.a.a
    {
      private ba a;

      public g(ba arg2)
      {
        Object localObject;
        this.a = localObject;
      }

      public final void a(d paramd)
      {
        j.a.a(j.a.this);
      }
    }
  }

  static final class b
  {
    final int a;
    final long b;
    final String c;
    final int d;
    final byte[] e;
    final az f;
    final ba g;
    final com.google.android.m4b.maps.bf.d h;

    b(long paramLong, String paramString, int paramInt, ba paramba, com.google.android.m4b.maps.bf.d paramd)
    {
      this.a = 1;
      this.b = paramLong;
      this.c = paramString;
      this.d = paramInt;
      this.e = null;
      this.g = paramba;
      this.f = null;
      this.h = paramd;
    }

    b(long paramLong, String paramString, int paramInt, byte[] paramArrayOfByte, az paramaz, com.google.android.m4b.maps.bf.d paramd)
    {
      this.a = 0;
      this.b = paramLong;
      this.c = paramString;
      this.d = paramInt;
      this.e = paramArrayOfByte;
      if (paramaz == null);
      for (ba localba = null; ; localba = paramaz.d())
      {
        this.g = localba;
        this.f = paramaz;
        this.h = paramd;
        return;
      }
    }
  }

  public static abstract interface c
  {
    public abstract az a(ba paramba, byte[] paramArrayOfByte, int paramInt, long paramLong1, long paramLong2);
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.google.android.m4b.maps.bg.j
 * JD-Core Version:    0.6.2
 */