Class QuantityDimension

  • All Implemented Interfaces:
    java.io.Serializable, javax.measure.Dimension

    public final class QuantityDimension
    extends java.lang.Object
    implements javax.measure.Dimension, java.io.Serializable

    This class represents a quantity dimension (dimension of a physical quantity).

    The dimension associated to any given quantity are given by the published DimensionService instances. For convenience, a static method aggregating the results of all

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static javax.measure.Dimension AMOUNT_OF_SUBSTANCE
      Holds amount of substance dimension (N).
      static javax.measure.Dimension ELECTRIC_CURRENT
      Holds electric current dimension (I).
      static javax.measure.Dimension LENGTH
      Holds length dimension (L).
      private static java.util.logging.Logger logger  
      static javax.measure.Dimension LUMINOUS_INTENSITY
      Holds luminous intensity dimension (J).
      static javax.measure.Dimension MASS
      Holds mass dimension (M).
      static javax.measure.Dimension NONE
      Holds dimensionless.
      private javax.measure.Unit<?> pseudoUnit
      Holds the pseudo unit associated to this dimension.
      private static long serialVersionUID  
      static javax.measure.Dimension TEMPERATURE
      Holds temperature dimension (Θ).
      static javax.measure.Dimension TIME
      Holds time dimension (T).
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      (package private) QuantityDimension​(char symbol)
      Returns the physical dimension having the specified symbol.
      private QuantityDimension​(javax.measure.Unit<?> pseudoUnit)
      Constructor from pseudo-unit (not visible).
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.measure.Dimension divide​(javax.measure.Dimension that)
      Returns the quotient of this dimension with the one specified.
      QuantityDimension divide​(QuantityDimension that)
      Returns the quotient of this dimension with the one specified.
      boolean equals​(java.lang.Object obj)  
      java.util.Map<? extends javax.measure.Dimension,​java.lang.Integer> getBaseDimensions()
      Returns the fundamental (base) dimensions and their exponent whose product is this dimension or null if this dimension is a fundamental dimension.
      int hashCode()  
      javax.measure.Dimension multiply​(javax.measure.Dimension that)
      Returns the product of this dimension with the one specified.
      QuantityDimension multiply​(QuantityDimension that)
      Returns the product of this dimension with the one specified.
      static <Q extends javax.measure.Quantity<Q>>
      javax.measure.Dimension
      of​(java.lang.Class<Q> quantityType)
      Returns the dimension for the specified quantity type by aggregating the results of DimensionService or null if the specified quantity is unknown.
      static javax.measure.Dimension parse​(char symbol)
      Returns the dimension for the specified symbol.
      QuantityDimension pow​(int n)
      Returns this dimension raised to an exponent.
      QuantityDimension root​(int n)
      Returns the given root of this dimension.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • logger

        private static final java.util.logging.Logger logger
      • NONE

        public static final javax.measure.Dimension NONE
        Holds dimensionless.
        Since:
        1.0
      • LENGTH

        public static final javax.measure.Dimension LENGTH
        Holds length dimension (L).
        Since:
        1.0
      • MASS

        public static final javax.measure.Dimension MASS
        Holds mass dimension (M).
        Since:
        1.0
      • TIME

        public static final javax.measure.Dimension TIME
        Holds time dimension (T).
        Since:
        1.0
      • ELECTRIC_CURRENT

        public static final javax.measure.Dimension ELECTRIC_CURRENT
        Holds electric current dimension (I).
        Since:
        1.0
      • TEMPERATURE

        public static final javax.measure.Dimension TEMPERATURE
        Holds temperature dimension (Θ).
        Since:
        1.0
      • AMOUNT_OF_SUBSTANCE

        public static final javax.measure.Dimension AMOUNT_OF_SUBSTANCE
        Holds amount of substance dimension (N).
        Since:
        1.0
      • LUMINOUS_INTENSITY

        public static final javax.measure.Dimension LUMINOUS_INTENSITY
        Holds luminous intensity dimension (J).
      • pseudoUnit

        private final javax.measure.Unit<?> pseudoUnit
        Holds the pseudo unit associated to this dimension.
    • Constructor Detail

      • QuantityDimension

        QuantityDimension​(char symbol)
        Returns the physical dimension having the specified symbol.
        Parameters:
        symbol - the associated symbol.
      • QuantityDimension

        private QuantityDimension​(javax.measure.Unit<?> pseudoUnit)
        Constructor from pseudo-unit (not visible).
        Parameters:
        pseudoUnit - the pseudo-unit.
    • Method Detail

      • of

        public static <Q extends javax.measure.Quantity<Q>> javax.measure.Dimension of​(java.lang.Class<Q> quantityType)
        Returns the dimension for the specified quantity type by aggregating the results of DimensionService or null if the specified quantity is unknown.
        Parameters:
        quantityType - the quantity type.
        Returns:
        the dimension for the quantity type or null.
        Since:
        1.1
      • parse

        public static javax.measure.Dimension parse​(char symbol)
        Returns the dimension for the specified symbol.
        Parameters:
        sambol - the quantity symbol.
        Returns:
        the dimension for the given symbol.
        Since:
        1.0.1
      • multiply

        public javax.measure.Dimension multiply​(javax.measure.Dimension that)
        Returns the product of this dimension with the one specified. If the specified dimension is not a physics dimension, then that.multiply(this) is returned.
        Specified by:
        multiply in interface javax.measure.Dimension
        Parameters:
        that - the dimension multiplicand.
        Returns:
        this * that
        Since:
        1.0
      • multiply

        public QuantityDimension multiply​(QuantityDimension that)
        Returns the product of this dimension with the one specified.
        Parameters:
        that - the dimension multiplicand.
        Returns:
        this * that
        Since:
        1.0
      • divide

        public javax.measure.Dimension divide​(javax.measure.Dimension that)
        Returns the quotient of this dimension with the one specified.
        Specified by:
        divide in interface javax.measure.Dimension
        Parameters:
        that - the dimension divisor.
        Returns:
        this.multiply(that.pow(-1))
        Since:
        1.0
      • divide

        public QuantityDimension divide​(QuantityDimension that)
        Returns the quotient of this dimension with the one specified.
        Parameters:
        that - the dimension divisor.
        Returns:
        this.multiply(that.pow(-1))
        Since:
        1.0
      • pow

        public final QuantityDimension pow​(int n)
        Returns this dimension raised to an exponent.
        Specified by:
        pow in interface javax.measure.Dimension
        Parameters:
        n - the exponent.
        Returns:
        the result of raising this dimension to the exponent.
        Since:
        1.0
      • root

        public final QuantityDimension root​(int n)
        Returns the given root of this dimension.
        Specified by:
        root in interface javax.measure.Dimension
        Parameters:
        n - the root's order.
        Returns:
        the result of taking the given root of this dimension.
        Throws:
        java.lang.ArithmeticException - if n == 0.
        Since:
        1.0
      • getBaseDimensions

        public java.util.Map<? extends javax.measure.Dimension,​java.lang.Integer> getBaseDimensions()
        Returns the fundamental (base) dimensions and their exponent whose product is this dimension or null if this dimension is a fundamental dimension.
        Specified by:
        getBaseDimensions in interface javax.measure.Dimension
        Returns:
        the mapping between the base dimensions and their exponent.
        Since:
        1.0
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object