g.java 1.8 KB
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.Pools.Pool;
import android.support.v4.util.Pools.SimplePool;
import android.support.v4.util.SimpleArrayMap;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;

public final class g<T>
{
  public final Pools.Pool<ArrayList<T>> a = new Pools.SimplePool(10);
  public final SimpleArrayMap<T, ArrayList<T>> b = new SimpleArrayMap();
  private final ArrayList<T> c = new ArrayList();
  private final HashSet<T> d = new HashSet();
  
  private void a(T paramT, ArrayList<T> paramArrayList, HashSet<T> paramHashSet)
  {
    if (paramArrayList.contains(paramT)) {
      return;
    }
    if (paramHashSet.contains(paramT)) {
      throw new RuntimeException("This graph contains cyclic dependencies");
    }
    paramHashSet.add(paramT);
    ArrayList localArrayList = (ArrayList)this.b.get(paramT);
    if (localArrayList != null)
    {
      int i = 0;
      int j = localArrayList.size();
      while (i < j)
      {
        a(localArrayList.get(i), paramArrayList, paramHashSet);
        i += 1;
      }
    }
    paramHashSet.remove(paramT);
    paramArrayList.add(paramT);
  }
  
  @NonNull
  public final ArrayList<T> a()
  {
    this.c.clear();
    this.d.clear();
    int i = 0;
    int j = this.b.size();
    while (i < j)
    {
      a(this.b.keyAt(i), this.c, this.d);
      i += 1;
    }
    return this.c;
  }
  
  public final void a(@NonNull T paramT)
  {
    if (!this.b.containsKey(paramT)) {
      this.b.put(paramT, null);
    }
  }
  
  @Nullable
  public final List b(@NonNull T paramT)
  {
    return (List)this.b.get(paramT);
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/g.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */