edu.iris.Fissures.model

Class UnitImpl

    • Field Detail

      • numPrimitives

        protected static int numPrimitives
        The CORBA struct that contains the unit data. It is composed of

        the_unit_base - the base unit, if this is of type BASE, or COMPOSITE if not elements - the elements that make up this composite unit, if this is of type COMPOSITE power - the power of ten for this unit, for example 3 for KILO name - a string name for the unit, for example millisecond or foot multi_factor - multiplicative factor, for example 2.54 together with centimeters would give inches exponent - the exponent of the unit, for example -1 for per second

      • METER

        public static final UnitImpl METER
      • LENGTH

        public static final UnitImpl LENGTH
      • KILOMETER

        public static final UnitImpl KILOMETER
      • CENTIMETER

        public static final UnitImpl CENTIMETER
      • MILLIMETER

        public static final UnitImpl MILLIMETER
      • MICROMETER

        public static final UnitImpl MICROMETER
      • MICRON

        public static final UnitImpl MICRON
      • NANOMETER

        public static final UnitImpl NANOMETER
      • PICOMETER

        public static final UnitImpl PICOMETER
      • INCH

        public static final UnitImpl INCH
      • FOOT

        public static final UnitImpl FOOT
      • MILE

        public static final UnitImpl MILE
      • YARD

        public static final UnitImpl YARD
      • FURLONG

        public static final UnitImpl FURLONG
      • LEAGUE

        public static final UnitImpl LEAGUE
      • SECOND

        public static final UnitImpl SECOND
      • TIME

        public static final UnitImpl TIME
      • MINUTE

        public static final UnitImpl MINUTE
      • HOUR

        public static final UnitImpl HOUR
      • WEEK

        public static final UnitImpl WEEK
      • FORTNIGHT

        public static final UnitImpl FORTNIGHT
      • YEAR

        public static final UnitImpl YEAR
        normal year of 365 days
      • LEAP_YEAR

        public static final UnitImpl LEAP_YEAR
        leap year of 366 days
      • GREGORIAN_YEAR

        public static final UnitImpl GREGORIAN_YEAR
        365.2425 days
      • MILLISECOND

        public static final UnitImpl MILLISECOND
      • TENTHMILLISECOND

        public static final UnitImpl TENTHMILLISECOND
        tenth of a milliseconds, useful for SEED time format.
      • MICROSECOND

        public static final UnitImpl MICROSECOND
      • NANOSECOND

        public static final UnitImpl NANOSECOND
      • HERTZ

        public static final UnitImpl HERTZ
      • SQUARE_METER

        public static final UnitImpl SQUARE_METER
      • AREA

        public static final UnitImpl AREA
      • SQUARE_CENTIMETER

        public static final UnitImpl SQUARE_CENTIMETER
      • CUBIC_METER

        public static final UnitImpl CUBIC_METER
      • VOLUME

        public static final UnitImpl VOLUME
      • CUBIC_CENTIMETER

        public static final UnitImpl CUBIC_CENTIMETER
      • LITER

        public static final UnitImpl LITER
      • GRAM

        public static final UnitImpl GRAM
      • KILOGRAM

        public static final UnitImpl KILOGRAM
      • MASS

        public static final UnitImpl MASS
      • DENSITY

        public static final UnitImpl DENSITY
      • GRAM_PER_CUBIC_CENTIMETER

        public static final UnitImpl GRAM_PER_CUBIC_CENTIMETER
      • KILOGRAM_PER_CUBIC_METER

        public static final UnitImpl KILOGRAM_PER_CUBIC_METER
      • VELOCITY

        public static final UnitImpl VELOCITY
      • METER_PER_SECOND

        public static final UnitImpl METER_PER_SECOND
      • KILOMETER_PER_SECOND

        public static final UnitImpl KILOMETER_PER_SECOND
      • CENTIMETER_PER_SECOND

        public static final UnitImpl CENTIMETER_PER_SECOND
      • MILLIMETER_PER_SECOND

        public static final UnitImpl MILLIMETER_PER_SECOND
      • MICROMETER_PER_SECOND

        public static final UnitImpl MICROMETER_PER_SECOND
      • MICRON_PER_SECOND

        public static final UnitImpl MICRON_PER_SECOND
      • NANOMETER_PER_SECOND

        public static final UnitImpl NANOMETER_PER_SECOND
      • METER_PER_SECOND_PER_SECOND

        public static final UnitImpl METER_PER_SECOND_PER_SECOND
      • ACCELERATION

        public static final UnitImpl ACCELERATION
      • KILOMETER_PER_SECOND_PER_SECOND

        public static final UnitImpl KILOMETER_PER_SECOND_PER_SECOND
      • CENTIMETER_PER_SECOND_PER_SECOND

        public static final UnitImpl CENTIMETER_PER_SECOND_PER_SECOND
      • MILLIMETER_PER_SECOND_PER_SECOND

        public static final UnitImpl MILLIMETER_PER_SECOND_PER_SECOND
      • MICROMETER_PER_SECOND_PER_SECOND

        public static final UnitImpl MICROMETER_PER_SECOND_PER_SECOND
      • NANOMETER_PER_SECOND_PER_SECOND

        public static final UnitImpl NANOMETER_PER_SECOND_PER_SECOND
      • FORCE

        public static final UnitImpl FORCE
      • NEWTON

        public static final UnitImpl NEWTON
      • PASCAL

        public static final UnitImpl PASCAL
      • HECTOPASCAL

        public static final UnitImpl HECTOPASCAL
      • KILOPASCAL

        public static final UnitImpl KILOPASCAL
      • MILLIBAR

        public static final UnitImpl MILLIBAR
      • CUBIC_METER_PER_CUBIC_METER

        public static final UnitImpl CUBIC_METER_PER_CUBIC_METER
      • METER_PER_METER

        public static final UnitImpl METER_PER_METER
      • JOULE

        public static final UnitImpl JOULE
      • ENERGY

        public static final UnitImpl ENERGY
      • DYNE

        public static final UnitImpl DYNE
      • AMPERE

        public static final UnitImpl AMPERE
      • COULOMB

        public static final UnitImpl COULOMB
      • VOLT

        public static final UnitImpl VOLT
      • WATT

        public static final UnitImpl WATT
      • WEBER

        public static final UnitImpl WEBER
      • TESLA

        public static final UnitImpl TESLA
      • VOLT_PER_METER

        public static final UnitImpl VOLT_PER_METER
      • WATT_PER_SQUARE_METER

        public static final UnitImpl WATT_PER_SQUARE_METER
      • RADIAN

        public static final UnitImpl RADIAN
      • DEGREE

        public static final UnitImpl DEGREE
      • COUNT

        public static final UnitImpl COUNT
      • MILLICOUNT

        public static final UnitImpl MILLICOUNT
      • MICROCOUNT

        public static final UnitImpl MICROCOUNT
      • KILOCOUNT

        public static final UnitImpl KILOCOUNT
      • MEGACOUNT

        public static final UnitImpl MEGACOUNT
      • DIMENSONLESS

        public static final UnitImpl DIMENSONLESS
        This is a big dumb, butis the easiest way to create a non-unit. It is also different from COUNT because COUNT is a primitive base unit, and hence is not convertable to this.
      • DIMENSIONLESS

        public static final UnitImpl DIMENSIONLESS
      • KELVIN_NAME

        public static final java.lang.String KELVIN_NAME
        temperature
        See Also:
        Constant Field Values
      • KELVIN

        public static final UnitImpl KELVIN
      • CELSIUS

        public static final UnitImpl CELSIUS
      • FAHRENHEIT

        public static final UnitImpl FAHRENHEIT
      • CANDELA

        public static final UnitImpl CANDELA
        just because we can
      • MOLE

        public static final UnitImpl MOLE
      • UNKNOWN

        public static final UnitImpl UNKNOWN
        This is an even dumber unit, exists so that we can fudge places where a unit is required, but the code can't create it, perhaps in loading from a string. DMC uses this in responses when they get something like TC - TEMPERATURE IN DEGREES CELSIUS that is not parsible and has not been special-cased in their code.
      • RADIAN_PER_SECOND

        public static final UnitImpl RADIAN_PER_SECOND
      • dbid

        protected java.lang.Integer dbid
      • hibernateSubUnitList

        protected java.util.List<UnitImpl> hibernateSubUnitList
    • Constructor Detail

      • UnitImpl

        protected UnitImpl()
      • UnitImpl

        protected UnitImpl(int power,
                java.lang.String name,
                double multi,
                int exponent)
      • UnitImpl

        public UnitImpl(UnitBase baseUnit,
                int exponent,
                int power)
        creates a simple unit, ie only one type of base unit to a exponent with a power for the power of ten.
      • UnitImpl

        public UnitImpl(Unit[] subunits,
                int power,
                java.lang.String name,
                double multi,
                int exponent)
      • UnitImpl

        public UnitImpl(UnitBase base,
                int power,
                java.lang.String name,
                double multi,
                int exponent)
        creates a simple unit, ie only one type of base unit to a exponent with a power for the power of ten and with a multiplicative factor and a name.
    • Method Detail

      • createEmpty

        public static java.io.Serializable createEmpty()
      • createUnitImpl

        public static UnitImpl createUnitImpl(Unit inUnit)
        A factory method to make sure that the input edu.iris.Fissures.unit is in fact a edu.iris.Fissurs.model.UnitImpl, to avoid class cast errors. The implementation will only create a new object if the inUnit is not an instance of UnitImpl.
      • getNumSubUnits

        public int getNumSubUnits()
        Returns the number of subunits. For example meters per second would have 2 subunits and meters per second per second could have either 2 or 3 depending on how it was constructed. A base unit has 0 subunits.
      • getSubUnit

        public UnitImpl getSubUnit(int i)
        Returns the ith subunit of this Unit.
      • getSubUnits

        public UnitImpl[] getSubUnits()
      • setSubUnits

        protected void setSubUnits(UnitImpl[] u)
        for use by hibernate
      • isBaseUnit

        public boolean isBaseUnit()
      • getBaseUnit

        public UnitBase getBaseUnit()
      • getBaseUnitInt

        public int getBaseUnitInt()
        for use by hibernate
      • setBaseUnitInt

        protected void setBaseUnitInt(int base)
        for use by hibernate
      • getNumPrimitives

        public static int getNumPrimitives()
        convoluted way to find out how many different unit primitives there are, since edu.iris.Fissures.UnitBase provides no accessor method and to avoid hard coding the value.
      • getReducedUnit

        public UnitImpl getReducedUnit()
        Reduces the unit to its most basic SI form, combining all terms possible and bringing any constant factors out.
      • getBaseExponents

        public int[] getBaseExponents()
        Returns the exponents of the subunits of this unit. They are indexed by the integers defined in edu.iris.Fissures.UnitImplBase. This is used primarily to determine if to units can be converted from one to the other.
      • getExponent

        public int getExponent()
        Returns the exponent for this unit. This ignores any exponents from any subunits.
      • getTotalPower

        public int getTotalPower()
        Calcultes the total power of ten for this unit relative to the MKS base units. Used to convert from one set of units to another.
      • getPower

        public int getPower()
        Returns the power of ten for this unit. This ignores any powers from any subunits.
      • getTotalMultiFactor

        public double getTotalMultiFactor()
        Calcultes the total power of ten for this unit relative to the base units. Used to convert from one set of units to another.
      • getMultiFactor

        public double getMultiFactor()
        Returns the multiplicative factor for this unit. This ignores any multiplicative factors from any subunits.
      • isConvertableTo

        public boolean isConvertableTo(UnitImpl otherUnits)
        decides whether this unit is convertable to another unit.
      • isNamed

        public boolean isNamed()
      • baseToString

        public static java.lang.String baseToString(UnitBase b)
      • toLongString

        public void toLongString()
      • toString

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

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

        public boolean equals(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • inverse

        public UnitImpl inverse()
        creates and inverse to this unit with a given name.
      • inverse

        public UnitImpl inverse(java.lang.String name)
      • multiply

        public static UnitImpl multiply(double f,
                        UnitImpl u)
        creates a new unit that is the product of a float multiplicative factor and a unit, without a given name.
      • multiply

        public static UnitImpl multiply(double f,
                        UnitImpl u,
                        java.lang.String name)
        creates a new unit that is the product of a float multiplicative factor and a unit with a name.
      • multiply

        public static UnitImpl multiply(UnitImpl a,
                        UnitImpl b)
        creates a new unit that is the product of the two units.
      • multiply

        public static UnitImpl multiply(UnitImpl a,
                        UnitImpl b,
                        java.lang.String name)
        creates a new unit that is the product of the two units.
      • multiply

        public static UnitImpl multiply(UnitImpl[] units)
        creates a new unit that is the product of the units.
      • multiply

        public static UnitImpl multiply(UnitImpl[] units,
                        java.lang.String name)
        creates a new unit that is the product of the units.
      • divide

        public static UnitImpl divide(UnitImpl a,
                      UnitImpl b)
        creates a new unit that is the product of the first unit and the inverse of the second unit.
      • divide

        public static UnitImpl divide(UnitImpl a,
                      UnitImpl b,
                      java.lang.String name)
        creates a new unit that is the product of the first unit and the inverse of the second unit.
      • getPrefix

        public static final java.lang.String getPrefix(int power)
      • getUnitFromString

        public static final UnitImpl getUnitFromString(java.lang.String unitName)
                                                throws java.lang.NoSuchFieldException
        Throws:
        java.lang.NoSuchFieldException
      • setDbid

        protected void setDbid(java.lang.Integer dbid)
      • getDbid

        public java.lang.Integer getDbid()
      • getSubUnitsList

        public java.util.List<UnitImpl> getSubUnitsList()
      • setSubUnitsList

        protected void setSubUnitsList(java.util.List<UnitImpl> list)