| 1 2 package org.netbeans.server.componentsmatch; 3 4 import java.util.Map ; 5 import java.util.Set ; 6 import java.util.TreeMap ; 7 8 12 public final class Package { 13 Map <Component,Component> components = new TreeMap <Component,Component>(); 14 String name; 15 16 Component firstComponent; 17 18 19 public Package(String name) { 20 this.name = name; 21 } 22 23 public void addComponent(Component comp) { 24 Component oldComp = components.get(comp); 25 if (oldComp == null) { 26 components.put(comp,comp); 27 } else { 28 oldComp.add(comp); 29 } 30 firstComponent = null; 31 } 32 33 35 public Component getFirstComponent() { 36 if (firstComponent == null) { 37 for (Component c : components.keySet()) { 38 if (firstComponent == null) { 39 firstComponent = c; 40 } else if (c.getIssues() > firstComponent.getIssues()) { 41 firstComponent = c; 42 } 43 } 44 } 45 return firstComponent; 46 } 47 48 public String getName() { 49 return name; 50 } 51 52 public Set <Component> getComponents() { 53 return components.keySet(); 54 } 55 } 56 | Popular Tags |