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

jsclassloader.classes.ClassNameCharTree Maven / Gradle / Ivy

package jsclassloader.classes;

import java.util.List;


/**
 * Generates a tree of letter nodes from each class in the list added.
 */

public class ClassNameCharTree {
	
	private LetterNode root = new LetterNode(' ');
	
	ClassNameCharTree(){
	}
	
	public ClassNameCharTree(ClassFileSet finder){
		List allJsClasses = finder.getAllJsClasses();
		for (String classname : allJsClasses) {
			addClass(classname);
		}
	}
	
	public void addClass(String classname){
		
		LetterNode node = root;
		char[] chars = classname.toCharArray();
		for(int i = 0; i < chars.length; i++ ){
			node = node.addChild(chars[i]);
		}
		node.setClassEnd();
	}
	
	public LetterNode getRootNode(){
		return root;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy