udunits/src/main/java/ucar/units/DerivedUnitImpl.java
public static void main(final String[] args) throws Exception {
        final BaseUnit second = BaseUnit.getOrCreate(UnitName.newUnitName(
                "second", null, "s"), BaseQuantity.TIME);
        System.out.println("second = \"" + second + '"');
        final BaseUnit meter = BaseUnit.getOrCreate(UnitName.newUnitName(
                "meter", null, "m"), BaseQuantity.LENGTH);
        System.out.println("meter = \"" + meter + '"');
        final DerivedUnitImpl meterSecond = (DerivedUnitImpl) meter
                .myMultiplyBy(second);
        System.out.println("meterSecond = \"" + meterSecond + '"');
        final DerivedUnitImpl meterPerSecond = (DerivedUnitImpl) meter
                .myDivideBy(second);
        System.out.println("meterPerSecond = \"" + meterPerSecond + '"');
        final DerivedUnitImpl secondPerMeter = (DerivedUnitImpl) second
                .myDivideBy(meter);
        System.out.println("secondPerMeter = \"" + secondPerMeter + '"');
        System.out.println("meterPerSecond.isReciprocalOf(secondPerMeter)="
                + meterPerSecond.isReciprocalOf(secondPerMeter));
        System.out.println("meter.toDerivedUnit(1.0)="
                + meter.toDerivedUnit(1.0));
        System.out
                .println("meter.toDerivedUnit(new double[] {1,2,3}, new double[3])[1]="
                        + meter.toDerivedUnit(new double[] { 1, 2, 3 },
                                new double[3])[1]);
        System.out.println("meter.fromDerivedUnit(1.0)="
                + meter.fromDerivedUnit(1.0));
        System.out
                .println("meter.fromDerivedUnit(new double[] {1,2,3}, new double[3])[2]="
                        + meter.fromDerivedUnit(new double[] { 1, 2, 3 },
                                new double[3])[2]);
        System.out.println("meter.isCompatible(meter)="
                + meter.isCompatible(meter));
        System.out.println("meter.isCompatible(second)="
                + meter.isCompatible(second));
        System.out.println("meter.equals(meter)=" + meter.equals(meter));
        System.out.println("meter.equals(second)=" + meter.equals(second));
        System.out
                .println("meter.isDimensionless()=" + meter.isDimensionless());
        final Unit sPerS = second.myDivideBy(second);
        System.out.println("sPerS = \"" + sPerS + '"');
        System.out
                .println("sPerS.isDimensionless()=" + sPerS.isDimensionless());
        meterPerSecond.raiseTo(2);
        meter.myDivideBy(meterPerSecond);
    }
public static void main(final String[] args) throws Exception {
        final BaseUnit second = BaseUnit.getOrCreate(UnitName.newUnitName(
                "second", null, "s"), BaseQuantity.TIME);
        System.out.println("second = \"" + second + '"');
        final BaseUnit meter = BaseUnit.getOrCreate(UnitName.newUnitName(
                "meter", null, "m"), BaseQuantity.LENGTH);
        System.out.println("meter = \"" + meter + '"');
        final DerivedUnitImpl meterSecond = (DerivedUnitImpl) meter
                .myMultiplyBy(second);
        System.out.println("meterSecond = \"" + meterSecond + '"');
        final DerivedUnitImpl meterPerSecond = (DerivedUnitImpl) meter
                .myDivideBy(second);
        System.out.println("meterPerSecond = \"" + meterPerSecond + '"');
        final DerivedUnitImpl secondPerMeter = (DerivedUnitImpl) second
                .myDivideBy(meter);
        System.out.println("secondPerMeter = \"" + secondPerMeter + '"');
        System.out.println("meterPerSecond.isReciprocalOf(secondPerMeter)="
                + meterPerSecond.isReciprocalOf(secondPerMeter));
        System.out.println("meter.toDerivedUnit(1.0)="
                + meter.toDerivedUnit(1.0));
        System.out
                .println("meter.toDerivedUnit(new double[] {1,2,3}, new double[3])[1]="
                        + meter.toDerivedUnit(new double[] { 1, 2, 3 },
                                new double[3])[1]);
        System.out.println("meter.fromDerivedUnit(1.0)="
                + meter.fromDerivedUnit(1.0));
        System.out
                .println("meter.fromDerivedUnit(new double[] {1,2,3}, new double[3])[2]="
                        + meter.fromDerivedUnit(new double[] { 1, 2, 3 },
                                new double[3])[2]);
        System.out.println("meter.isCompatible(meter)="
                + meter.isCompatible(meter));
        System.out.println("meter.isCompatible(second)="
                + meter.isCompatible(second));
        System.out.println("meter.equals(meter)=" + meter.equals(meter));
        System.out.println("meter.equals(second)=" + meter.equals(second));
        System.out
                .println("meter.isDimensionless()=" + meter.isDimensionless());
        final Unit sPerS = second.myDivideBy(second);
        System.out.println("sPerS = \"" + sPerS + '"');
        System.out
                .println("sPerS.isDimensionless()=" + sPerS.isDimensionless());
        meterPerSecond.raiseTo(2);
        meter.myDivideBy(meterPerSecond);
    }
public static void main ( final String [ ] args ) throws Exception { final BaseUnit second = BaseUnit . getOrCreate ( UnitName . newUnitName ( "second" , null , "s" ) , BaseQuantity . TIME ) ; System . out . println ( "second = \"" + second + ' ' ) ; final BaseUnit meter = BaseUnit . getOrCreate ( UnitName . newUnitName ( "meter" , null , "m" ) , BaseQuantity . LENGTH ) ; System . out . println ( "meter = \"" + meter + ' ' ) ; final DerivedUnitImpl meterSecond = ( DerivedUnitImpl ) meter . myMultiplyBy ( second ) ; System . out . println ( "meterSecond = \"" + meterSecond + ' ' ) ; final DerivedUnitImpl meterPerSecond = ( DerivedUnitImpl ) meter . myDivideBy ( second ) ; System . out . println ( "meterPerSecond = \"" + meterPerSecond + ' ' ) ; final DerivedUnitImpl secondPerMeter = ( DerivedUnitImpl ) second . myDivideBy ( meter ) ; System . out . println ( "secondPerMeter = \"" + secondPerMeter + ' ' ) ; System . out . println ( "meterPerSecond.isReciprocalOf(secondPerMeter)=" + meterPerSecond . isReciprocalOf ( secondPerMeter ) ) ; System . out . println ( "meter.toDerivedUnit(1.0)=" + meter . toDerivedUnit ( 1.0 ) ) ; System . out . println ( "meter.toDerivedUnit(new double[] {1,2,3}, new double[3])[1]=" + meter . toDerivedUnit ( new double [ ] { 1 , 2 , 3 } , new double [ 3 ] ) [ 1 ] ) ; System . out . println ( "meter.fromDerivedUnit(1.0)=" + meter . fromDerivedUnit ( 1.0 ) ) ; System . out . println ( "meter.fromDerivedUnit(new double[] {1,2,3}, new double[3])[2]=" + meter . fromDerivedUnit ( new double [ ] { 1 , 2 , 3 } , new double [ 3 ] ) [ 2 ] ) ; System . out . println ( "meter.isCompatible(meter)=" + meter . isCompatible ( meter ) ) ; System . out . println ( "meter.isCompatible(second)=" + meter . isCompatible ( second ) ) ; System . out . println ( "meter.equals(meter)=" + meter . equals ( meter ) ) ; System . out . println ( "meter.equals(second)=" + meter . equals ( second ) ) ; System . out . println ( "meter.isDimensionless()=" + meter . isDimensionless ( ) ) ; final Unit sPerS = second . myDivideBy ( second ) ; System . out . println ( "sPerS = \"" + sPerS + ' ' ) ; System . out . println ( "sPerS.isDimensionless()=" + sPerS . isDimensionless ( ) ) ; meterPerSecond . raiseTo ( 2 ) ; meter . myDivideBy ( meterPerSecond ) ; }
Tests this class.
Tests this class .