package com.google.android.m4b.maps.bo;

import com.google.android.m4b.maps.bc.af;
import com.google.android.m4b.maps.bp.d;
import com.google.android.m4b.maps.bp.h;
import com.google.android.m4b.maps.bp.l;
import com.google.common.collect.Lists;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.List;

public final class g
  implements d, h, l
{
  private final List<Float> a = Lists.newArrayList();
  private List<Float> b;
  private List<Float> c;
  private List<Short> d;
  private List<Byte> e;
  private final boolean f = true;
  private final boolean g = false;
  private final boolean h = false;
  private int i = 12;
  private int j = 0;
  private int k = 0;
  private int l = 0;
  private final int m = 9;
  private ByteBuffer n;

  public g(int paramInt1, int paramInt2, boolean paramBoolean)
  {
    if (this.g)
    {
      this.i = (16 + this.i);
      this.c = Lists.newArrayListWithExpectedSize(paramInt1);
    }
    if (this.f)
    {
      this.i = (8 + this.i);
      this.b = Lists.newArrayListWithExpectedSize(paramInt1);
    }
    if (this.h)
    {
      this.e = Lists.newArrayListWithExpectedSize(paramInt1);
      this.i = (1 + this.i);
    }
    this.n = ByteBuffer.allocateDirect(paramInt1 * this.i).order(ByteOrder.nativeOrder());
  }

  public final int a()
  {
    c();
    return this.j;
  }

  public final void a(float paramFloat1, float paramFloat2)
  {
    this.l = (1 + this.l);
    if (!this.f)
      throw new IllegalStateException("Texture coordinate 0 not enabled in this VBO");
    this.b.add(Float.valueOf(paramFloat1));
    this.b.add(Float.valueOf(paramFloat2));
  }

  public final void a(float paramFloat1, float paramFloat2, float paramFloat3)
  {
    this.a.add(Float.valueOf(paramFloat1));
    this.a.add(Float.valueOf(paramFloat2));
    this.a.add(Float.valueOf(paramFloat3));
    this.j = (1 + this.j);
  }

  public final void a(int paramInt)
  {
    if (this.n == null)
      this.n = ByteBuffer.allocateDirect(paramInt * this.i).order(ByteOrder.nativeOrder());
    while (paramInt * this.i <= this.n.capacity())
      return;
    ByteBuffer localByteBuffer = ByteBuffer.allocateDirect(paramInt * this.i).order(ByteOrder.nativeOrder());
    if (this.n.position() != 0)
    {
      this.n.rewind();
      localByteBuffer.put(this.n);
    }
    this.n = localByteBuffer;
  }

  public final void a(int paramInt1, int paramInt2)
  {
    this.l = (1 + this.l);
    this.b.add(Float.valueOf(paramInt1 / 65536.0F));
    this.b.add(Float.valueOf(paramInt2 / 65536.0F));
  }

  public final void a(int paramInt1, int paramInt2, int paramInt3)
  {
    this.d.add(Short.valueOf((short)paramInt1));
    this.d.add(Short.valueOf((short)paramInt2));
    this.d.add(Short.valueOf((short)paramInt3));
    this.k = (3 + this.k);
  }

  public final void a(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    this.d.add(Short.valueOf((short)paramInt1));
    this.d.add(Short.valueOf((short)paramInt2));
    this.d.add(Short.valueOf((short)paramInt3));
    this.d.add(Short.valueOf((short)paramInt3));
    this.d.add(Short.valueOf((short)paramInt2));
    this.d.add(Short.valueOf((short)paramInt4));
    this.k = (6 + this.k);
  }

  public final void a(af paramaf, int paramInt)
  {
    this.a.add(Float.valueOf(paramaf.f() / paramInt));
    this.a.add(Float.valueOf(paramaf.g() / paramInt));
    this.a.add(Float.valueOf(paramaf.h() / paramInt));
    if (this.e != null)
      throw new RuntimeException("Expecting styleIndex");
    this.j = (1 + this.j);
  }

  public final void a(af paramaf, int paramInt, byte paramByte)
  {
    this.a.add(Float.valueOf(paramaf.f() / paramInt));
    this.a.add(Float.valueOf(paramaf.g() / paramInt));
    this.a.add(Float.valueOf(paramaf.h() / paramInt));
    if (this.e != null)
      this.e.add(Byte.valueOf(paramByte));
    this.j = (1 + this.j);
  }

  public final void a(int[] paramArrayOfInt)
  {
    this.l += paramArrayOfInt.length / 2;
    a(paramArrayOfInt, 0, paramArrayOfInt.length);
  }

  public final void a(int[] paramArrayOfInt, int paramInt1, int paramInt2)
  {
    this.l += paramInt2 / 2;
    for (int i1 = paramInt1; i1 < paramInt1 + paramInt2; i1++)
      this.b.add(Float.valueOf(paramArrayOfInt[i1] / 65536.0F));
  }

  public final int b()
  {
    return this.k;
  }

  public final void b(int paramInt)
  {
  }

  public final void c()
  {
    if (this.a.size() == 0);
    do
    {
      return;
      int i1 = this.a.size() / 3;
      if ((this.f) && (i1 != this.b.size() / 2))
        throw new RuntimeException("Buffer mismatch verts = " + i1 + "  tex coords = " + this.b.size());
      if ((this.g) && (i1 != this.c.size() / 4))
        throw new RuntimeException("Buffer mismatch");
      if ((this.h) && (i1 != this.e.size()))
        throw new RuntimeException("Buffer mismatch");
      int i2 = 0;
      while (true)
        if (i2 < i1)
          try
          {
            this.n.putFloat(((Float)this.a.get(i2 * 3)).floatValue());
            this.n.putFloat(((Float)this.a.get(1 + i2 * 3)).floatValue());
            this.n.putFloat(((Float)this.a.get(2 + i2 * 3)).floatValue());
            if (this.g)
            {
              this.n.putFloat(((Float)this.c.get(i2 * 4)).floatValue());
              this.n.putFloat(((Float)this.c.get(1 + i2 * 4)).floatValue());
              this.n.putFloat(((Float)this.c.get(2 + i2 * 4)).floatValue());
              this.n.putFloat(((Float)this.c.get(3 + i2 * 4)).floatValue());
            }
            if (this.f)
            {
              this.n.putFloat(((Float)this.b.get(i2 * 2)).floatValue());
              this.n.putFloat(((Float)this.b.get(1 + i2 * 2)).floatValue());
            }
            if (this.h)
              this.n.put(((Byte)this.e.get(i2)).byteValue());
            i2++;
          }
          catch (Exception localException)
          {
            localException.printStackTrace();
            System.exit(1);
          }
      this.a.clear();
      if (this.b != null)
        this.b.clear();
      if (this.c != null)
        this.c.clear();
    }
    while (this.e == null);
    this.e.clear();
  }

  public final void c(int paramInt)
  {
  }

  public final int d()
  {
    return this.m;
  }

  public final void d(int paramInt)
  {
    this.d.add(Short.valueOf((short)paramInt));
    this.k = (1 + this.k);
  }

  public final ByteBuffer e()
  {
    c();
    ByteBuffer localByteBuffer = this.n;
    localByteBuffer.rewind();
    this.n = null;
    return localByteBuffer;
  }

  public final void f()
  {
    if (this.d != null)
      this.d.clear();
    this.k = 0;
    this.j = 0;
    this.l = 0;
    this.a.clear();
    if (this.c != null)
      this.c.clear();
    if (this.b != null)
      this.b.clear();
    if (this.n != null)
      this.n.clear();
  }

  public final int g()
  {
    return this.l;
  }
}

/* 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.bo.g
 * JD-Core Version:    0.6.2
 */