State node = root;
for( int i=1; i<path.length; i++ ) { // Start from 1, element 0 is always root
if( node.hasChild(path[i]) ) {
node = node.getChild(path[i]);
} else {
Type type = ( i == path.length-1 ) ? Type.LEAF : Type.INTERNAL;
State newNode = new State( path[i], type );
node.addChild(newNode);
if( ! nodes.containsKey(newNode.name() ) ) {
nodes.put( newNode.name(), newNode );
}