net.amygdalum.util.text.linkeddawg.LinkedCharFallbackNavigator 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 static net.amygdalum.util.text.CharUtils.charToString;
import net.amygdalum.util.text.CharFallbackAdaptor;
import net.amygdalum.util.text.CharFallbackNavigator;
import net.amygdalum.util.text.CharNode;
import net.amygdalum.util.text.WordSetNavigationException;
public class LinkedCharFallbackNavigator implements CharFallbackNavigator> {
private CharNode node;
public LinkedCharFallbackNavigator(CharNode node) {
this.node = node;
}
@Override
public LinkedCharFallbackNavigator nextNode(char c) {
node = node.nextNode(c);
if (node == null) {
throw new WordSetNavigationException("unexpected navigation to " + charToString(c));
}
return this;
}
@Override
public LinkedCharFallbackNavigator fallback() {
node = CharFallbackAdaptor.getFallback(node);
return this;
}
@Override
public T getAttached() {
return node.getAttached();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy