221 lines
5.3 KiB
Smali
221 lines
5.3 KiB
Smali
.class Lcom/google/common/collect/Ordering$ArbitraryOrdering;
|
|
.super Lcom/google/common/collect/Ordering;
|
|
.source "Ordering.java"
|
|
|
|
|
|
# annotations
|
|
.annotation build Lcom/google/common/annotations/VisibleForTesting;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/EnclosingClass;
|
|
value = Lcom/google/common/collect/Ordering;
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/InnerClass;
|
|
accessFlags = 0x9
|
|
name = "ArbitraryOrdering"
|
|
.end annotation
|
|
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Lcom/google/common/collect/Ordering<",
|
|
"Ljava/lang/Object;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
|
|
# instance fields
|
|
.field private final counter:Ljava/util/concurrent/atomic/AtomicInteger;
|
|
|
|
.field private final uids:Ljava/util/concurrent/ConcurrentMap;
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"Ljava/util/concurrent/ConcurrentMap<",
|
|
"Ljava/lang/Object;",
|
|
"Ljava/lang/Integer;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
.end field
|
|
|
|
|
|
# direct methods
|
|
.method public constructor <init>()V
|
|
.locals 2
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Lcom/google/common/collect/Ordering;-><init>()V
|
|
|
|
.line 2
|
|
new-instance v0, Ljava/util/concurrent/atomic/AtomicInteger;
|
|
|
|
const/4 v1, 0x0
|
|
|
|
invoke-direct {v0, v1}, Ljava/util/concurrent/atomic/AtomicInteger;-><init>(I)V
|
|
|
|
iput-object v0, p0, Lcom/google/common/collect/Ordering$ArbitraryOrdering;->counter:Ljava/util/concurrent/atomic/AtomicInteger;
|
|
|
|
.line 3
|
|
new-instance v0, Lcom/google/common/collect/MapMaker;
|
|
|
|
invoke-direct {v0}, Lcom/google/common/collect/MapMaker;-><init>()V
|
|
|
|
.line 4
|
|
invoke-static {v0}, Lcom/google/common/collect/Platform;->tryWeakKeys(Lcom/google/common/collect/MapMaker;)Lcom/google/common/collect/MapMaker;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-virtual {v0}, Lcom/google/common/collect/MapMaker;->makeMap()Ljava/util/concurrent/ConcurrentMap;
|
|
|
|
move-result-object v0
|
|
|
|
iput-object v0, p0, Lcom/google/common/collect/Ordering$ArbitraryOrdering;->uids:Ljava/util/concurrent/ConcurrentMap;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method private getUid(Ljava/lang/Object;)Ljava/lang/Integer;
|
|
.locals 2
|
|
|
|
.line 1
|
|
iget-object v0, p0, Lcom/google/common/collect/Ordering$ArbitraryOrdering;->uids:Ljava/util/concurrent/ConcurrentMap;
|
|
|
|
invoke-interface {v0, p1}, Ljava/util/concurrent/ConcurrentMap;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object v0
|
|
|
|
check-cast v0, Ljava/lang/Integer;
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
.line 2
|
|
iget-object v0, p0, Lcom/google/common/collect/Ordering$ArbitraryOrdering;->counter:Ljava/util/concurrent/atomic/AtomicInteger;
|
|
|
|
invoke-virtual {v0}, Ljava/util/concurrent/atomic/AtomicInteger;->getAndIncrement()I
|
|
|
|
move-result v0
|
|
|
|
invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
|
|
|
|
move-result-object v0
|
|
|
|
.line 3
|
|
iget-object v1, p0, Lcom/google/common/collect/Ordering$ArbitraryOrdering;->uids:Ljava/util/concurrent/ConcurrentMap;
|
|
|
|
invoke-interface {v1, p1, v0}, Ljava/util/concurrent/ConcurrentMap;->putIfAbsent(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p1
|
|
|
|
check-cast p1, Ljava/lang/Integer;
|
|
|
|
if-eqz p1, :cond_0
|
|
|
|
move-object v0, p1
|
|
|
|
:cond_0
|
|
return-object v0
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public compare(Ljava/lang/Object;Ljava/lang/Object;)I
|
|
.locals 4
|
|
.param p1 # Ljava/lang/Object;
|
|
.annotation runtime Ljavax/annotation/CheckForNull;
|
|
.end annotation
|
|
.end param
|
|
.param p2 # Ljava/lang/Object;
|
|
.annotation runtime Ljavax/annotation/CheckForNull;
|
|
.end annotation
|
|
.end param
|
|
|
|
if-ne p1, p2, :cond_0
|
|
|
|
const/4 p1, 0x0
|
|
|
|
return p1
|
|
|
|
:cond_0
|
|
const/4 v0, -0x1
|
|
|
|
if-nez p1, :cond_1
|
|
|
|
return v0
|
|
|
|
:cond_1
|
|
const/4 v1, 0x1
|
|
|
|
if-nez p2, :cond_2
|
|
|
|
return v1
|
|
|
|
.line 1
|
|
:cond_2
|
|
invoke-virtual {p0, p1}, Lcom/google/common/collect/Ordering$ArbitraryOrdering;->identityHashCode(Ljava/lang/Object;)I
|
|
|
|
move-result v2
|
|
|
|
.line 2
|
|
invoke-virtual {p0, p2}, Lcom/google/common/collect/Ordering$ArbitraryOrdering;->identityHashCode(Ljava/lang/Object;)I
|
|
|
|
move-result v3
|
|
|
|
if-eq v2, v3, :cond_4
|
|
|
|
if-ge v2, v3, :cond_3
|
|
|
|
goto :goto_0
|
|
|
|
:cond_3
|
|
move v0, v1
|
|
|
|
:goto_0
|
|
return v0
|
|
|
|
.line 3
|
|
:cond_4
|
|
invoke-direct {p0, p1}, Lcom/google/common/collect/Ordering$ArbitraryOrdering;->getUid(Ljava/lang/Object;)Ljava/lang/Integer;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p2}, Lcom/google/common/collect/Ordering$ArbitraryOrdering;->getUid(Ljava/lang/Object;)Ljava/lang/Integer;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/Integer;->compareTo(Ljava/lang/Integer;)I
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_5
|
|
|
|
return p1
|
|
|
|
.line 4
|
|
:cond_5
|
|
new-instance p1, Ljava/lang/AssertionError;
|
|
|
|
invoke-direct {p1}, Ljava/lang/AssertionError;-><init>()V
|
|
|
|
throw p1
|
|
.end method
|
|
|
|
.method public identityHashCode(Ljava/lang/Object;)I
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-static {p1}, Ljava/lang/System;->identityHashCode(Ljava/lang/Object;)I
|
|
|
|
move-result p1
|
|
|
|
return p1
|
|
.end method
|
|
|
|
.method public toString()Ljava/lang/String;
|
|
.locals 1
|
|
|
|
const-string v0, "Ordering.arbitrary()"
|
|
|
|
return-object v0
|
|
.end method
|