view src/main/java/jungle/impl/SimpleTree.java @ 7:c3c65308a11b

removed some package and added Graph API
author shoshi <shoshi@cr.ie.u-ryukyu.ac.jp>
date Fri, 29 Jun 2012 00:03:12 +0900
parents 1a5eaf5ce085
children bb96e631f022
line wrap: on
line source

package jungle.impl;

import jungle.core.Children;
import jungle.core.Editor;
import jungle.core.Links;
import jungle.core.Tree;
import jungle.core.TreeGroup;
import jungle.core.graph.Graph;
import jungle.core.graph.Vertex;

public class SimpleTree implements Tree
{
	private final SimpleTreeGroup group;
	private final Graph graph;
	private final Vertex vertex;
	
	public SimpleTree(SimpleTreeGroup _group,Vertex _vertex,Graph _graph)
	{
		group = _group;
		graph = _graph;
		vertex = _vertex;
		
		// initialize vertex
		vertex.createVertexes(Simples.TREENODE_CHILDREN_KEY);
		vertex.createVertexes(Simples.TREENODE_LINKS_KEY);
	}
	
	public TreeGroup getGroup()
	{
		return group;
	}
	
	public String get(String _key)
	{
		return vertex.getProperty(_key);
	}

	public String treeID()
	{
		return vertex.getID();
	}
	
	public Children children()
	{
		return new SimpleChildren(group,vertex.getVertexes(Simples.TREENODE_CHILDREN_KEY),graph);
	}
	
	public Links links()
	{
		return new SimpleLinks(group,vertex.getVertexes(Simples.TREENODE_LINKS_KEY),graph);
	}
	
	public Editor getEditor()
	{
		return null;
	}
}