1 16 package org.outerj.daisy.navigation.impl; 17 18 import org.outerj.daisy.repository.VariantKey; 19 import org.outerj.daisy.repository.RepositoryException; 20 21 import java.util.Map ; 22 import java.util.HashMap ; 23 24 public class NavigationTree { 25 private Node node; 26 private Map nodeLookupMap; 27 28 public NavigationTree(Node node) { 29 this.node = node; 30 } 31 32 public Node getNode() { 33 return node; 34 } 35 36 public String lookupNode(VariantKey variantKey) throws RepositoryException { 37 if (nodeLookupMap == null) { 38 synchronized (this) { 39 if (nodeLookupMap == null) { 40 Map map = new HashMap (); 41 node.populateNodeLookupMap(map, ""); 42 this.nodeLookupMap = map; 43 } 44 } 45 } 46 return (String )nodeLookupMap.get(variantKey); 47 } 48 49 public void refresh() { 50 nodeLookupMap = null; 51 } 52 } 53 | Popular Tags |