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

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

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

import net.amygdalum.util.map.CharObjectMap;
import net.amygdalum.util.text.AttachmentAdaptor;
import net.amygdalum.util.text.CharConnectionAdaptor;
import net.amygdalum.util.text.CharFallbackAdaptor;
import net.amygdalum.util.text.CharNode;

public class CharGenericFallbackNode implements CharNode, CharConnectionAdaptor, AttachmentAdaptor, CharFallbackAdaptor {

	private CharObjectMap> nexts;
	private T attached;
	private CharNode fallback;

	public CharGenericFallbackNode() {
		this.nexts = new CharObjectMap>(null);
	}
	
	@Override
	public void addNextNode(char c, CharNode node) {
		nexts.put(c, node);
	}

	@Override
	public CharNode nextNode(char c) {
		return nexts.get(c);
	}

	@Override
	public char[] getAlternatives() {
		return nexts.keys();
	}
	
	@Override
	public int getAlternativesSize() {
		return nexts.size();
	}

	@Override
	public void attach(T attached) {
		this.attached = attached;
	}

	@Override
	public T getAttached() {
		return attached;
	}

	@Override
	public CharNode getFallback() {
		return fallback;
	}

	@Override
	public void setFallback(CharNode fallbackNode) {
		this.fallback = fallbackNode;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy