net.amygdalum.util.text.linkeddawg.ByteNodesCompiler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compilerutils Show documentation
Show all versions of compilerutils Show documentation
Utility classes needed for search and compiler applications
The newest version!
package net.amygdalum.util.text.linkeddawg;
import java.util.IdentityHashMap;
import java.util.Map;
import net.amygdalum.util.text.ByteNode;
import net.amygdalum.util.text.NodeResolver;
public abstract class ByteNodesCompiler implements NodeResolver> {
private Map, ByteNode> compiled;
public ByteNodesCompiler() {
this.compiled = new IdentityHashMap<>();
}
@Override
public void compile(ByteNode node) {
compiled.put(node, compileNode(node));
}
protected abstract ByteNode compileNode(ByteNode node);
@Override
public ByteNode resolve(ByteNode node) {
ByteNode compiledNode = compiled.get(node);
if (compiledNode == null) {
return node;
}
return compiledNode;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy