Package javax.measure.unit

Examples of javax.measure.unit.Unit


    /* This method should return units either in SI, NonSI, or combinations of
     * units acording to the Unit.valueOf format.  */

    private static javax.measure.unit.Unit splitUnits(javax.measure.unit.Unit u){
        Unit retval=Unit.ONE;
        u=u.getStandardUnit();
        /* If it's a ProductUnit, then split it and then call splitUnits */
        if (javax.measure.unit.ProductUnit.class.isInstance(u)){
            ProductUnit pu=(ProductUnit)u;
            for (int i=0;i<pu.getUnitCount();++i){
                /* First check to see if this unit needs split */
                Unit ux =splitUnits(pu.getUnit(i));
                retval=retval.times(ux.pow(pu.getUnitPow(i)));
            }
            /* Now split again */
            Logger.getLogger("com.CompPad").log(Level.FINE,"ProductUnit "
                    + pu.getUnitCount());
        }
View Full Code Here


            }
            catch(NoSuchFieldException ee){
                myObject=javax.measure.unit.Unit.valueOf(s);
            }
        }
        Unit old=myObject;
        // create set of split units
        myObject=splitUnits(myObject);
        // .to method does getStandardUnit
        // convert old units to split units
        return ComplexAmount.valueOf(Amount.valueOf(1.0, old).to(myObject));
View Full Code Here

        }


        /* calculate the expoonent */
        Integer bi;
        Unit thisUnit;
        Complex thisComplex;
        if (bIsReal && bMagIsInteger){
            /* If this.cComplex.getImaginary==0 then it must remain zero, since
             exponent is whole nmber. Otherwise, we get small neg imaginary value
             which results in sqrt((-2)^2)=-2  which is technically correct but
View Full Code Here

    /* This method should return units either in SI, NonSI, or combinations of
     * units acording to the Unit.valueOf format.  */

    private static javax.measure.unit.Unit splitUnits(javax.measure.unit.Unit u){
        Unit retval=Unit.ONE;
        u=u.getStandardUnit();
        /* If it's a ProductUnit, then split it and then call splitUnits */
        if (javax.measure.unit.ProductUnit.class.isInstance(u)){
            ProductUnit pu=(ProductUnit)u;
            for (int i=0;i<pu.getUnitCount();++i){
                /* First check to see if this unit needs split */
                Unit ux =splitUnits(pu.getUnit(i));
                retval=retval.times(ux.pow(pu.getUnitPow(i)));
            }
            /* Now split again */
            Logger.getLogger("com.CompPad").log(Level.FINE,"ProductUnit "
                    + pu.getUnitCount());
        }
View Full Code Here

            }
            catch(NoSuchFieldException ee){
                myObject=javax.measure.unit.Unit.valueOf(s);
            }
        }
        Unit old=myObject;
        // create set of split units
        myObject=splitUnits(myObject);
        // .to method does getStandardUnit
        // convert old units to split units
        return ComplexAmount.valueOf(Amount.valueOf(1.0, old).to(myObject));
View Full Code Here

    @SuppressWarnings("unchecked")
    String buildSingleMetricResult(MetricMeasurement metric) {
        Measure<?> ownTimeValue = metric.ownTimeValue();
        Measure<?> totalValue = metric.totalValue();
        Unit canonicalUnit = normalizations.get(metric.getMetricSource().getUnit());
        if (canonicalUnit == null) {
            canonicalUnit = metric.getMetricSource().getUnit();
        }
        return metric.getMetricName() + ": own " +
                metric.ownTimeValue().to(canonicalUnit) + ", total " + metric.totalValue().to(canonicalUnit);
View Full Code Here

        return result;
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    String buildSingleMetricResult(MetricMeasurement metric) {
      Unit canonicalUnit = normalizations.get(metric.getMetricSource().getUnit());
        if (canonicalUnit == null) {
            canonicalUnit = metric.getMetricSource().getUnit();
        }
        return metric.getMetricName() + ": own " +
                metric.ownTimeValue().to(canonicalUnit) + ", total " + metric.totalValue().to(canonicalUnit);
View Full Code Here

    @SuppressWarnings("unchecked")
    String buildSingleMetricResult(MetricMeasurement metric) {
        Measure<?> ownTimeValue = metric.ownTimeValue();
        Measure<?> totalValue = metric.totalValue();
        Unit canonicalUnit = normalizations.get(metric.getMetricSource().getUnit());
        if (canonicalUnit == null) {
            canonicalUnit = metric.getMetricSource().getUnit();
        }
        return metric.getMetricName() + ": own " +
                metric.ownTimeValue().to(canonicalUnit) + ", total " + metric.totalValue().to(canonicalUnit);
View Full Code Here

     * <!-- begin-user-doc -->
     * <!-- end-user-doc -->
     * @generated
     */
    public void setUOM(Unit newUOM) {
        Unit oldUOM = uOM;
        uOM = newUOM;
        if (eNotificationRequired())
            eNotify(new ENotificationImpl(this, Notification.SET, Wps10Package.DEFAULT_TYPE1__UOM, oldUOM, uOM));
    }
View Full Code Here

                final int target = getInt(result,   4, code);
                final Unit<?> base = getUnit(target);
                if (base == null) {
                    throw noSuchAuthorityCode(Unit.class, String.valueOf(target));
                }
                Unit unit = getUnit(source);
                if (unit != null) {
                    // TODO: check unit consistency here.
                } else if (b!=0 && c!=0) {
                    unit = (b == c) ? base : base.times(b / c);
                } else {
View Full Code Here

TOP

Related Classes of javax.measure.unit.Unit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.