granularity level: instruction

		.class  Lcom/google/firebase/components/CycleDetector;
.super Ljava/lang/Object;
.source "CycleDetector.java"

.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/firebase/components/CycleDetector$ComponentNode;,
Lcom/google/firebase/components/CycleDetector$Dep;
}
.end annotation



.method constructor <init>()V
	.locals 0

	invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V
	return-void
.end method

.method static detect(Ljava/util/List;)V
	.locals 7
	.annotation system Ldalvik/annotation/Signature;
	value = {
	"(",
	"Ljava/util/List<",
	"Lcom/google/firebase/components/Component<",
	"*>;>;)V"
	}
	.end annotation

	invoke-static {p0}, Lcom/google/firebase/components/CycleDetector;->toGraph(Ljava/util/List;)Ljava/util/Set;
	move-result-object v0
	invoke-static {v0}, Lcom/google/firebase/components/CycleDetector;->getRoots(Ljava/util/Set;)Ljava/util/Set;
	move-result-object v1
	const/4 v2, 0x0
	:cond_0
	invoke-interface {v1}, Ljava/util/Set;->isEmpty()Z
	move-result v3
	if-nez v3, :cond_2
	invoke-interface {v1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
	move-result-object v3
	invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v3
	check-cast v3, Lcom/google/firebase/components/CycleDetector$ComponentNode;
	invoke-interface {v1, v3}, Ljava/util/Set;->remove(Ljava/lang/Object;)Z
	add-int/lit8 v2, v2, 0x1
	invoke-virtual {v3}, Lcom/google/firebase/components/CycleDetector$ComponentNode;->getDependencies()Ljava/util/Set;
	move-result-object v4
	invoke-interface {v4}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
	move-result-object v4
	:cond_1
	:goto_0
	invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z
	move-result v5
	if-eqz v5, :cond_0
	invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v5
	check-cast v5, Lcom/google/firebase/components/CycleDetector$ComponentNode;
	invoke-virtual {v5, v3}, Lcom/google/firebase/components/CycleDetector$ComponentNode;->removeDependent(Lcom/google/firebase/components/CycleDetector$ComponentNode;)V
	invoke-virtual {v5}, Lcom/google/firebase/components/CycleDetector$ComponentNode;->isRoot()Z
	move-result v6
	if-eqz v6, :cond_1
	invoke-interface {v1, v5}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
	goto :goto_0
	:cond_2
	invoke-interface {p0}, Ljava/util/List;->size()I
	move-result p0
	return-void
.end method

.method private static getRoots(Ljava/util/Set;)Ljava/util/Set;
	.locals 3
	.annotation system Ldalvik/annotation/Signature;
	value = {
	"(",
	"Ljava/util/Set<",
	"Lcom/google/firebase/components/CycleDetector$ComponentNode;",
	">;)",
	"Ljava/util/Set<",
	"Lcom/google/firebase/components/CycleDetector$ComponentNode;",
	">;"
	}
	.end annotation

	new-instance v0, Ljava/util/HashSet;
	invoke-direct {v0}, Ljava/util/HashSet;-><init>()V
	invoke-interface {p0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
	move-result-object p0
	:goto_0
	:cond_0
	invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
	move-result v1
	if-eqz v1, :cond_1
	invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v1
	check-cast v1, Lcom/google/firebase/components/CycleDetector$ComponentNode;
	invoke-virtual {v1}, Lcom/google/firebase/components/CycleDetector$ComponentNode;->isRoot()Z
	move-result v2
	if-eqz v2, :cond_0
	invoke-interface {v0, v1}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
	goto :goto_0
	:cond_1
	return-object v0
.end method

.method private static toGraph(Ljava/util/List;)Ljava/util/Set;
	.locals 10
	.annotation system Ldalvik/annotation/Signature;
	value = {
	"(",
	"Ljava/util/List<",
	"Lcom/google/firebase/components/Component<",
	"*>;>;)",
	"Ljava/util/Set<",
	"Lcom/google/firebase/components/CycleDetector$ComponentNode;",
	">;"
	}
	.end annotation

	new-instance v0, Ljava/util/HashMap;
	invoke-interface {p0}, Ljava/util/List;->size()I
	move-result v1
	invoke-direct {v0, v1}, Ljava/util/HashMap;-><init>(I)V
	invoke-interface {p0}, Ljava/util/List;->iterator()Ljava/util/Iterator;
	move-result-object p0
	:cond_0
	invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
	move-result v1
	const/4 v2, 0x0
	if-eqz v1, :cond_4
	invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v1
	check-cast v1, Lcom/google/firebase/components/Component;
	new-instance v3, Lcom/google/firebase/components/CycleDetector$ComponentNode;
	invoke-direct {v3, v1}, Lcom/google/firebase/components/CycleDetector$ComponentNode;-><init>(Lcom/google/firebase/components/Component;)V
	invoke-virtual {v1}, Lcom/google/firebase/components/Component;->getProvidedInterfaces()Ljava/util/Set;
	move-result-object v4
	invoke-interface {v4}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
	move-result-object v4
	:goto_0
	invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z
	move-result v5
	if-eqz v5, :cond_0
	invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v5
	check-cast v5, Ljava/lang/Class;
	new-instance v6, Lcom/google/firebase/components/CycleDetector$Dep;
	invoke-virtual {v1}, Lcom/google/firebase/components/Component;->isValue()Z
	move-result v7
	const/4 v8, 0x1
	xor-int/2addr v7, v8
	invoke-direct {v6, v5, v7, v2}, Lcom/google/firebase/components/CycleDetector$Dep;-><init>(Ljava/lang/Class;ZLcom/google/firebase/components/CycleDetector$1;)V
	invoke-interface {v0, v6}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
	move-result v7
	if-nez v7, :cond_1
	new-instance v7, Ljava/util/HashSet;
	invoke-direct {v7}, Ljava/util/HashSet;-><init>()V
	invoke-interface {v0, v6, v7}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
	:cond_1
	invoke-interface {v0, v6}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
	move-result-object v7
	check-cast v7, Ljava/util/Set;
	invoke-interface {v7}, Ljava/util/Set;->isEmpty()Z
	move-result v9
	if-nez v9, :cond_3
	invoke-static {v6}, Lcom/google/firebase/components/CycleDetector$Dep;->access$100(Lcom/google/firebase/components/CycleDetector$Dep;)Z
	move-result v6
	:cond_3
	invoke-interface {v7, v3}, Ljava/util/Set;->add(Ljava/lang/Object;)Z
	goto :goto_0
	:cond_4
	invoke-interface {v0}, Ljava/util/Map;->values()Ljava/util/Collection;
	move-result-object p0
	invoke-interface {p0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
	move-result-object p0
	:cond_5
	invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
	move-result v1
	if-eqz v1, :cond_a
	invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v1
	check-cast v1, Ljava/util/Set;
	invoke-interface {v1}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
	move-result-object v1
	:cond_6
	invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
	move-result v3
	if-eqz v3, :cond_5
	invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v3
	check-cast v3, Lcom/google/firebase/components/CycleDetector$ComponentNode;
	invoke-virtual {v3}, Lcom/google/firebase/components/CycleDetector$ComponentNode;->getComponent()Lcom/google/firebase/components/Component;
	move-result-object v4
	invoke-virtual {v4}, Lcom/google/firebase/components/Component;->getDependencies()Ljava/util/Set;
	move-result-object v4
	invoke-interface {v4}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
	move-result-object v4
	:goto_2
	:cond_7
	invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z
	move-result v5
	if-eqz v5, :cond_6
	invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v5
	check-cast v5, Lcom/google/firebase/components/Dependency;
	invoke-virtual {v5}, Lcom/google/firebase/components/Dependency;->isDirectInjection()Z
	move-result v6
	if-nez v6, :cond_8
	goto :goto_2
	:cond_8
	new-instance v6, Lcom/google/firebase/components/CycleDetector$Dep;
	invoke-virtual {v5}, Lcom/google/firebase/components/Dependency;->getInterface()Ljava/lang/Class;
	move-result-object v7
	invoke-virtual {v5}, Lcom/google/firebase/components/Dependency;->isSet()Z
	move-result v5
	invoke-direct {v6, v7, v5, v2}, Lcom/google/firebase/components/CycleDetector$Dep;-><init>(Ljava/lang/Class;ZLcom/google/firebase/components/CycleDetector$1;)V
	invoke-interface {v0, v6}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
	move-result-object v5
	check-cast v5, Ljava/util/Set;
	if-nez v5, :cond_9
	goto :goto_2
	:cond_9
	invoke-interface {v5}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
	move-result-object v5
	:goto_3
	invoke-interface {v5}, Ljava/util/Iterator;->hasNext()Z
	move-result v6
	if-eqz v6, :cond_7
	invoke-interface {v5}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v6
	check-cast v6, Lcom/google/firebase/components/CycleDetector$ComponentNode;
	invoke-virtual {v3, v6}, Lcom/google/firebase/components/CycleDetector$ComponentNode;->addDependency(Lcom/google/firebase/components/CycleDetector$ComponentNode;)V
	invoke-virtual {v6, v3}, Lcom/google/firebase/components/CycleDetector$ComponentNode;->addDependent(Lcom/google/firebase/components/CycleDetector$ComponentNode;)V
	goto :goto_3
	:cond_a
	new-instance p0, Ljava/util/HashSet;
	invoke-direct {p0}, Ljava/util/HashSet;-><init>()V
	invoke-interface {v0}, Ljava/util/Map;->values()Ljava/util/Collection;
	move-result-object v0
	invoke-interface {v0}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;
	move-result-object v0
	:goto_4
	invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
	move-result v1
	if-eqz v1, :cond_b
	invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
	move-result-object v1
	check-cast v1, Ljava/util/Set;
	invoke-virtual {p0, v1}, Ljava/util/HashSet;->addAll(Ljava/util/Collection;)Z
	goto :goto_4
	:cond_b
	return-object p0
.end method