Package org.vast.unit

Class Unit

java.lang.Object
org.vast.unit.Unit
All Implemented Interfaces:
Serializable

public class Unit extends Object implements Serializable

Unit object containing relationship to SI base units.

Since:
May 4, 2006
See Also:
  • Field Details

    • name

      protected String name
    • code

      protected String code
    • printSymbol

      protected String printSymbol
    • property

      protected String property
    • description

      protected String description
    • expression

      protected String expression
    • meter

      protected double meter
    • kilogram

      protected double kilogram
    • second

      protected double second
    • ampere

      protected double ampere
    • kelvin

      protected double kelvin
    • mole

      protected double mole
    • candela

      protected double candela
    • radian

      protected double radian
    • pi

      protected double pi
    • scaleToSI

      protected double scaleToSI
    • metric

      protected boolean metric
    • function

      protected UnitFunction function
  • Constructor Details

    • Unit

      public Unit()
  • Method Details

    • copy

      public Unit copy()
      Copies this unit integrally
      Returns:
      a copy of this unit
    • isCompatible

      public boolean isCompatible(Unit unit)
      Checks that this unit is physically compatible with the given unit, which also means that it is possible to convert from one to the other.
      Parameters:
      unit -
      Returns:
      true if unit is compatible with this unit
    • isEquivalent

      public boolean isEquivalent(Unit unit)
      Parameters:
      unit -
      Returns:
      true if this unit is equivalent to this unit
    • power

      public void power(double power)
      Raises this unit to the given power, thus modifying all powers of metric base SI coefs.
      Parameters:
      power -
    • multiply

      public void multiply(Unit unit)
      Multiply this unit by another unit to generate a complex unit
      Parameters:
      unit -
    • getCompatibleSIUnit

      public Unit getCompatibleSIUnit()
    • multiply

      public void multiply(double scale)
    • getName

      public String getName()
    • setName

      public Unit setName(String name)
    • getCode

      public String getCode()
    • setCode

      public Unit setCode(String code)
    • getPrintSymbol

      public String getPrintSymbol()
      Returns:
      the print symbol of this Unit. If the print symbol is not set (i.e. null or empty), then the expression will be returned (if that is not null and not empty).
    • setPrintSymbol

      public Unit setPrintSymbol(String symbol)
    • getExpression

      public String getExpression()
    • setExpression

      public Unit setExpression(String expression)
    • getProperty

      public String getProperty()
    • setProperty

      public Unit setProperty(String property)
    • getDescription

      public String getDescription()
    • setDescription

      public Unit setDescription(String description)
    • isMetric

      public boolean isMetric()
    • setMetric

      public Unit setMetric(boolean metric)
    • getAmpere

      public double getAmpere()
    • setAmpere

      public Unit setAmpere(double ampere)
    • getCandela

      public double getCandela()
    • setCandela

      public Unit setCandela(double candela)
    • getKelvin

      public double getKelvin()
    • setKelvin

      public Unit setKelvin(double kelvin)
    • getKilogram

      public double getKilogram()
    • setKilogram

      public Unit setKilogram(double kilogram)
    • getMeter

      public double getMeter()
    • setMeter

      public Unit setMeter(double meter)
    • getMole

      public double getMole()
    • setMole

      public Unit setMole(double mole)
    • getPi

      public double getPi()
    • setPi

      public Unit setPi(double pi)
    • getRadian

      public double getRadian()
    • setRadian

      public Unit setRadian(double radian)
    • getSecond

      public double getSecond()
    • setSecond

      public Unit setSecond(double second)
    • getScaleToSI

      public double getScaleToSI()
    • setScaleToSI

      public Unit setScaleToSI(double scaleToSI)
    • getFunction

      public UnitFunction getFunction()
    • setFunction

      public Unit setFunction(UnitFunction function)
    • getUCUMExpression

      public String getUCUMExpression()
    • toString

      public String toString()
      Overrides:
      toString in class Object