Coverage Report - org.jaudiotagger.tag.datatype.AbstractStringStringValuePair
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractStringStringValuePair
92%
13/14
100%
4/4
1.667
 
 1  
 /**
 2  
  * @author : Paul Taylor
 3  
  * <p/>
 4  
  * Version @version:$Id: AbstractStringStringValuePair.java 836 2009-11-12 15:44:07Z paultaylor $
 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  20
 public class AbstractStringStringValuePair extends AbstractValuePair<String, String>
 27  
 {
 28  20
     protected String lkey = null;
 29  
 
 30  
     /**
 31  
      * Get Id for Value
 32  
      * @param value
 33  
      * @return
 34  
      */
 35  
     public String getIdForValue(String value)
 36  
     {
 37  0
         return valueToId.get(value);
 38  
     }
 39  
 
 40  
     /**
 41  
      * Get value for Id
 42  
      * @param id
 43  
      * @return
 44  
      */
 45  
     public String getValueForId(String id)
 46  
     {
 47  36
         return idToValue.get(id);
 48  
     }
 49  
 
 50  
     protected void createMaps()
 51  
     {
 52  20
         iterator = idToValue.keySet().iterator();
 53  2868
         while (iterator.hasNext())
 54  
         {
 55  2848
             lkey = iterator.next();
 56  2848
             value = idToValue.get(lkey);
 57  2848
             valueToId.put(value, lkey);
 58  
         }
 59  
 
 60  
         //Value List
 61  20
         iterator = idToValue.keySet().iterator();
 62  2868
         while (iterator.hasNext())
 63  
         {
 64  2848
             valueList.add(idToValue.get(iterator.next()));
 65  
         }
 66  
         //Sort alphabetically
 67  20
         Collections.sort(valueList);
 68  20
     }
 69  
 }