All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.amygdalum.util.text.linkeddawg.LinkedCharNavigator Maven / Gradle / Ivy

The newest version!
package net.amygdalum.util.text.linkeddawg;

import static net.amygdalum.util.text.CharUtils.charToString;

import net.amygdalum.util.text.CharNavigator;
import net.amygdalum.util.text.CharNode;
import net.amygdalum.util.text.WordSetNavigationException;

public class LinkedCharNavigator implements CharNavigator> {

	private CharNode node;

	public LinkedCharNavigator(CharNode node) {
		this.node = node;
	}

	@Override
	public LinkedCharNavigator nextNode(char c) {
		node = node.nextNode(c);
		if (node == null) {
			throw new WordSetNavigationException("unexpected navigation to " + charToString(c));
		}
		return this;
	}

	@Override
	public T getAttached() {
		return node.getAttached();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy