ucar.units.PrefixDB Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of udunits Show documentation
Show all versions of udunits Show documentation
The ucar.units Java package is for decoding and encoding formatted unit specifications (e.g. "m/s"), converting numeric values between compatible units (e.g. between "m/s" and "knot"), and for performing arithmetic operations on units (e.g. dividing one unit by another, or raising a unit to a power).
The newest version!
/*
* Copyright (c) 1998-2018 University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/
package ucar.units;
import java.util.Iterator;
/**
* Interface for a database of unit prefixes.
*
* @author Steven R. Emmerson
*/
public interface PrefixDB {
/**
* Adds a prefix to the database by name.
*
* @param name
* The name of the prefix.
* @param value
* The value of the prefix.
* @throws PrefixExistsException
* A prefix with the same name already exists in the database.
* @throws PrefixDBAccessException
* Prefix database access failure.
*/
public void addName(String name, double value)
throws PrefixExistsException, PrefixDBAccessException;
/**
* Adds a prefix to the database by symbol.
*
* @param symbol
* The symbol for the prefix.
* @param value
* The value of the prefix.
* @throws PrefixExistsException
* A prefix with the same symbol already exists in the database.
* @throws PrefixDBAccessException
* Prefix database access failure.
*/
public void addSymbol(String symbol, double value)
throws PrefixExistsException, PrefixDBAccessException;
/**
* Gets a prefix from the database by name.
*
* @param name
* The name of the prefix.
* @return prefix The prefix or null.
* @throws PrefixDBAccessException
* Prefix database access failure.
*/
public Prefix getPrefixByName(String name) throws PrefixDBAccessException;
/**
* Gets a prefix from the database by symbol.
*
* @param symbol
* The symbol for the prefix.
* @return prefix The prefix or null.
* @throws PrefixDBAccessException
* Prefix database access failure.
*/
public Prefix getPrefixBySymbol(String symbol)
throws PrefixDBAccessException;
/**
* Gets a prefix from the database by value.
*
* @param value
* The value for the prefix.
* @return prefix The prefix or null.
* @throws PrefixDBAccessException
* Prefix database access failure.
*/
public Prefix getPrefixByValue(double value) throws PrefixDBAccessException;
/**
* Gets a string representation of this database.
*
* @return A string representation of this database.
*/
public String toString();
/**
* Gets an iterator over the entries in the database.
*
* @return An iterator over the database.
*/
public Iterator> iterator();
}