1 19 20 package org.netbeans.modules.xml.schema.model.visitor; 21 22 import java.util.ArrayList ; 23 import java.util.Collections ; 24 import java.util.HashMap ; 25 import java.util.List ; 26 import java.util.Map ; 27 28 import org.netbeans.modules.xml.schema.model.SchemaComponent; 29 30 34 public class PreviewImpl implements Preview { 35 36 40 private Map <SchemaComponent, List <SchemaComponent>> usages = 41 new HashMap <SchemaComponent, List <SchemaComponent>>(); 42 43 47 public Map <SchemaComponent, List <SchemaComponent>> getUsages() { 48 return usages; 49 } 50 51 void addToUsage(SchemaComponent component) { 52 List <SchemaComponent> temp = new ArrayList <SchemaComponent>(); 53 SchemaComponent sc = component; 54 while (sc != null) { 55 temp.add(sc); 56 sc = sc.getParent(); 57 }; 58 Collections.reverse(temp); 59 usages.put(component, temp); 60 } 61 62 } 63 | Popular Tags |