net.sourceforge.plantuml.dedication.TinyHashableString Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plantuml-mit Show documentation
Show all versions of plantuml-mit Show documentation
PlantUML is a component that allows to quickly write diagrams from text.
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package net.sourceforge.plantuml.dedication;
import static java.nio.charset.StandardCharsets.UTF_8;
public final class TinyHashableString {
private final String sentence;
private int cachedTinyHash = -1;
public TinyHashableString(String sentence) {
this.sentence = sentence;
}
public String getSentence() {
return sentence;
}
public synchronized int tinyHash() {
if (cachedTinyHash == -1)
cachedTinyHash = Noise.shortHash(sentence.getBytes(UTF_8), Dedication.N.toByteArray());
return cachedTinyHash;
}
}