View Javadoc

1   package DTDDoc;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   import com.wutka.dtd.DTDElement;
7   
8   public class DefinitionsMap {
9   	/**
10  	 * Map of elements names with corresponding DTD location where the element is defined. That is
11  	 * key = String : element name, value = String : file path where this element is defined
12  	 */
13      private Map elementsLocations;
14  
15  
16      public DefinitionsMap() {
17          elementsLocations = new HashMap();
18      }
19  
20      public void merge( DefinitionsMap map) {
21          elementsLocations.putAll( map.elementsLocations);
22      }
23      
24      public void add(DTDElement element, String filePath) {
25          if (!elementsLocations.containsKey(element.name))
26              elementsLocations.put(element.name, filePath);
27      }
28  
29      public String getLocation(DTDElement element) {
30      	return (String)elementsLocations.get(element.name);
31      }
32  }