| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AbstractValuePair |
|
| 0.0;0 |
| 1 | /** | |
| 2 | * @author : Paul Taylor | |
| 3 | * <p/> | |
| 4 | * Version @version:$Id: AbstractValuePair.java,v 1.8 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.*; | |
| 25 | ||
| 26 | /** | |
| 27 | * A two way mapping between an id and a value | |
| 28 | */ | |
| 29 | 328 | public abstract class AbstractValuePair<I, V> |
| 30 | { | |
| 31 | 328 | protected final Map<I, V> idToValue = new LinkedHashMap<I, V>(); |
| 32 | 328 | protected final Map<V, I> valueToId = new LinkedHashMap<V, I>(); |
| 33 | 328 | protected final List<V> valueList = new ArrayList<V>(); |
| 34 | ||
| 35 | 328 | protected Iterator<I> iterator = idToValue.keySet().iterator(); |
| 36 | ||
| 37 | protected String value; | |
| 38 | ||
| 39 | /** | |
| 40 | * Get list in alphabetical order | |
| 41 | */ | |
| 42 | public List<V> getAlphabeticalValueList() | |
| 43 | { | |
| 44 | 1 | return valueList; |
| 45 | } | |
| 46 | ||
| 47 | public Map<I, V> getIdToValueMap() | |
| 48 | { | |
| 49 | 6060 | return idToValue; |
| 50 | } | |
| 51 | ||
| 52 | public Map<V, I> getValueToIdMap() | |
| 53 | { | |
| 54 | 2368 | return valueToId; |
| 55 | } | |
| 56 | ||
| 57 | /** | |
| 58 | * @return the number of elements in the mapping | |
| 59 | */ | |
| 60 | public int getSize() | |
| 61 | { | |
| 62 | 17 | return valueList.size(); |
| 63 | } | |
| 64 | } |