mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-12 22:42:23 +00:00
Merge pull request #96 from bzz/add-unknown-lang
Java bindings: add some convenience
This commit is contained in:
commit
554c9254ae
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ benchmarks/output
|
|||||||
.ci
|
.ci
|
||||||
Makefile.main
|
Makefile.main
|
||||||
.shared
|
.shared
|
||||||
|
.idea
|
||||||
|
@ -5,6 +5,8 @@ import tech.sourced.enry.nativelib.*;
|
|||||||
import static tech.sourced.enry.GoUtils.*;
|
import static tech.sourced.enry.GoUtils.*;
|
||||||
|
|
||||||
public class Enry {
|
public class Enry {
|
||||||
|
public static final Guess unknownLanguage = new Guess("", false);
|
||||||
|
|
||||||
private static final EnryLibrary nativeLib = EnryLibrary.INSTANCE;
|
private static final EnryLibrary nativeLib = EnryLibrary.INSTANCE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,4 +20,32 @@ public class Guess {
|
|||||||
this.language = language;
|
this.language = language;
|
||||||
this.safe = safe;
|
this.safe = safe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Guess{" +
|
||||||
|
"language='" + language + '\'' + ", safe=" + safe +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
if (this == object) return true;
|
||||||
|
if (object == null || getClass() != object.getClass()) return false;
|
||||||
|
if (!super.equals(object)) return false;
|
||||||
|
|
||||||
|
Guess guess = (Guess) object;
|
||||||
|
|
||||||
|
if (safe != guess.safe) return false;
|
||||||
|
if (language != null ? !language.equals(guess.language) : guess.language != null) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = 23 * result + (language != null ? language.hashCode() : 0);
|
||||||
|
result = 23 * result + (safe ? 1 : 0);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user