package jParser.graph.node.tree.impl;

import java.util.HashMap;
import java.util.LinkedHashMap;

import jParser.graph.node.impl.AbstractHashNode;
import jParser.graph.node.tree.HashTree;

/**
 * Base abstract implementation of a {@link HashTree}.
 * @param <K>
 * @param <V>
 */
public abstract class AbstractHashTree<K, V extends HashTree<K, V>> extends AbstractHashNode<K, V> implements HashTree<K, V> {

	/**
	 * Child hash trees of this hash tree.
	 */
	private HashMap<K, V> children = new LinkedHashMap<>(); 

	/*
	 * (non-Javadoc)
	 *
	 * @see jParser.tree.HashTree#getChildrenMap()
	 */
	@Override
	public HashMap<K, V> getChildren() {
		return children;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see jParser.tree.HashTree#addChild(java.lang.Object, jParser.tree.HashTree)
	 */
	@Override
	public V addChild(K key, V child) {
		return children.put(key, child);
	}

}
