MatchResult class
Пакет: com.hypixel.hytale.server.core.command.system
Файл: com/hypixel/hytale/server/core/command/system/MatchResult.java
implements: Comparable<MatchResult>
Поля (3)
| Модификаторы | Тип | Имя |
|---|---|---|
final |
MatchResult |
NONE |
|
int |
var1 |
|
MatchResult |
var2 |
Методы (7)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
public |
int |
compareToint compareTo(@Nonnull MatchResult var1) |
public |
int |
getDepthint getDepth() |
public |
int |
getMatchint getMatch() |
public |
int |
getTypeint getType() |
|
|
if if(this.term < var1.term) |
|
|
if if(var1.term != this.term) |
|
|
if if(this == var1) |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.command.system;
class="kw">import com.hypixel.hytale.common.util.StringCompareUtil;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">public class MatchResult class="kw">implements Comparable<MatchResult> {
class="kw">public class="kw">static class="kw">final MatchResult NONE = new MatchResult(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
class="kw">public class="kw">static class="kw">final MatchResult EXACT = new MatchResult(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
class="kw">public class="kw">static class="kw">final int NAME = 0;
class="kw">public class="kw">static class="kw">final int ALIAS = 1;
class="kw">public class="kw">static class="kw">final int USAGE_ARG = 3;
class="kw">public class="kw">static class="kw">final int DESCRIPTION = 4;
class="kw">public class="kw">static class="kw">final int USAGE_DESCRIPTION = 5;
class="kw">private class="kw">final int term;
class="kw">private class="kw">final int depth;
class="kw">private class="kw">final int type;
class="kw">private class="kw">final int match;
@Nonnull
class="kw">public class="kw">static MatchResult of(int var0, int var1, int var2, @Nonnull String var3, @Nonnull String var4) {
class="kw">return new MatchResult(var0, var1, var2, StringCompareUtil.getLevenshteinDistance(var3, var4));
}
class="kw">public MatchResult(int var1, int var2, int var3, int var4) {
this.term = var1;
this.depth = var2;
this.type = var3;
this.match = var4;
}
class="kw">public int getDepth() {
class="kw">return this.depth;
}
class="kw">public int getType() {
class="kw">return this.type;
}
class="kw">public int getMatch() {
class="kw">return this.match;
}
@Nonnull
class="kw">public MatchResult min(@Nonnull MatchResult var1) {
if (this.term < var1.term) {
class="kw">return this;
} else if (this.term > var1.term) {
class="kw">return var1;
} else if (this.type < var1.type) {
class="kw">return this;
} else if (this.type > var1.type) {
class="kw">return var1;
} else if (this.depth < var1.depth) {
class="kw">return this;
} else if (this.depth > var1.depth) {
class="kw">return var1;
} else if (this.match < var1.match) {
class="kw">return this;
} else {
class="kw">return this.match > var1.match ? var1 : this;
}
}
class="kw">public int compareTo(@Nonnull MatchResult var1) {
if (var1.term != this.term) {
class="kw">return this.term - var1.term;
} else if (var1.type != this.type) {
class="kw">return this.type - var1.type;
} else {
class="kw">return var1.depth != this.depth ? this.depth - var1.depth : this.match - var1.match;
}
}
@Override
class="kw">public boolean equals(@Nullable Object var1) {
if (this == var1) {
class="kw">return true;
} else if (var1 != null && this.getClass() == var1.getClass()) {
MatchResult var2 = (MatchResult)var1;
class="kw">return this.depth != var2.depth ? false : this.match == var2.match;
} else {
class="kw">return false;
}
}
@Override
class="kw">public int hashCode() {
int var1 = this.depth;
class="kw">return 31 * var1 + this.match;
}
@Nonnull
@Override
class="kw">public String toString() {
class="kw">return "MatchResult{depth=" + this.depth + ", match=" + this.match + "}";
}
}