001/** 002 * Unit-API - Units of Measurement API for Java 003 * Copyright (c) 2014 Jean-Marie Dautelle, Werner Keil, V2COM 004 * All rights reserved. 005 * 006 * See LICENSE.txt for details. 007 */ 008package javax.measure.spi; 009 010import java.util.Set; 011 012import javax.measure.Dimension; 013import javax.measure.Quantity; 014import javax.measure.Unit; 015 016/** 017 * A system of units grouped together for historical or cultural reasons.<br> 018 * Common system of units are "SI" (System International), "Imperial" (British), 019 * "US" (US Customary). 020 * Nothing prevents a unit from belonging to several systems of units at the 021 * same time (for example an {@code Imperial} system would have many of the 022 * units held by the {@code US} Customary system). 023 * 024 * @author <a href="mailto:[email protected]">Jean-Marie Dautelle</a> 025 * @author <a href="mailto:[email protected]">Werner Keil</a> 026 * @version 0.8, $Date: 2014-12-03 $ 027 * @see <a href="http://en.wikipedia.org/wiki/International_System_of_Units"> 028 * Wikipedia: International System of Units</a> 029 * @see <a href="http://en.wikipedia.org/wiki/Systems_of_measurement"> 030 * Wikipedia: System of measurement</a> 031 * 032 */ 033public interface SystemOfUnits { 034 035 /** 036 * @return a name 037 */ 038 String getName(); 039 040 /** 041 * Returns the default unit for the specified quantity. 042 * 043 * @param <Q> 044 * the compile-time quantity type. 045 * @param quantityType 046 * the quantity type. 047 * @return the unit for the specified quantity. 048 */ 049 <Q extends Quantity<Q>> Unit<Q> getUnit(Class<Q> quantityType); 050 051 /** 052 * Returns a read only view over the units defined in this system. 053 * 054 * @return the collection of units. 055 */ 056 Set<? extends Unit<?>> getUnits(); 057 058 /** 059 * Returns the units defined in this system having the specified dimension 060 * (convenience method). 061 * 062 * @param dimension 063 * the dimension of the units to be returned. 064 * @return the collection of units of specified dimension. 065 */ 066 Set<? extends Unit<?>> getUnits(Dimension dimension); 067}