net.amygdalum.util.text.linkeddawg.CharNodesCompiler 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.CharNode;
import net.amygdalum.util.text.NodeResolver;
public abstract class CharNodesCompiler implements NodeResolver> {
private Map, CharNode> compiled;
public CharNodesCompiler() {
this.compiled = new IdentityHashMap<>();
}
@Override
public void compile(CharNode node) {
compiled.put(node, compileNode(node));
}
protected abstract CharNode compileNode(CharNode node);
@Override
public CharNode resolve(CharNode node) {
CharNode compiledNode = compiled.get(node);
if (compiledNode == null) {
return node;
}
return compiledNode;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy