Changeset 2088 in josm for trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java
- Timestamp:
- 09.09.2009 19:38:48 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionList.java
r2048 r2088 4 4 import java.util.Collection; 5 5 import java.util.Collections; 6 import java.util.HashMap; 6 7 import java.util.List; 8 import java.util.Map; 7 9 8 10 import javax.swing.JTable; … … 33 35 /** the filter expression */ 34 36 private String filter = null; 37 /** map from value to priority */ 38 private Map<String,AutoCompletionListItem> valutToItemMap; 35 39 36 40 /** … … 40 44 list = new ArrayList<AutoCompletionListItem>(); 41 45 filtered = new ArrayList<AutoCompletionListItem>(); 46 valutToItemMap = new HashMap<String, AutoCompletionListItem>(); 42 47 } 43 48 … … 148 153 149 154 protected void appendOrUpdatePriority(AutoCompletionListItem toadd) { 150 AutoCompletionListItem item = lookup(toadd.getValue());155 AutoCompletionListItem item = valutToItemMap.get(toadd.getValue()); 151 156 if (item == null) { 152 157 // new item does not exist yet. Add it to the list 153 158 // 154 159 list.add(toadd); 160 valutToItemMap.put(toadd.getValue(), toadd); 155 161 } else { 156 162 // new item already exists. Update priority if necessary … … 191 197 return false; 192 198 } 193 194 /**195 *196 * @param value a specific value197 * @return the auto completion item for this value; null, if there is no198 * such auto completion item199 */200 public AutoCompletionListItem lookup(String value) {201 if (value == null)202 return null;203 for (AutoCompletionListItem item : list) {204 if (item.getValue().equals(value))205 return item;206 }207 return null;208 }209 210 199 211 200 /**
Note: See TracChangeset
for help on using the changeset viewer.
