// Signature format: 2.0
package com.android.ahat {

  public class Main {
    method public static void main(String[]);
  }

}

package com.android.ahat.dominators {

  public class Dominators<Node> {
    ctor public Dominators(com.android.ahat.dominators.Dominators.Graph);
    method public void computeDominators(Node);
    method public com.android.ahat.dominators.Dominators progress(com.android.ahat.progress.Progress, long);
  }

  public static interface Dominators.Graph<Node> {
    method public Object getDominatorsComputationState(Node);
    method public Iterable<? extends Node> getReferencesForDominators(Node);
    method public void setDominator(Node, Node);
    method public void setDominatorsComputationState(Node, Object);
  }

  @Deprecated public class DominatorsComputation {
    method @Deprecated public static void computeDominators(com.android.ahat.dominators.DominatorsComputation.Node);
    method @Deprecated public static void computeDominators(com.android.ahat.dominators.DominatorsComputation.Node, com.android.ahat.progress.Progress, long);
  }

  @Deprecated public static interface DominatorsComputation.Node {
    method @Deprecated public Object getDominatorsComputationState();
    method @Deprecated public Iterable<? extends Node> getReferencesForDominators();
    method @Deprecated public void setDominator(com.android.ahat.dominators.DominatorsComputation.Node);
    method @Deprecated public void setDominatorsComputationState(Object);
  }

}

package com.android.ahat.heapdump {

  public class AhatArrayInstance extends com.android.ahat.heapdump.AhatInstance {
    method public int getLength();
    method public com.android.ahat.heapdump.Value getValue(int);
    method public List<Value> getValues();
    method public String toString();
  }

  public class AhatClassInstance extends com.android.ahat.heapdump.AhatInstance {
    method public Iterable<FieldValue> getInstanceFields();
    method public String toString();
  }

  public class AhatClassObj extends com.android.ahat.heapdump.AhatInstance {
    method public com.android.ahat.heapdump.AhatInstance getClassLoader();
    method public com.android.ahat.heapdump.Field[] getInstanceFields();
    method public long getInstanceSize();
    method public String getName();
    method public List<FieldValue> getStaticFieldValues();
    method public com.android.ahat.heapdump.AhatClassObj getSuperClassObj();
    method public String toString();
  }

  public class AhatHeap implements com.android.ahat.heapdump.Diffable<com.android.ahat.heapdump.AhatHeap> {
    method public com.android.ahat.heapdump.AhatHeap getBaseline();
    method public String getName();
    method public com.android.ahat.heapdump.Size getSize();
    method public boolean isPlaceHolder();
  }

  public abstract class AhatInstance implements com.android.ahat.heapdump.Diffable<com.android.ahat.heapdump.AhatInstance> {
    method public com.android.ahat.heapdump.AhatArrayInstance asArrayInstance();
    method public BufferedImage asBitmap();
    method public com.android.ahat.heapdump.AhatClassInstance asClassInstance();
    method public com.android.ahat.heapdump.AhatClassObj asClassObj();
    method public String asString(int);
    method public String asString();
    method public com.android.ahat.heapdump.AhatInstance getAssociatedBitmapInstance();
    method public com.android.ahat.heapdump.AhatClassObj getAssociatedClassForOverhead();
    method public com.android.ahat.heapdump.AhatInstance getBaseline();
    method public String getBinderProxyInterfaceName();
    method public String getBinderStubInterfaceName();
    method public String getBinderTokenDescriptor();
    method public String getClassName();
    method public com.android.ahat.heapdump.AhatClassObj getClassObj();
    method public String getDexCacheLocation(int);
    method public List<AhatInstance> getDominated();
    method public com.android.ahat.heapdump.Value getField(String);
    method @Deprecated public List<AhatInstance> getHardReverseReferences();
    method public com.android.ahat.heapdump.AhatHeap getHeap();
    method public long getId();
    method public com.android.ahat.heapdump.AhatInstance getImmediateDominator();
    method public List<PathElement> getPathFromGcRoot();
    method public com.android.ahat.heapdump.Reachability getReachability();
    method public com.android.ahat.heapdump.AhatInstance getRefField(String);
    method public com.android.ahat.heapdump.AhatInstance getReferent();
    method public com.android.ahat.heapdump.Size getRetainedSize(com.android.ahat.heapdump.AhatHeap);
    method public List<AhatInstance> getReverseReferences();
    method public Collection<RootType> getRootTypes();
    method public com.android.ahat.heapdump.Site getSite();
    method public com.android.ahat.heapdump.Size getSize();
    method @Deprecated public List<AhatInstance> getSoftReverseReferences();
    method public com.android.ahat.heapdump.Size getTotalRetainedSize();
    method public boolean isArrayInstance();
    method public boolean isClassInstance();
    method public boolean isClassObj();
    method public boolean isInstanceOfClass(String);
    method public boolean isPlaceHolder();
    method public boolean isRoot();
    method public boolean isStronglyReachable();
    method public boolean isUnreachable();
    method @Deprecated public boolean isWeaklyReachable();
    method public abstract String toString();
  }

  public class AhatSnapshot implements com.android.ahat.heapdump.Diffable<com.android.ahat.heapdump.AhatSnapshot> {
    method public com.android.ahat.heapdump.AhatClassObj findClassObj(long);
    method public com.android.ahat.heapdump.AhatInstance findInstance(long);
    method public com.android.ahat.heapdump.AhatSnapshot getBaseline();
    method public com.android.ahat.heapdump.AhatHeap getHeap(String);
    method public List<AhatHeap> getHeaps();
    method public com.android.ahat.heapdump.Site getRootSite();
    method public List<AhatInstance> getRooted();
    method public com.android.ahat.heapdump.Site getSite(long);
    method public boolean isDiffed();
    method public boolean isPlaceHolder();
  }

  public class Diff {
    method public static void snapshots(com.android.ahat.heapdump.AhatSnapshot, com.android.ahat.heapdump.AhatSnapshot);
  }

  public class DiffFields {
    ctor public DiffFields();
    method public static List<DiffedFieldValue> diff(Iterable<FieldValue>, Iterable<FieldValue>);
  }

  public interface Diffable<T> {
    method public T getBaseline();
    method public boolean isPlaceHolder();
  }

  public class DiffedFieldValue {
    method public static com.android.ahat.heapdump.DiffedFieldValue added(com.android.ahat.heapdump.FieldValue);
    method public static com.android.ahat.heapdump.DiffedFieldValue deleted(com.android.ahat.heapdump.FieldValue);
    method public boolean equals(Object);
    method public int hashCode();
    method public static com.android.ahat.heapdump.DiffedFieldValue matched(com.android.ahat.heapdump.FieldValue, com.android.ahat.heapdump.FieldValue);
    method public String toString();
    field public final com.android.ahat.heapdump.Value baseline;
    field public final com.android.ahat.heapdump.Value current;
    field public final String name;
    field public final com.android.ahat.heapdump.DiffedFieldValue.Status status;
    field public final com.android.ahat.heapdump.Type type;
  }

  public enum DiffedFieldValue.Status {
    enum_constant public static final com.android.ahat.heapdump.DiffedFieldValue.Status ADDED;
    enum_constant public static final com.android.ahat.heapdump.DiffedFieldValue.Status DELETED;
    enum_constant public static final com.android.ahat.heapdump.DiffedFieldValue.Status MATCHED;
  }

  public class Field {
    ctor public Field(String, com.android.ahat.heapdump.Type);
    field public final String name;
    field public final com.android.ahat.heapdump.Type type;
  }

  public class FieldValue {
    ctor public FieldValue(String, com.android.ahat.heapdump.Type, com.android.ahat.heapdump.Value);
    field public final String name;
    field public final com.android.ahat.heapdump.Type type;
    field public final com.android.ahat.heapdump.Value value;
  }

  public class HprofFormatException {
  }

  public class Parser {
    ctor public Parser(ByteBuffer);
    ctor public Parser(File);
    method public com.android.ahat.heapdump.Parser map(com.android.ahat.proguard.ProguardMap);
    method public com.android.ahat.heapdump.AhatSnapshot parse() throws com.android.ahat.heapdump.HprofFormatException;
    method public static com.android.ahat.heapdump.AhatSnapshot parseHeapDump(File, com.android.ahat.proguard.ProguardMap) throws com.android.ahat.heapdump.HprofFormatException;
    method public static com.android.ahat.heapdump.AhatSnapshot parseHeapDump(ByteBuffer, com.android.ahat.proguard.ProguardMap) throws com.android.ahat.heapdump.HprofFormatException;
    method public com.android.ahat.heapdump.Parser progress(com.android.ahat.progress.Progress);
    method public com.android.ahat.heapdump.Parser retained(com.android.ahat.heapdump.Reachability);
  }

  public class PathElement implements com.android.ahat.heapdump.Diffable<com.android.ahat.heapdump.PathElement> {
    ctor public PathElement(com.android.ahat.heapdump.AhatInstance, String);
    method public com.android.ahat.heapdump.PathElement getBaseline();
    method public boolean isPlaceHolder();
    field public final String field;
    field public final com.android.ahat.heapdump.AhatInstance instance;
    field public boolean isDominator;
  }

  public enum Reachability {
    method public boolean notWeakerThan(com.android.ahat.heapdump.Reachability);
    method public String toString();
    enum_constant public static final com.android.ahat.heapdump.Reachability FINALIZER;
    enum_constant public static final com.android.ahat.heapdump.Reachability PHANTOM;
    enum_constant public static final com.android.ahat.heapdump.Reachability SOFT;
    enum_constant public static final com.android.ahat.heapdump.Reachability STRONG;
    enum_constant public static final com.android.ahat.heapdump.Reachability UNREACHABLE;
    enum_constant public static final com.android.ahat.heapdump.Reachability WEAK;
  }

  public enum RootType {
    enum_constant public static final com.android.ahat.heapdump.RootType DEBUGGER;
    enum_constant public static final com.android.ahat.heapdump.RootType FINALIZING;
    enum_constant public static final com.android.ahat.heapdump.RootType INTERNED_STRING;
    enum_constant public static final com.android.ahat.heapdump.RootType JAVA_FRAME;
    enum_constant public static final com.android.ahat.heapdump.RootType JNI_GLOBAL;
    enum_constant public static final com.android.ahat.heapdump.RootType JNI_LOCAL;
    enum_constant public static final com.android.ahat.heapdump.RootType JNI_MONITOR;
    enum_constant public static final com.android.ahat.heapdump.RootType MONITOR;
    enum_constant public static final com.android.ahat.heapdump.RootType NATIVE_STACK;
    enum_constant public static final com.android.ahat.heapdump.RootType STICKY_CLASS;
    enum_constant public static final com.android.ahat.heapdump.RootType THREAD;
    enum_constant public static final com.android.ahat.heapdump.RootType THREAD_BLOCK;
    enum_constant public static final com.android.ahat.heapdump.RootType UNKNOWN;
    enum_constant public static final com.android.ahat.heapdump.RootType VM_INTERNAL;
  }

  public class Site implements com.android.ahat.heapdump.Diffable<com.android.ahat.heapdump.Site> {
    method public com.android.ahat.heapdump.Site findSite(long);
    method public com.android.ahat.heapdump.Site getBaseline();
    method public List<Site> getChildren();
    method public String getFilename();
    method public long getId();
    method public int getLineNumber();
    method public String getMethodName();
    method public void getObjects(String, String, Collection<AhatInstance>);
    method public void getObjects(Predicate<AhatInstance>, Consumer<AhatInstance>);
    method public List<ObjectsInfo> getObjectsInfos();
    method public com.android.ahat.heapdump.Site getParent();
    method public String getSignature();
    method public com.android.ahat.heapdump.Size getSize(com.android.ahat.heapdump.AhatHeap);
    method public com.android.ahat.heapdump.Size getTotalSize();
    method public boolean isPlaceHolder();
  }

  public static class Site.ObjectsInfo implements com.android.ahat.heapdump.Diffable<com.android.ahat.heapdump.Site.ObjectsInfo> {
    method public com.android.ahat.heapdump.Site.ObjectsInfo getBaseline();
    method public String getClassName();
    method public boolean isPlaceHolder();
    field public com.android.ahat.heapdump.AhatClassObj classObj;
    field public com.android.ahat.heapdump.AhatHeap heap;
    field public com.android.ahat.heapdump.Size numBytes;
    field public long numInstances;
  }

  public class Size {
    ctor public Size(long, long);
    method public boolean equals(Object);
    method public long getJavaSize();
    method public long getRegisteredNativeSize();
    method public long getSize();
    method public int hashCode();
    method public boolean isZero();
    method public com.android.ahat.heapdump.Size plus(com.android.ahat.heapdump.Size);
    method public com.android.ahat.heapdump.Size plusRegisteredNativeSize(long);
    field public static com.android.ahat.heapdump.Size ZERO;
  }

  public class Sort {
    ctor public Sort();
    method public static Comparator<AhatInstance> defaultInstanceCompare(com.android.ahat.heapdump.AhatSnapshot);
    method public static Comparator<Site> defaultSiteCompare(com.android.ahat.heapdump.AhatSnapshot);
    method public static <T> Comparator<T> withPriority(Comparator<T>...);
    field public static final Comparator<FieldValue> FIELD_VALUE_BY_NAME;
    field public static final Comparator<FieldValue> FIELD_VALUE_BY_TYPE;
    field public static final Comparator<AhatInstance> INSTANCE_BY_TOTAL_RETAINED_SIZE;
    field public static final Comparator<Site.ObjectsInfo> OBJECTS_INFO_BY_CLASS_NAME;
    field public static final Comparator<Site.ObjectsInfo> OBJECTS_INFO_BY_HEAP_NAME;
    field public static final Comparator<Site.ObjectsInfo> OBJECTS_INFO_BY_SIZE;
    field public static final Comparator<Site> SITE_BY_TOTAL_SIZE;
    field public static final Comparator<Size> SIZE_BY_SIZE;
  }

  public enum Type {
    method public String toString();
    enum_constant public static final com.android.ahat.heapdump.Type BOOLEAN;
    enum_constant public static final com.android.ahat.heapdump.Type BYTE;
    enum_constant public static final com.android.ahat.heapdump.Type CHAR;
    enum_constant public static final com.android.ahat.heapdump.Type DOUBLE;
    enum_constant public static final com.android.ahat.heapdump.Type FLOAT;
    enum_constant public static final com.android.ahat.heapdump.Type INT;
    enum_constant public static final com.android.ahat.heapdump.Type LONG;
    enum_constant public static final com.android.ahat.heapdump.Type OBJECT;
    enum_constant public static final com.android.ahat.heapdump.Type SHORT;
    field public final String name;
  }

  public abstract class Value {
    method public com.android.ahat.heapdump.AhatInstance asAhatInstance();
    method public Byte asByte();
    method public Character asChar();
    method public Integer asInteger();
    method public Long asLong();
    method public abstract boolean equals(Object);
    method public static com.android.ahat.heapdump.Value getBaseline(com.android.ahat.heapdump.Value);
    method public static com.android.ahat.heapdump.Type getType(com.android.ahat.heapdump.Value);
    method public abstract int hashCode();
    method public boolean isAhatInstance();
    method public boolean isInteger();
    method public boolean isLong();
    method public static com.android.ahat.heapdump.Value pack(com.android.ahat.heapdump.AhatInstance);
    method public static com.android.ahat.heapdump.Value pack(boolean);
    method public static com.android.ahat.heapdump.Value pack(char);
    method public static com.android.ahat.heapdump.Value pack(float);
    method public static com.android.ahat.heapdump.Value pack(double);
    method public static com.android.ahat.heapdump.Value pack(byte);
    method public static com.android.ahat.heapdump.Value pack(short);
    method public static com.android.ahat.heapdump.Value pack(int);
    method public static com.android.ahat.heapdump.Value pack(long);
    method public abstract String toString();
  }

}

package com.android.ahat.progress {

  public class NullProgress implements com.android.ahat.progress.Progress {
    ctor public NullProgress();
    method public void advance(long);
    method public void done();
    method public void start(String, long);
    method public void update(long);
  }

  public interface Progress {
    method public default void advance();
    method public void advance(long);
    method public void done();
    method public void start(String, long);
    method public void update(long);
  }

}

package com.android.ahat.proguard {

  public class ProguardMap {
    ctor public ProguardMap();
    method public String getClassName(String);
    method public String getFieldName(String, String);
    method public com.android.ahat.proguard.ProguardMap.Frame getFrame(String, String, String, String, int);
    method public void readFromFile(File);
    method public void readFromReader(Reader);
  }

  public static class ProguardMap.Frame {
    field public final String filename;
    field public final int line;
    field public final String method;
    field public final String signature;
  }

}

