mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
387 lines
8.3 KiB
Smali
387 lines
8.3 KiB
Smali
.class public abstract Lcom/google/zxing/oned/OneDimensionalCodeWriter;
|
|
.super Ljava/lang/Object;
|
|
.source "OneDimensionalCodeWriter.java"
|
|
|
|
# interfaces
|
|
.implements Lcom/google/zxing/Writer;
|
|
|
|
|
|
# static fields
|
|
.field private static final NUMERIC:Ljava/util/regex/Pattern;
|
|
|
|
|
|
# direct methods
|
|
.method static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
const-string v0, "[0-9]+"
|
|
|
|
.line 34
|
|
invoke-static {v0}, Ljava/util/regex/Pattern;->compile(Ljava/lang/String;)Ljava/util/regex/Pattern;
|
|
|
|
move-result-object v0
|
|
|
|
sput-object v0, Lcom/google/zxing/oned/OneDimensionalCodeWriter;->NUMERIC:Ljava/util/regex/Pattern;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 0
|
|
|
|
.line 33
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method protected static appendPattern([ZI[IZ)I
|
|
.locals 7
|
|
|
|
.line 123
|
|
array-length v0, p2
|
|
|
|
const/4 v1, 0x0
|
|
|
|
move v2, v1
|
|
|
|
move v3, v2
|
|
|
|
:goto_0
|
|
if-ge v2, v0, :cond_1
|
|
|
|
aget v4, p2, v2
|
|
|
|
move v5, v1
|
|
|
|
:goto_1
|
|
if-ge v5, v4, :cond_0
|
|
|
|
add-int/lit8 v6, p1, 0x1
|
|
|
|
.line 125
|
|
aput-boolean p3, p0, p1
|
|
|
|
add-int/lit8 v5, v5, 0x1
|
|
|
|
move p1, v6
|
|
|
|
goto :goto_1
|
|
|
|
:cond_0
|
|
add-int/2addr v3, v4
|
|
|
|
xor-int/lit8 p3, p3, 0x1
|
|
|
|
add-int/lit8 v2, v2, 0x1
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return v3
|
|
.end method
|
|
|
|
.method protected static checkNumeric(Ljava/lang/String;)V
|
|
.locals 1
|
|
|
|
sget-object v0, Lcom/google/zxing/oned/OneDimensionalCodeWriter;->NUMERIC:Ljava/util/regex/Pattern;
|
|
|
|
.line 108
|
|
invoke-virtual {v0, p0}, Ljava/util/regex/Pattern;->matcher(Ljava/lang/CharSequence;)Ljava/util/regex/Matcher;
|
|
|
|
move-result-object p0
|
|
|
|
invoke-virtual {p0}, Ljava/util/regex/Matcher;->matches()Z
|
|
|
|
move-result p0
|
|
|
|
if-eqz p0, :cond_0
|
|
|
|
return-void
|
|
|
|
.line 109
|
|
:cond_0
|
|
new-instance p0, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string v0, "Input should only contain digits 0-9"
|
|
|
|
invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method private static renderResult([ZIII)Lcom/google/zxing/common/BitMatrix;
|
|
.locals 5
|
|
|
|
.line 85
|
|
array-length v0, p0
|
|
|
|
add-int/2addr p3, v0
|
|
|
|
.line 88
|
|
invoke-static {p1, p3}, Ljava/lang/Math;->max(II)I
|
|
|
|
move-result p1
|
|
|
|
const/4 v1, 0x1
|
|
|
|
.line 89
|
|
invoke-static {v1, p2}, Ljava/lang/Math;->max(II)I
|
|
|
|
move-result p2
|
|
|
|
.line 91
|
|
div-int p3, p1, p3
|
|
|
|
mul-int v1, v0, p3
|
|
|
|
sub-int v1, p1, v1
|
|
|
|
.line 92
|
|
div-int/lit8 v1, v1, 0x2
|
|
|
|
.line 94
|
|
new-instance v2, Lcom/google/zxing/common/BitMatrix;
|
|
|
|
invoke-direct {v2, p1, p2}, Lcom/google/zxing/common/BitMatrix;-><init>(II)V
|
|
|
|
const/4 p1, 0x0
|
|
|
|
move v3, p1
|
|
|
|
:goto_0
|
|
if-ge v3, v0, :cond_1
|
|
|
|
.line 96
|
|
aget-boolean v4, p0, v3
|
|
|
|
if-eqz v4, :cond_0
|
|
|
|
.line 97
|
|
invoke-virtual {v2, v1, p1, p3, p2}, Lcom/google/zxing/common/BitMatrix;->setRegion(IIII)V
|
|
|
|
:cond_0
|
|
add-int/lit8 v3, v3, 0x1
|
|
|
|
add-int/2addr v1, p3
|
|
|
|
goto :goto_0
|
|
|
|
:cond_1
|
|
return-object v2
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public final encode(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;II)Lcom/google/zxing/common/BitMatrix;
|
|
.locals 6
|
|
|
|
const/4 v5, 0x0
|
|
|
|
move-object v0, p0
|
|
|
|
move-object v1, p1
|
|
|
|
move-object v2, p2
|
|
|
|
move v3, p3
|
|
|
|
move v4, p4
|
|
|
|
.line 38
|
|
invoke-virtual/range {v0 .. v5}, Lcom/google/zxing/oned/OneDimensionalCodeWriter;->encode(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;IILjava/util/Map;)Lcom/google/zxing/common/BitMatrix;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
.end method
|
|
|
|
.method public encode(Ljava/lang/String;Lcom/google/zxing/BarcodeFormat;IILjava/util/Map;)Lcom/google/zxing/common/BitMatrix;
|
|
.locals 2
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"(",
|
|
"Ljava/lang/String;",
|
|
"Lcom/google/zxing/BarcodeFormat;",
|
|
"II",
|
|
"Ljava/util/Map<",
|
|
"Lcom/google/zxing/EncodeHintType;",
|
|
"*>;)",
|
|
"Lcom/google/zxing/common/BitMatrix;"
|
|
}
|
|
.end annotation
|
|
|
|
.line 54
|
|
invoke-virtual {p1}, Ljava/lang/String;->isEmpty()Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_4
|
|
|
|
if-ltz p3, :cond_3
|
|
|
|
if-ltz p4, :cond_3
|
|
|
|
.line 62
|
|
invoke-virtual {p0}, Lcom/google/zxing/oned/OneDimensionalCodeWriter;->getSupportedWriteFormats()Ljava/util/Collection;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_1
|
|
|
|
.line 63
|
|
invoke-interface {v0, p2}, Ljava/util/Collection;->contains(Ljava/lang/Object;)Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_0
|
|
|
|
goto :goto_0
|
|
|
|
.line 64
|
|
:cond_0
|
|
new-instance p0, Ljava/lang/IllegalArgumentException;
|
|
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
const-string p3, "Can only encode "
|
|
|
|
invoke-direct {p1, p3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
const-string p3, ", but got "
|
|
|
|
invoke-virtual {p1, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p0
|
|
|
|
.line 68
|
|
:cond_1
|
|
:goto_0
|
|
invoke-virtual {p0}, Lcom/google/zxing/oned/OneDimensionalCodeWriter;->getDefaultMargin()I
|
|
|
|
move-result p2
|
|
|
|
if-eqz p5, :cond_2
|
|
|
|
.line 69
|
|
sget-object v0, Lcom/google/zxing/EncodeHintType;->MARGIN:Lcom/google/zxing/EncodeHintType;
|
|
|
|
invoke-interface {p5, v0}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z
|
|
|
|
move-result v0
|
|
|
|
if-eqz v0, :cond_2
|
|
|
|
.line 70
|
|
sget-object p2, Lcom/google/zxing/EncodeHintType;->MARGIN:Lcom/google/zxing/EncodeHintType;
|
|
|
|
invoke-interface {p5, p2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-virtual {p2}, Ljava/lang/Object;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p2
|
|
|
|
invoke-static {p2}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
|
|
|
|
move-result p2
|
|
|
|
.line 73
|
|
:cond_2
|
|
invoke-virtual {p0, p1}, Lcom/google/zxing/oned/OneDimensionalCodeWriter;->encode(Ljava/lang/String;)[Z
|
|
|
|
move-result-object p0
|
|
|
|
.line 74
|
|
invoke-static {p0, p3, p4, p2}, Lcom/google/zxing/oned/OneDimensionalCodeWriter;->renderResult([ZIII)Lcom/google/zxing/common/BitMatrix;
|
|
|
|
move-result-object p0
|
|
|
|
return-object p0
|
|
|
|
.line 59
|
|
:cond_3
|
|
new-instance p0, Ljava/lang/IllegalArgumentException;
|
|
|
|
new-instance p1, Ljava/lang/StringBuilder;
|
|
|
|
const-string p2, "Negative size is not allowed. Input: "
|
|
|
|
invoke-direct {p1, p2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
|
|
|
|
invoke-virtual {p1, p3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
const/16 p2, 0x78
|
|
|
|
invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1, p4}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p0
|
|
|
|
.line 55
|
|
:cond_4
|
|
new-instance p0, Ljava/lang/IllegalArgumentException;
|
|
|
|
const-string p1, "Found empty contents"
|
|
|
|
invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p0
|
|
.end method
|
|
|
|
.method public abstract encode(Ljava/lang/String;)[Z
|
|
.end method
|
|
|
|
.method public getDefaultMargin()I
|
|
.locals 0
|
|
|
|
const/16 p0, 0xa
|
|
|
|
return p0
|
|
.end method
|
|
|
|
.method protected getSupportedWriteFormats()Ljava/util/Collection;
|
|
.locals 0
|
|
.annotation system Ldalvik/annotation/Signature;
|
|
value = {
|
|
"()",
|
|
"Ljava/util/Collection<",
|
|
"Lcom/google/zxing/BarcodeFormat;",
|
|
">;"
|
|
}
|
|
.end annotation
|
|
|
|
const/4 p0, 0x0
|
|
|
|
return-object p0
|
|
.end method
|