package bjc.utils.esodata; import bjc.utils.funcdata.FunctionalMap; import bjc.utils.funcdata.IMap; /** * Simple implementation of {@link Directory}. * * Has a split namespace for data and children. * * @author EVE * * @param The key type of the directory. * @param The value type of the directory. */ public class SimpleDirectory implements Directory { private IMap> children; private IMap data; /** * Create a new directory. */ public SimpleDirectory() { children = new FunctionalMap<>(); data = new FunctionalMap<>(); } @Override public Directory getSubdirectory(K key) { return children.get(key); } @Override public boolean hasSubdirectory(K key) { return children.containsKey(key); } @Override public Directory putSubdirectory(K key, Directory val) { return children.put(key, val); } @Override public boolean containsKey(K key) { return data.containsKey(key); } @Override public V getKey(K key) { return data.get(key); } @Override public V putKey(K key, V val) { return data.put(key, val); } }