Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Unit-API - Units of Measurement API for Java
* Copyright (c) 2005-2015, Jean-Marie Dautelle, Werner Keil, V2COM.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of JSR-363 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package tec.units.ri.format;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.measure.Unit;
import javax.measure.UnitConverter;
import javax.measure.spi.SystemOfUnits;
import tec.units.ri.AbstractConverter;
import tec.units.ri.AbstractUnit;
import tec.units.ri.unit.MetricPrefix;
/**
*
* This class provides a set of mappings between {@link AbstractUnit physical
* units} and symbols (both ways), between {@link MetricPrefix prefixes} and symbols
* (both ways), and from {@link AbstractConverter physical unit converters} to
* {@link MetricPrefix prefixes} (one way). No attempt is made to verify the
* uniqueness of the mappings.
*
*
*
* Mappings are read from a L10nResources, the keys of which
* should consist of a fully-qualified class name, followed by a dot ('.'), and
* then the name of a static field belonging to that class, followed optionally
* by another dot and a number. If the trailing dot and number are not present,
* the value associated with the key is treated as a
* {@link SymbolMap#label(AbstractUnit, String) label}, otherwise if the
* trailing dot and number are present, the value is treated as an
* {@link SymbolMap#alias(AbstractUnit,String) alias}. Aliases map from String
* to Unit only, whereas labels map in both directions. A given unit may have
* any number of aliases, but may have only one label.
*
*
* @author Eric Russell
* @author Werner Keil
* @version 0.7, June 27, 2015
*/
public final class SymbolMap {
private static final Logger logger = Logger.getLogger(SymbolMap.class
.getName());
private final Map> symbolToUnit;
private final Map, String> unitToSymbol;
private final Map symbolToPrefix;
private final Map