| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AbstractStringStringValuePair |
|
| 0.0;0 |
| 1 | /** | |
| 2 | * @author : Paul Taylor | |
| 3 | * <p/> | |
| 4 | * Version @version:$Id: AbstractStringStringValuePair.java,v 1.4 2008/07/21 10:45:40 paultaylor Exp $ | |
| 5 | * <p/> | |
| 6 | * Jaudiotagger Copyright (C)2004,2005 | |
| 7 | * <p/> | |
| 8 | * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser | |
| 9 | * General Public License as published by the Free Software Foundation; either version 2.1 of the License, | |
| 10 | * or (at your option) any later version. | |
| 11 | * <p/> | |
| 12 | * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even | |
| 13 | * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 14 | * See the GNU Lesser General Public License for more details. | |
| 15 | * <p/> | |
| 16 | * You should have received a copy of the GNU Lesser General Public License along with this library; if not, | |
| 17 | * you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software | |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 19 | * <p/> | |
| 20 | * Description: | |
| 21 | */ | |
| 22 | package org.jaudiotagger.tag.datatype; | |
| 23 | ||
| 24 | import java.util.Collections; | |
| 25 | ||
| 26 | 191 | public class AbstractStringStringValuePair extends AbstractValuePair<String, String> |
| 27 | { | |
| 28 | 191 | protected String lkey = null; |
| 29 | ||
| 30 | /** | |
| 31 | * Get Id for Value | |
| 32 | */ | |
| 33 | public String getIdForValue(String value) | |
| 34 | { | |
| 35 | 0 | return valueToId.get(value); |
| 36 | } | |
| 37 | ||
| 38 | /** | |
| 39 | * Get value for Id | |
| 40 | */ | |
| 41 | public String getValueForId(String id) | |
| 42 | { | |
| 43 | 9 | return idToValue.get(id); |
| 44 | } | |
| 45 | ||
| 46 | protected void createMaps() | |
| 47 | { | |
| 48 | 191 | iterator = idToValue.keySet().iterator(); |
| 49 | 21620 | while (iterator.hasNext()) |
| 50 | { | |
| 51 | 21429 | lkey = iterator.next(); |
| 52 | 21429 | value = idToValue.get(lkey); |
| 53 | 21429 | valueToId.put(value, lkey); |
| 54 | } | |
| 55 | ||
| 56 | //Value List | |
| 57 | 191 | iterator = idToValue.keySet().iterator(); |
| 58 | 21620 | while (iterator.hasNext()) |
| 59 | { | |
| 60 | 21429 | valueList.add(idToValue.get(iterator.next())); |
| 61 | } | |
| 62 | //Sort alphabetically | |
| 63 | 191 | Collections.sort(valueList); |
| 64 | 191 | } |
| 65 | } |