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

ptstemmer.support.datastructures.SuffixTreeNode Maven / Gradle / Ivy

The newest version!
/**
 * PTStemmer - A Stemming toolkit for the Portuguese language (C) 2008-2010 Pedro Oliveira
 * 
 * This file is part of PTStemmer.
 * PTStemmer is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * PTStemmer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with PTStemmer. If not, see .
 * 
 */
package ptstemmer.support.datastructures;

import java.util.HashMap;

/**
 * Object-oriented Suffix Tree node
 * @author Pedro Oliveira
 *
 * @param 
 */
public class SuffixTreeNode {

	private HashMap> edges;
	private T value;
	
	public SuffixTreeNode()
	{
		edges = new HashMap>(26);
	}
	
	public SuffixTreeNode(T value)
	{
		edges = new HashMap>(26);
		this.value = value;
	}
	
	/**
	 * Add edge to node
	 * @param c
	 * @param value
	 * @return
	 */
	public SuffixTreeNode addEdge(char c, T value)
	{
		SuffixTreeNode node = edges.get(c);
		if(node == null)
		{
			node = new SuffixTreeNode(value);
			edges.put(c, node);
		}
		return node;
	}
	
	public SuffixTreeNode getEdge(char c)
	{
		return edges.get(c);
	}
	
	public T getValue()
	{
		return value;
	}
	
	public void setValue(T value)
	{
		this.value = value;
	}	
	
	public String toString()
	{
		return "["+value+"]";
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy