0001: /*
0002: * <copyright>
0003: *
0004: * Copyright 1997-2004 BBNT Solutions, LLC
0005: * under sponsorship of the Defense Advanced Research Projects
0006: * Agency (DARPA).
0007: *
0008: * You can redistribute this software and/or modify it under the
0009: * terms of the Cougaar Open Source License as published on the
0010: * Cougaar Open Source Website (www.cougaar.org).
0011: *
0012: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0013: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0014: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0015: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0016: * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0017: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0018: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0019: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0020: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0021: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0022: * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0023: *
0024: * </copyright>
0025: */
0026:
0027: /* @generated Thu Sep 27 15:20:43 EDT 2007 from /u01/builds/cougaar/B12_4/B12_4/070927151721/src/planning/src/org/cougaar/planning/ldm/measure/measures.def - DO NOT HAND EDIT */
0028: /** Immutable implementation of MassTransferRate.
0029: **/package org.cougaar.planning.ldm.measure;
0030:
0031: import java.io.*;
0032:
0033: public final class MassTransferRate extends AbstractMeasure implements
0034: Externalizable, Derivative, Rate {
0035: // the value is stored as grams/second
0036: private double theValue;
0037:
0038: /** No-arg constructor is only for use by serialization **/
0039: public MassTransferRate() {
0040: }
0041:
0042: // private constructor
0043: private MassTransferRate(double v) {
0044: theValue = v;
0045: }
0046:
0047: /** @param unit One of the constant units of MassTransferRate **/
0048: public MassTransferRate(double v, int unit) {
0049: if (unit >= 0 && unit <= MAXUNIT)
0050: theValue = v / getConvFactor(unit);
0051: else
0052: throw new UnknownUnitException();
0053: }
0054:
0055: /** @param unit1 One of the constant units of Mass
0056: * @param unit2 One of the constant units of Duration
0057: **/
0058: public MassTransferRate(double v, int unit1, int unit2) {
0059: if (unit1 >= 0 && unit1 <= Mass.MAXUNIT && unit2 >= 0
0060: && unit2 <= Duration.MAXUNIT)
0061: theValue = v * Mass.getConvFactor(unit1)
0062: / Duration.getConvFactor(unit2);
0063: else
0064: throw new UnknownUnitException();
0065: }
0066:
0067: /** @param num An instance of Mass to use as numerator
0068: * @param den An instance of Durationto use as denominator
0069: **/
0070: public MassTransferRate(Mass num, Duration den) {
0071: theValue = num.getValue(0) / den.getValue(0);
0072: }
0073:
0074: /** takes strings of the form "Number unit" **/
0075: public MassTransferRate(String s) {
0076: int i = indexOfType(s);
0077: if (i < 0)
0078: throw new UnknownUnitException();
0079: double n = Double.valueOf(s.substring(0, i).trim())
0080: .doubleValue();
0081: String u = s.substring(i).trim().toLowerCase();
0082: if (u.equals("gramspersecond"))
0083: theValue = n / (1.0d / 1.0d);
0084: else if (u.equals("gramsperminute"))
0085: theValue = n / (1.0d / (1.0d / 60));
0086: else if (u.equals("gramsperhour"))
0087: theValue = n / (1.0d / (1.0d / 3600));
0088: else if (u.equals("gramsperday"))
0089: theValue = n / (1.0d / (1.0d / 86400));
0090: else if (u.equals("gramsperweek"))
0091: theValue = n / (1.0d / (1.0d / 604800));
0092: else if (u.equals("gramspermillisecond"))
0093: theValue = n / (1.0d / 1000);
0094: else if (u.equals("gramsperkilosecond"))
0095: theValue = n / (1.0d / (1.0d / 1000));
0096: else if (u.equals("gramspermonth"))
0097: theValue = n / (1.0d / (1.0d / 2629743.8));
0098: else if (u.equals("gramsperyear"))
0099: theValue = n / (1.0d / (1.0d / 31556926));
0100: else if (u.equals("gramsperfortnight"))
0101: theValue = n / (1.0d / (1.0d / 1209600));
0102: else if (u.equals("kilogramspersecond"))
0103: theValue = n / ((1.0d / 1000) / 1.0d);
0104: else if (u.equals("kilogramsperminute"))
0105: theValue = n / ((1.0d / 1000) / (1.0d / 60));
0106: else if (u.equals("kilogramsperhour"))
0107: theValue = n / ((1.0d / 1000) / (1.0d / 3600));
0108: else if (u.equals("kilogramsperday"))
0109: theValue = n / ((1.0d / 1000) / (1.0d / 86400));
0110: else if (u.equals("kilogramsperweek"))
0111: theValue = n / ((1.0d / 1000) / (1.0d / 604800));
0112: else if (u.equals("kilogramspermillisecond"))
0113: theValue = n / ((1.0d / 1000) / 1000);
0114: else if (u.equals("kilogramsperkilosecond"))
0115: theValue = n / ((1.0d / 1000) / (1.0d / 1000));
0116: else if (u.equals("kilogramspermonth"))
0117: theValue = n / ((1.0d / 1000) / (1.0d / 2629743.8));
0118: else if (u.equals("kilogramsperyear"))
0119: theValue = n / ((1.0d / 1000) / (1.0d / 31556926));
0120: else if (u.equals("kilogramsperfortnight"))
0121: theValue = n / ((1.0d / 1000) / (1.0d / 1209600));
0122: else if (u.equals("ouncespersecond"))
0123: theValue = n / (0.035273962 / 1.0d);
0124: else if (u.equals("ouncesperminute"))
0125: theValue = n / (0.035273962 / (1.0d / 60));
0126: else if (u.equals("ouncesperhour"))
0127: theValue = n / (0.035273962 / (1.0d / 3600));
0128: else if (u.equals("ouncesperday"))
0129: theValue = n / (0.035273962 / (1.0d / 86400));
0130: else if (u.equals("ouncesperweek"))
0131: theValue = n / (0.035273962 / (1.0d / 604800));
0132: else if (u.equals("ouncespermillisecond"))
0133: theValue = n / (0.035273962 / 1000);
0134: else if (u.equals("ouncesperkilosecond"))
0135: theValue = n / (0.035273962 / (1.0d / 1000));
0136: else if (u.equals("ouncespermonth"))
0137: theValue = n / (0.035273962 / (1.0d / 2629743.8));
0138: else if (u.equals("ouncesperyear"))
0139: theValue = n / (0.035273962 / (1.0d / 31556926));
0140: else if (u.equals("ouncesperfortnight"))
0141: theValue = n / (0.035273962 / (1.0d / 1209600));
0142: else if (u.equals("poundspersecond"))
0143: theValue = n / (0.0022046226 / 1.0d);
0144: else if (u.equals("poundsperminute"))
0145: theValue = n / (0.0022046226 / (1.0d / 60));
0146: else if (u.equals("poundsperhour"))
0147: theValue = n / (0.0022046226 / (1.0d / 3600));
0148: else if (u.equals("poundsperday"))
0149: theValue = n / (0.0022046226 / (1.0d / 86400));
0150: else if (u.equals("poundsperweek"))
0151: theValue = n / (0.0022046226 / (1.0d / 604800));
0152: else if (u.equals("poundspermillisecond"))
0153: theValue = n / (0.0022046226 / 1000);
0154: else if (u.equals("poundsperkilosecond"))
0155: theValue = n / (0.0022046226 / (1.0d / 1000));
0156: else if (u.equals("poundspermonth"))
0157: theValue = n / (0.0022046226 / (1.0d / 2629743.8));
0158: else if (u.equals("poundsperyear"))
0159: theValue = n / (0.0022046226 / (1.0d / 31556926));
0160: else if (u.equals("poundsperfortnight"))
0161: theValue = n / (0.0022046226 / (1.0d / 1209600));
0162: else if (u.equals("tonspersecond"))
0163: theValue = n / ((1.0d / 907184.74) / 1.0d);
0164: else if (u.equals("tonsperminute"))
0165: theValue = n / ((1.0d / 907184.74) / (1.0d / 60));
0166: else if (u.equals("tonsperhour"))
0167: theValue = n / ((1.0d / 907184.74) / (1.0d / 3600));
0168: else if (u.equals("tonsperday"))
0169: theValue = n / ((1.0d / 907184.74) / (1.0d / 86400));
0170: else if (u.equals("tonsperweek"))
0171: theValue = n / ((1.0d / 907184.74) / (1.0d / 604800));
0172: else if (u.equals("tonspermillisecond"))
0173: theValue = n / ((1.0d / 907184.74) / 1000);
0174: else if (u.equals("tonsperkilosecond"))
0175: theValue = n / ((1.0d / 907184.74) / (1.0d / 1000));
0176: else if (u.equals("tonspermonth"))
0177: theValue = n / ((1.0d / 907184.74) / (1.0d / 2629743.8));
0178: else if (u.equals("tonsperyear"))
0179: theValue = n / ((1.0d / 907184.74) / (1.0d / 31556926));
0180: else if (u.equals("tonsperfortnight"))
0181: theValue = n / ((1.0d / 907184.74) / (1.0d / 1209600));
0182: else if (u.equals("shorttonspersecond"))
0183: theValue = n / ((1.0d / 907184.74) / 1.0d);
0184: else if (u.equals("shorttonsperminute"))
0185: theValue = n / ((1.0d / 907184.74) / (1.0d / 60));
0186: else if (u.equals("shorttonsperhour"))
0187: theValue = n / ((1.0d / 907184.74) / (1.0d / 3600));
0188: else if (u.equals("shorttonsperday"))
0189: theValue = n / ((1.0d / 907184.74) / (1.0d / 86400));
0190: else if (u.equals("shorttonsperweek"))
0191: theValue = n / ((1.0d / 907184.74) / (1.0d / 604800));
0192: else if (u.equals("shorttonspermillisecond"))
0193: theValue = n / ((1.0d / 907184.74) / 1000);
0194: else if (u.equals("shorttonsperkilosecond"))
0195: theValue = n / ((1.0d / 907184.74) / (1.0d / 1000));
0196: else if (u.equals("shorttonspermonth"))
0197: theValue = n / ((1.0d / 907184.74) / (1.0d / 2629743.8));
0198: else if (u.equals("shorttonsperyear"))
0199: theValue = n / ((1.0d / 907184.74) / (1.0d / 31556926));
0200: else if (u.equals("shorttonsperfortnight"))
0201: theValue = n / ((1.0d / 907184.74) / (1.0d / 1209600));
0202: else if (u.equals("longtonspersecond"))
0203: theValue = n / ((1.0d / 1016046.9) / 1.0d);
0204: else if (u.equals("longtonsperminute"))
0205: theValue = n / ((1.0d / 1016046.9) / (1.0d / 60));
0206: else if (u.equals("longtonsperhour"))
0207: theValue = n / ((1.0d / 1016046.9) / (1.0d / 3600));
0208: else if (u.equals("longtonsperday"))
0209: theValue = n / ((1.0d / 1016046.9) / (1.0d / 86400));
0210: else if (u.equals("longtonsperweek"))
0211: theValue = n / ((1.0d / 1016046.9) / (1.0d / 604800));
0212: else if (u.equals("longtonspermillisecond"))
0213: theValue = n / ((1.0d / 1016046.9) / 1000);
0214: else if (u.equals("longtonsperkilosecond"))
0215: theValue = n / ((1.0d / 1016046.9) / (1.0d / 1000));
0216: else if (u.equals("longtonspermonth"))
0217: theValue = n / ((1.0d / 1016046.9) / (1.0d / 2629743.8));
0218: else if (u.equals("longtonsperyear"))
0219: theValue = n / ((1.0d / 1016046.9) / (1.0d / 31556926));
0220: else if (u.equals("longtonsperfortnight"))
0221: theValue = n / ((1.0d / 1016046.9) / (1.0d / 1209600));
0222: else
0223: throw new UnknownUnitException();
0224: }
0225:
0226: // TypeNamed factory methods
0227: public static final MassTransferRate newGramsPerSecond(double v) {
0228: return new MassTransferRate(v * (1.0d / (1.0d / 1.0d)));
0229: }
0230:
0231: public static final MassTransferRate newGramsPerSecond(String s) {
0232: return new MassTransferRate((Double.valueOf(s).doubleValue())
0233: * (1.0d / (1.0d / 1.0d)));
0234: }
0235:
0236: public static final MassTransferRate newGramsPerMinute(double v) {
0237: return new MassTransferRate(v * (1.0d / (1.0d / (1.0d / 60))));
0238: }
0239:
0240: public static final MassTransferRate newGramsPerMinute(String s) {
0241: return new MassTransferRate((Double.valueOf(s).doubleValue())
0242: * (1.0d / (1.0d / (1.0d / 60))));
0243: }
0244:
0245: public static final MassTransferRate newGramsPerHour(double v) {
0246: return new MassTransferRate(v * (1.0d / (1.0d / (1.0d / 3600))));
0247: }
0248:
0249: public static final MassTransferRate newGramsPerHour(String s) {
0250: return new MassTransferRate((Double.valueOf(s).doubleValue())
0251: * (1.0d / (1.0d / (1.0d / 3600))));
0252: }
0253:
0254: public static final MassTransferRate newGramsPerDay(double v) {
0255: return new MassTransferRate(v
0256: * (1.0d / (1.0d / (1.0d / 86400))));
0257: }
0258:
0259: public static final MassTransferRate newGramsPerDay(String s) {
0260: return new MassTransferRate((Double.valueOf(s).doubleValue())
0261: * (1.0d / (1.0d / (1.0d / 86400))));
0262: }
0263:
0264: public static final MassTransferRate newGramsPerWeek(double v) {
0265: return new MassTransferRate(v
0266: * (1.0d / (1.0d / (1.0d / 604800))));
0267: }
0268:
0269: public static final MassTransferRate newGramsPerWeek(String s) {
0270: return new MassTransferRate((Double.valueOf(s).doubleValue())
0271: * (1.0d / (1.0d / (1.0d / 604800))));
0272: }
0273:
0274: public static final MassTransferRate newGramsPerMillisecond(double v) {
0275: return new MassTransferRate(v * (1.0d / (1.0d / 1000)));
0276: }
0277:
0278: public static final MassTransferRate newGramsPerMillisecond(String s) {
0279: return new MassTransferRate((Double.valueOf(s).doubleValue())
0280: * (1.0d / (1.0d / 1000)));
0281: }
0282:
0283: public static final MassTransferRate newGramsPerKilosecond(double v) {
0284: return new MassTransferRate(v * (1.0d / (1.0d / (1.0d / 1000))));
0285: }
0286:
0287: public static final MassTransferRate newGramsPerKilosecond(String s) {
0288: return new MassTransferRate((Double.valueOf(s).doubleValue())
0289: * (1.0d / (1.0d / (1.0d / 1000))));
0290: }
0291:
0292: public static final MassTransferRate newGramsPerMonth(double v) {
0293: return new MassTransferRate(v
0294: * (1.0d / (1.0d / (1.0d / 2629743.8))));
0295: }
0296:
0297: public static final MassTransferRate newGramsPerMonth(String s) {
0298: return new MassTransferRate((Double.valueOf(s).doubleValue())
0299: * (1.0d / (1.0d / (1.0d / 2629743.8))));
0300: }
0301:
0302: public static final MassTransferRate newGramsPerYear(double v) {
0303: return new MassTransferRate(v
0304: * (1.0d / (1.0d / (1.0d / 31556926))));
0305: }
0306:
0307: public static final MassTransferRate newGramsPerYear(String s) {
0308: return new MassTransferRate((Double.valueOf(s).doubleValue())
0309: * (1.0d / (1.0d / (1.0d / 31556926))));
0310: }
0311:
0312: public static final MassTransferRate newGramsPerFortnight(double v) {
0313: return new MassTransferRate(v
0314: * (1.0d / (1.0d / (1.0d / 1209600))));
0315: }
0316:
0317: public static final MassTransferRate newGramsPerFortnight(String s) {
0318: return new MassTransferRate((Double.valueOf(s).doubleValue())
0319: * (1.0d / (1.0d / (1.0d / 1209600))));
0320: }
0321:
0322: public static final MassTransferRate newKilogramsPerSecond(double v) {
0323: return new MassTransferRate(v * (1.0d / ((1.0d / 1000) / 1.0d)));
0324: }
0325:
0326: public static final MassTransferRate newKilogramsPerSecond(String s) {
0327: return new MassTransferRate((Double.valueOf(s).doubleValue())
0328: * (1.0d / ((1.0d / 1000) / 1.0d)));
0329: }
0330:
0331: public static final MassTransferRate newKilogramsPerMinute(double v) {
0332: return new MassTransferRate(v
0333: * (1.0d / ((1.0d / 1000) / (1.0d / 60))));
0334: }
0335:
0336: public static final MassTransferRate newKilogramsPerMinute(String s) {
0337: return new MassTransferRate((Double.valueOf(s).doubleValue())
0338: * (1.0d / ((1.0d / 1000) / (1.0d / 60))));
0339: }
0340:
0341: public static final MassTransferRate newKilogramsPerHour(double v) {
0342: return new MassTransferRate(v
0343: * (1.0d / ((1.0d / 1000) / (1.0d / 3600))));
0344: }
0345:
0346: public static final MassTransferRate newKilogramsPerHour(String s) {
0347: return new MassTransferRate((Double.valueOf(s).doubleValue())
0348: * (1.0d / ((1.0d / 1000) / (1.0d / 3600))));
0349: }
0350:
0351: public static final MassTransferRate newKilogramsPerDay(double v) {
0352: return new MassTransferRate(v
0353: * (1.0d / ((1.0d / 1000) / (1.0d / 86400))));
0354: }
0355:
0356: public static final MassTransferRate newKilogramsPerDay(String s) {
0357: return new MassTransferRate((Double.valueOf(s).doubleValue())
0358: * (1.0d / ((1.0d / 1000) / (1.0d / 86400))));
0359: }
0360:
0361: public static final MassTransferRate newKilogramsPerWeek(double v) {
0362: return new MassTransferRate(v
0363: * (1.0d / ((1.0d / 1000) / (1.0d / 604800))));
0364: }
0365:
0366: public static final MassTransferRate newKilogramsPerWeek(String s) {
0367: return new MassTransferRate((Double.valueOf(s).doubleValue())
0368: * (1.0d / ((1.0d / 1000) / (1.0d / 604800))));
0369: }
0370:
0371: public static final MassTransferRate newKilogramsPerMillisecond(
0372: double v) {
0373: return new MassTransferRate(v * (1.0d / ((1.0d / 1000) / 1000)));
0374: }
0375:
0376: public static final MassTransferRate newKilogramsPerMillisecond(
0377: String s) {
0378: return new MassTransferRate((Double.valueOf(s).doubleValue())
0379: * (1.0d / ((1.0d / 1000) / 1000)));
0380: }
0381:
0382: public static final MassTransferRate newKilogramsPerKilosecond(
0383: double v) {
0384: return new MassTransferRate(v
0385: * (1.0d / ((1.0d / 1000) / (1.0d / 1000))));
0386: }
0387:
0388: public static final MassTransferRate newKilogramsPerKilosecond(
0389: String s) {
0390: return new MassTransferRate((Double.valueOf(s).doubleValue())
0391: * (1.0d / ((1.0d / 1000) / (1.0d / 1000))));
0392: }
0393:
0394: public static final MassTransferRate newKilogramsPerMonth(double v) {
0395: return new MassTransferRate(v
0396: * (1.0d / ((1.0d / 1000) / (1.0d / 2629743.8))));
0397: }
0398:
0399: public static final MassTransferRate newKilogramsPerMonth(String s) {
0400: return new MassTransferRate((Double.valueOf(s).doubleValue())
0401: * (1.0d / ((1.0d / 1000) / (1.0d / 2629743.8))));
0402: }
0403:
0404: public static final MassTransferRate newKilogramsPerYear(double v) {
0405: return new MassTransferRate(v
0406: * (1.0d / ((1.0d / 1000) / (1.0d / 31556926))));
0407: }
0408:
0409: public static final MassTransferRate newKilogramsPerYear(String s) {
0410: return new MassTransferRate((Double.valueOf(s).doubleValue())
0411: * (1.0d / ((1.0d / 1000) / (1.0d / 31556926))));
0412: }
0413:
0414: public static final MassTransferRate newKilogramsPerFortnight(
0415: double v) {
0416: return new MassTransferRate(v
0417: * (1.0d / ((1.0d / 1000) / (1.0d / 1209600))));
0418: }
0419:
0420: public static final MassTransferRate newKilogramsPerFortnight(
0421: String s) {
0422: return new MassTransferRate((Double.valueOf(s).doubleValue())
0423: * (1.0d / ((1.0d / 1000) / (1.0d / 1209600))));
0424: }
0425:
0426: public static final MassTransferRate newOuncesPerSecond(double v) {
0427: return new MassTransferRate(v * (1.0d / (0.035273962 / 1.0d)));
0428: }
0429:
0430: public static final MassTransferRate newOuncesPerSecond(String s) {
0431: return new MassTransferRate((Double.valueOf(s).doubleValue())
0432: * (1.0d / (0.035273962 / 1.0d)));
0433: }
0434:
0435: public static final MassTransferRate newOuncesPerMinute(double v) {
0436: return new MassTransferRate(v
0437: * (1.0d / (0.035273962 / (1.0d / 60))));
0438: }
0439:
0440: public static final MassTransferRate newOuncesPerMinute(String s) {
0441: return new MassTransferRate((Double.valueOf(s).doubleValue())
0442: * (1.0d / (0.035273962 / (1.0d / 60))));
0443: }
0444:
0445: public static final MassTransferRate newOuncesPerHour(double v) {
0446: return new MassTransferRate(v
0447: * (1.0d / (0.035273962 / (1.0d / 3600))));
0448: }
0449:
0450: public static final MassTransferRate newOuncesPerHour(String s) {
0451: return new MassTransferRate((Double.valueOf(s).doubleValue())
0452: * (1.0d / (0.035273962 / (1.0d / 3600))));
0453: }
0454:
0455: public static final MassTransferRate newOuncesPerDay(double v) {
0456: return new MassTransferRate(v
0457: * (1.0d / (0.035273962 / (1.0d / 86400))));
0458: }
0459:
0460: public static final MassTransferRate newOuncesPerDay(String s) {
0461: return new MassTransferRate((Double.valueOf(s).doubleValue())
0462: * (1.0d / (0.035273962 / (1.0d / 86400))));
0463: }
0464:
0465: public static final MassTransferRate newOuncesPerWeek(double v) {
0466: return new MassTransferRate(v
0467: * (1.0d / (0.035273962 / (1.0d / 604800))));
0468: }
0469:
0470: public static final MassTransferRate newOuncesPerWeek(String s) {
0471: return new MassTransferRate((Double.valueOf(s).doubleValue())
0472: * (1.0d / (0.035273962 / (1.0d / 604800))));
0473: }
0474:
0475: public static final MassTransferRate newOuncesPerMillisecond(
0476: double v) {
0477: return new MassTransferRate(v * (1.0d / (0.035273962 / 1000)));
0478: }
0479:
0480: public static final MassTransferRate newOuncesPerMillisecond(
0481: String s) {
0482: return new MassTransferRate((Double.valueOf(s).doubleValue())
0483: * (1.0d / (0.035273962 / 1000)));
0484: }
0485:
0486: public static final MassTransferRate newOuncesPerKilosecond(double v) {
0487: return new MassTransferRate(v
0488: * (1.0d / (0.035273962 / (1.0d / 1000))));
0489: }
0490:
0491: public static final MassTransferRate newOuncesPerKilosecond(String s) {
0492: return new MassTransferRate((Double.valueOf(s).doubleValue())
0493: * (1.0d / (0.035273962 / (1.0d / 1000))));
0494: }
0495:
0496: public static final MassTransferRate newOuncesPerMonth(double v) {
0497: return new MassTransferRate(v
0498: * (1.0d / (0.035273962 / (1.0d / 2629743.8))));
0499: }
0500:
0501: public static final MassTransferRate newOuncesPerMonth(String s) {
0502: return new MassTransferRate((Double.valueOf(s).doubleValue())
0503: * (1.0d / (0.035273962 / (1.0d / 2629743.8))));
0504: }
0505:
0506: public static final MassTransferRate newOuncesPerYear(double v) {
0507: return new MassTransferRate(v
0508: * (1.0d / (0.035273962 / (1.0d / 31556926))));
0509: }
0510:
0511: public static final MassTransferRate newOuncesPerYear(String s) {
0512: return new MassTransferRate((Double.valueOf(s).doubleValue())
0513: * (1.0d / (0.035273962 / (1.0d / 31556926))));
0514: }
0515:
0516: public static final MassTransferRate newOuncesPerFortnight(double v) {
0517: return new MassTransferRate(v
0518: * (1.0d / (0.035273962 / (1.0d / 1209600))));
0519: }
0520:
0521: public static final MassTransferRate newOuncesPerFortnight(String s) {
0522: return new MassTransferRate((Double.valueOf(s).doubleValue())
0523: * (1.0d / (0.035273962 / (1.0d / 1209600))));
0524: }
0525:
0526: public static final MassTransferRate newPoundsPerSecond(double v) {
0527: return new MassTransferRate(v * (1.0d / (0.0022046226 / 1.0d)));
0528: }
0529:
0530: public static final MassTransferRate newPoundsPerSecond(String s) {
0531: return new MassTransferRate((Double.valueOf(s).doubleValue())
0532: * (1.0d / (0.0022046226 / 1.0d)));
0533: }
0534:
0535: public static final MassTransferRate newPoundsPerMinute(double v) {
0536: return new MassTransferRate(v
0537: * (1.0d / (0.0022046226 / (1.0d / 60))));
0538: }
0539:
0540: public static final MassTransferRate newPoundsPerMinute(String s) {
0541: return new MassTransferRate((Double.valueOf(s).doubleValue())
0542: * (1.0d / (0.0022046226 / (1.0d / 60))));
0543: }
0544:
0545: public static final MassTransferRate newPoundsPerHour(double v) {
0546: return new MassTransferRate(v
0547: * (1.0d / (0.0022046226 / (1.0d / 3600))));
0548: }
0549:
0550: public static final MassTransferRate newPoundsPerHour(String s) {
0551: return new MassTransferRate((Double.valueOf(s).doubleValue())
0552: * (1.0d / (0.0022046226 / (1.0d / 3600))));
0553: }
0554:
0555: public static final MassTransferRate newPoundsPerDay(double v) {
0556: return new MassTransferRate(v
0557: * (1.0d / (0.0022046226 / (1.0d / 86400))));
0558: }
0559:
0560: public static final MassTransferRate newPoundsPerDay(String s) {
0561: return new MassTransferRate((Double.valueOf(s).doubleValue())
0562: * (1.0d / (0.0022046226 / (1.0d / 86400))));
0563: }
0564:
0565: public static final MassTransferRate newPoundsPerWeek(double v) {
0566: return new MassTransferRate(v
0567: * (1.0d / (0.0022046226 / (1.0d / 604800))));
0568: }
0569:
0570: public static final MassTransferRate newPoundsPerWeek(String s) {
0571: return new MassTransferRate((Double.valueOf(s).doubleValue())
0572: * (1.0d / (0.0022046226 / (1.0d / 604800))));
0573: }
0574:
0575: public static final MassTransferRate newPoundsPerMillisecond(
0576: double v) {
0577: return new MassTransferRate(v * (1.0d / (0.0022046226 / 1000)));
0578: }
0579:
0580: public static final MassTransferRate newPoundsPerMillisecond(
0581: String s) {
0582: return new MassTransferRate((Double.valueOf(s).doubleValue())
0583: * (1.0d / (0.0022046226 / 1000)));
0584: }
0585:
0586: public static final MassTransferRate newPoundsPerKilosecond(double v) {
0587: return new MassTransferRate(v
0588: * (1.0d / (0.0022046226 / (1.0d / 1000))));
0589: }
0590:
0591: public static final MassTransferRate newPoundsPerKilosecond(String s) {
0592: return new MassTransferRate((Double.valueOf(s).doubleValue())
0593: * (1.0d / (0.0022046226 / (1.0d / 1000))));
0594: }
0595:
0596: public static final MassTransferRate newPoundsPerMonth(double v) {
0597: return new MassTransferRate(v
0598: * (1.0d / (0.0022046226 / (1.0d / 2629743.8))));
0599: }
0600:
0601: public static final MassTransferRate newPoundsPerMonth(String s) {
0602: return new MassTransferRate((Double.valueOf(s).doubleValue())
0603: * (1.0d / (0.0022046226 / (1.0d / 2629743.8))));
0604: }
0605:
0606: public static final MassTransferRate newPoundsPerYear(double v) {
0607: return new MassTransferRate(v
0608: * (1.0d / (0.0022046226 / (1.0d / 31556926))));
0609: }
0610:
0611: public static final MassTransferRate newPoundsPerYear(String s) {
0612: return new MassTransferRate((Double.valueOf(s).doubleValue())
0613: * (1.0d / (0.0022046226 / (1.0d / 31556926))));
0614: }
0615:
0616: public static final MassTransferRate newPoundsPerFortnight(double v) {
0617: return new MassTransferRate(v
0618: * (1.0d / (0.0022046226 / (1.0d / 1209600))));
0619: }
0620:
0621: public static final MassTransferRate newPoundsPerFortnight(String s) {
0622: return new MassTransferRate((Double.valueOf(s).doubleValue())
0623: * (1.0d / (0.0022046226 / (1.0d / 1209600))));
0624: }
0625:
0626: public static final MassTransferRate newTonsPerSecond(double v) {
0627: return new MassTransferRate(v
0628: * (1.0d / ((1.0d / 907184.74) / 1.0d)));
0629: }
0630:
0631: public static final MassTransferRate newTonsPerSecond(String s) {
0632: return new MassTransferRate((Double.valueOf(s).doubleValue())
0633: * (1.0d / ((1.0d / 907184.74) / 1.0d)));
0634: }
0635:
0636: public static final MassTransferRate newTonsPerMinute(double v) {
0637: return new MassTransferRate(v
0638: * (1.0d / ((1.0d / 907184.74) / (1.0d / 60))));
0639: }
0640:
0641: public static final MassTransferRate newTonsPerMinute(String s) {
0642: return new MassTransferRate((Double.valueOf(s).doubleValue())
0643: * (1.0d / ((1.0d / 907184.74) / (1.0d / 60))));
0644: }
0645:
0646: public static final MassTransferRate newTonsPerHour(double v) {
0647: return new MassTransferRate(v
0648: * (1.0d / ((1.0d / 907184.74) / (1.0d / 3600))));
0649: }
0650:
0651: public static final MassTransferRate newTonsPerHour(String s) {
0652: return new MassTransferRate((Double.valueOf(s).doubleValue())
0653: * (1.0d / ((1.0d / 907184.74) / (1.0d / 3600))));
0654: }
0655:
0656: public static final MassTransferRate newTonsPerDay(double v) {
0657: return new MassTransferRate(v
0658: * (1.0d / ((1.0d / 907184.74) / (1.0d / 86400))));
0659: }
0660:
0661: public static final MassTransferRate newTonsPerDay(String s) {
0662: return new MassTransferRate((Double.valueOf(s).doubleValue())
0663: * (1.0d / ((1.0d / 907184.74) / (1.0d / 86400))));
0664: }
0665:
0666: public static final MassTransferRate newTonsPerWeek(double v) {
0667: return new MassTransferRate(v
0668: * (1.0d / ((1.0d / 907184.74) / (1.0d / 604800))));
0669: }
0670:
0671: public static final MassTransferRate newTonsPerWeek(String s) {
0672: return new MassTransferRate((Double.valueOf(s).doubleValue())
0673: * (1.0d / ((1.0d / 907184.74) / (1.0d / 604800))));
0674: }
0675:
0676: public static final MassTransferRate newTonsPerMillisecond(double v) {
0677: return new MassTransferRate(v
0678: * (1.0d / ((1.0d / 907184.74) / 1000)));
0679: }
0680:
0681: public static final MassTransferRate newTonsPerMillisecond(String s) {
0682: return new MassTransferRate((Double.valueOf(s).doubleValue())
0683: * (1.0d / ((1.0d / 907184.74) / 1000)));
0684: }
0685:
0686: public static final MassTransferRate newTonsPerKilosecond(double v) {
0687: return new MassTransferRate(v
0688: * (1.0d / ((1.0d / 907184.74) / (1.0d / 1000))));
0689: }
0690:
0691: public static final MassTransferRate newTonsPerKilosecond(String s) {
0692: return new MassTransferRate((Double.valueOf(s).doubleValue())
0693: * (1.0d / ((1.0d / 907184.74) / (1.0d / 1000))));
0694: }
0695:
0696: public static final MassTransferRate newTonsPerMonth(double v) {
0697: return new MassTransferRate(v
0698: * (1.0d / ((1.0d / 907184.74) / (1.0d / 2629743.8))));
0699: }
0700:
0701: public static final MassTransferRate newTonsPerMonth(String s) {
0702: return new MassTransferRate((Double.valueOf(s).doubleValue())
0703: * (1.0d / ((1.0d / 907184.74) / (1.0d / 2629743.8))));
0704: }
0705:
0706: public static final MassTransferRate newTonsPerYear(double v) {
0707: return new MassTransferRate(v
0708: * (1.0d / ((1.0d / 907184.74) / (1.0d / 31556926))));
0709: }
0710:
0711: public static final MassTransferRate newTonsPerYear(String s) {
0712: return new MassTransferRate((Double.valueOf(s).doubleValue())
0713: * (1.0d / ((1.0d / 907184.74) / (1.0d / 31556926))));
0714: }
0715:
0716: public static final MassTransferRate newTonsPerFortnight(double v) {
0717: return new MassTransferRate(v
0718: * (1.0d / ((1.0d / 907184.74) / (1.0d / 1209600))));
0719: }
0720:
0721: public static final MassTransferRate newTonsPerFortnight(String s) {
0722: return new MassTransferRate((Double.valueOf(s).doubleValue())
0723: * (1.0d / ((1.0d / 907184.74) / (1.0d / 1209600))));
0724: }
0725:
0726: public static final MassTransferRate newShortTonsPerSecond(double v) {
0727: return new MassTransferRate(v
0728: * (1.0d / ((1.0d / 907184.74) / 1.0d)));
0729: }
0730:
0731: public static final MassTransferRate newShortTonsPerSecond(String s) {
0732: return new MassTransferRate((Double.valueOf(s).doubleValue())
0733: * (1.0d / ((1.0d / 907184.74) / 1.0d)));
0734: }
0735:
0736: public static final MassTransferRate newShortTonsPerMinute(double v) {
0737: return new MassTransferRate(v
0738: * (1.0d / ((1.0d / 907184.74) / (1.0d / 60))));
0739: }
0740:
0741: public static final MassTransferRate newShortTonsPerMinute(String s) {
0742: return new MassTransferRate((Double.valueOf(s).doubleValue())
0743: * (1.0d / ((1.0d / 907184.74) / (1.0d / 60))));
0744: }
0745:
0746: public static final MassTransferRate newShortTonsPerHour(double v) {
0747: return new MassTransferRate(v
0748: * (1.0d / ((1.0d / 907184.74) / (1.0d / 3600))));
0749: }
0750:
0751: public static final MassTransferRate newShortTonsPerHour(String s) {
0752: return new MassTransferRate((Double.valueOf(s).doubleValue())
0753: * (1.0d / ((1.0d / 907184.74) / (1.0d / 3600))));
0754: }
0755:
0756: public static final MassTransferRate newShortTonsPerDay(double v) {
0757: return new MassTransferRate(v
0758: * (1.0d / ((1.0d / 907184.74) / (1.0d / 86400))));
0759: }
0760:
0761: public static final MassTransferRate newShortTonsPerDay(String s) {
0762: return new MassTransferRate((Double.valueOf(s).doubleValue())
0763: * (1.0d / ((1.0d / 907184.74) / (1.0d / 86400))));
0764: }
0765:
0766: public static final MassTransferRate newShortTonsPerWeek(double v) {
0767: return new MassTransferRate(v
0768: * (1.0d / ((1.0d / 907184.74) / (1.0d / 604800))));
0769: }
0770:
0771: public static final MassTransferRate newShortTonsPerWeek(String s) {
0772: return new MassTransferRate((Double.valueOf(s).doubleValue())
0773: * (1.0d / ((1.0d / 907184.74) / (1.0d / 604800))));
0774: }
0775:
0776: public static final MassTransferRate newShortTonsPerMillisecond(
0777: double v) {
0778: return new MassTransferRate(v
0779: * (1.0d / ((1.0d / 907184.74) / 1000)));
0780: }
0781:
0782: public static final MassTransferRate newShortTonsPerMillisecond(
0783: String s) {
0784: return new MassTransferRate((Double.valueOf(s).doubleValue())
0785: * (1.0d / ((1.0d / 907184.74) / 1000)));
0786: }
0787:
0788: public static final MassTransferRate newShortTonsPerKilosecond(
0789: double v) {
0790: return new MassTransferRate(v
0791: * (1.0d / ((1.0d / 907184.74) / (1.0d / 1000))));
0792: }
0793:
0794: public static final MassTransferRate newShortTonsPerKilosecond(
0795: String s) {
0796: return new MassTransferRate((Double.valueOf(s).doubleValue())
0797: * (1.0d / ((1.0d / 907184.74) / (1.0d / 1000))));
0798: }
0799:
0800: public static final MassTransferRate newShortTonsPerMonth(double v) {
0801: return new MassTransferRate(v
0802: * (1.0d / ((1.0d / 907184.74) / (1.0d / 2629743.8))));
0803: }
0804:
0805: public static final MassTransferRate newShortTonsPerMonth(String s) {
0806: return new MassTransferRate((Double.valueOf(s).doubleValue())
0807: * (1.0d / ((1.0d / 907184.74) / (1.0d / 2629743.8))));
0808: }
0809:
0810: public static final MassTransferRate newShortTonsPerYear(double v) {
0811: return new MassTransferRate(v
0812: * (1.0d / ((1.0d / 907184.74) / (1.0d / 31556926))));
0813: }
0814:
0815: public static final MassTransferRate newShortTonsPerYear(String s) {
0816: return new MassTransferRate((Double.valueOf(s).doubleValue())
0817: * (1.0d / ((1.0d / 907184.74) / (1.0d / 31556926))));
0818: }
0819:
0820: public static final MassTransferRate newShortTonsPerFortnight(
0821: double v) {
0822: return new MassTransferRate(v
0823: * (1.0d / ((1.0d / 907184.74) / (1.0d / 1209600))));
0824: }
0825:
0826: public static final MassTransferRate newShortTonsPerFortnight(
0827: String s) {
0828: return new MassTransferRate((Double.valueOf(s).doubleValue())
0829: * (1.0d / ((1.0d / 907184.74) / (1.0d / 1209600))));
0830: }
0831:
0832: public static final MassTransferRate newLongTonsPerSecond(double v) {
0833: return new MassTransferRate(v
0834: * (1.0d / ((1.0d / 1016046.9) / 1.0d)));
0835: }
0836:
0837: public static final MassTransferRate newLongTonsPerSecond(String s) {
0838: return new MassTransferRate((Double.valueOf(s).doubleValue())
0839: * (1.0d / ((1.0d / 1016046.9) / 1.0d)));
0840: }
0841:
0842: public static final MassTransferRate newLongTonsPerMinute(double v) {
0843: return new MassTransferRate(v
0844: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 60))));
0845: }
0846:
0847: public static final MassTransferRate newLongTonsPerMinute(String s) {
0848: return new MassTransferRate((Double.valueOf(s).doubleValue())
0849: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 60))));
0850: }
0851:
0852: public static final MassTransferRate newLongTonsPerHour(double v) {
0853: return new MassTransferRate(v
0854: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 3600))));
0855: }
0856:
0857: public static final MassTransferRate newLongTonsPerHour(String s) {
0858: return new MassTransferRate((Double.valueOf(s).doubleValue())
0859: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 3600))));
0860: }
0861:
0862: public static final MassTransferRate newLongTonsPerDay(double v) {
0863: return new MassTransferRate(v
0864: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 86400))));
0865: }
0866:
0867: public static final MassTransferRate newLongTonsPerDay(String s) {
0868: return new MassTransferRate((Double.valueOf(s).doubleValue())
0869: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 86400))));
0870: }
0871:
0872: public static final MassTransferRate newLongTonsPerWeek(double v) {
0873: return new MassTransferRate(v
0874: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 604800))));
0875: }
0876:
0877: public static final MassTransferRate newLongTonsPerWeek(String s) {
0878: return new MassTransferRate((Double.valueOf(s).doubleValue())
0879: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 604800))));
0880: }
0881:
0882: public static final MassTransferRate newLongTonsPerMillisecond(
0883: double v) {
0884: return new MassTransferRate(v
0885: * (1.0d / ((1.0d / 1016046.9) / 1000)));
0886: }
0887:
0888: public static final MassTransferRate newLongTonsPerMillisecond(
0889: String s) {
0890: return new MassTransferRate((Double.valueOf(s).doubleValue())
0891: * (1.0d / ((1.0d / 1016046.9) / 1000)));
0892: }
0893:
0894: public static final MassTransferRate newLongTonsPerKilosecond(
0895: double v) {
0896: return new MassTransferRate(v
0897: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 1000))));
0898: }
0899:
0900: public static final MassTransferRate newLongTonsPerKilosecond(
0901: String s) {
0902: return new MassTransferRate((Double.valueOf(s).doubleValue())
0903: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 1000))));
0904: }
0905:
0906: public static final MassTransferRate newLongTonsPerMonth(double v) {
0907: return new MassTransferRate(v
0908: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 2629743.8))));
0909: }
0910:
0911: public static final MassTransferRate newLongTonsPerMonth(String s) {
0912: return new MassTransferRate((Double.valueOf(s).doubleValue())
0913: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 2629743.8))));
0914: }
0915:
0916: public static final MassTransferRate newLongTonsPerYear(double v) {
0917: return new MassTransferRate(v
0918: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 31556926))));
0919: }
0920:
0921: public static final MassTransferRate newLongTonsPerYear(String s) {
0922: return new MassTransferRate((Double.valueOf(s).doubleValue())
0923: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 31556926))));
0924: }
0925:
0926: public static final MassTransferRate newLongTonsPerFortnight(
0927: double v) {
0928: return new MassTransferRate(v
0929: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 1209600))));
0930: }
0931:
0932: public static final MassTransferRate newLongTonsPerFortnight(
0933: String s) {
0934: return new MassTransferRate((Double.valueOf(s).doubleValue())
0935: * (1.0d / ((1.0d / 1016046.9) / (1.0d / 1209600))));
0936: }
0937:
0938: public int getCommonUnit() {
0939: return 30;
0940: }
0941:
0942: public int getMaxUnit() {
0943: return MAXUNIT;
0944: }
0945:
0946: // unit names for getUnitName
0947: private static final String unitNames[] = { "grams/second",
0948: "grams/minute", "grams/hour", "grams/day", "grams/week",
0949: "grams/millisecond", "grams/kilosecond", "grams/month",
0950: "grams/year", "grams/fortnight", "kilograms/second",
0951: "kilograms/minute", "kilograms/hour", "kilograms/day",
0952: "kilograms/week", "kilograms/millisecond",
0953: "kilograms/kilosecond", "kilograms/month",
0954: "kilograms/year", "kilograms/fortnight", "ounces/second",
0955: "ounces/minute", "ounces/hour", "ounces/day",
0956: "ounces/week", "ounces/millisecond", "ounces/kilosecond",
0957: "ounces/month", "ounces/year", "ounces/fortnight",
0958: "pounds/second", "pounds/minute", "pounds/hour",
0959: "pounds/day", "pounds/week", "pounds/millisecond",
0960: "pounds/kilosecond", "pounds/month", "pounds/year",
0961: "pounds/fortnight", "tons/second", "tons/minute",
0962: "tons/hour", "tons/day", "tons/week", "tons/millisecond",
0963: "tons/kilosecond", "tons/month", "tons/year",
0964: "tons/fortnight", "short_tons/second", "short_tons/minute",
0965: "short_tons/hour", "short_tons/day", "short_tons/week",
0966: "short_tons/millisecond", "short_tons/kilosecond",
0967: "short_tons/month", "short_tons/year",
0968: "short_tons/fortnight", "long_tons/second",
0969: "long_tons/minute", "long_tons/hour", "long_tons/day",
0970: "long_tons/week", "long_tons/millisecond",
0971: "long_tons/kilosecond", "long_tons/month",
0972: "long_tons/year", "long_tons/fortnight", };
0973:
0974: /** @param unit One of the constant units of MassTransferRate **/
0975: public final String getUnitName(int unit) {
0976: return unitNames[unit];
0977: }
0978:
0979: // Index Typed factory methods
0980: static final double convFactor[] = { (1.0d / 1.0d),
0981: (1.0d / (1.0d / 60)), (1.0d / (1.0d / 3600)),
0982: (1.0d / (1.0d / 86400)), (1.0d / (1.0d / 604800)),
0983: (1.0d / 1000), (1.0d / (1.0d / 1000)),
0984: (1.0d / (1.0d / 2629743.8)), (1.0d / (1.0d / 31556926)),
0985: (1.0d / (1.0d / 1209600)), ((1.0d / 1000) / 1.0d),
0986: ((1.0d / 1000) / (1.0d / 60)),
0987: ((1.0d / 1000) / (1.0d / 3600)),
0988: ((1.0d / 1000) / (1.0d / 86400)),
0989: ((1.0d / 1000) / (1.0d / 604800)), ((1.0d / 1000) / 1000),
0990: ((1.0d / 1000) / (1.0d / 1000)),
0991: ((1.0d / 1000) / (1.0d / 2629743.8)),
0992: ((1.0d / 1000) / (1.0d / 31556926)),
0993: ((1.0d / 1000) / (1.0d / 1209600)), (0.035273962 / 1.0d),
0994: (0.035273962 / (1.0d / 60)), (0.035273962 / (1.0d / 3600)),
0995: (0.035273962 / (1.0d / 86400)),
0996: (0.035273962 / (1.0d / 604800)), (0.035273962 / 1000),
0997: (0.035273962 / (1.0d / 1000)),
0998: (0.035273962 / (1.0d / 2629743.8)),
0999: (0.035273962 / (1.0d / 31556926)),
1000: (0.035273962 / (1.0d / 1209600)), (0.0022046226 / 1.0d),
1001: (0.0022046226 / (1.0d / 60)),
1002: (0.0022046226 / (1.0d / 3600)),
1003: (0.0022046226 / (1.0d / 86400)),
1004: (0.0022046226 / (1.0d / 604800)), (0.0022046226 / 1000),
1005: (0.0022046226 / (1.0d / 1000)),
1006: (0.0022046226 / (1.0d / 2629743.8)),
1007: (0.0022046226 / (1.0d / 31556926)),
1008: (0.0022046226 / (1.0d / 1209600)),
1009: ((1.0d / 907184.74) / 1.0d),
1010: ((1.0d / 907184.74) / (1.0d / 60)),
1011: ((1.0d / 907184.74) / (1.0d / 3600)),
1012: ((1.0d / 907184.74) / (1.0d / 86400)),
1013: ((1.0d / 907184.74) / (1.0d / 604800)),
1014: ((1.0d / 907184.74) / 1000),
1015: ((1.0d / 907184.74) / (1.0d / 1000)),
1016: ((1.0d / 907184.74) / (1.0d / 2629743.8)),
1017: ((1.0d / 907184.74) / (1.0d / 31556926)),
1018: ((1.0d / 907184.74) / (1.0d / 1209600)),
1019: ((1.0d / 907184.74) / 1.0d),
1020: ((1.0d / 907184.74) / (1.0d / 60)),
1021: ((1.0d / 907184.74) / (1.0d / 3600)),
1022: ((1.0d / 907184.74) / (1.0d / 86400)),
1023: ((1.0d / 907184.74) / (1.0d / 604800)),
1024: ((1.0d / 907184.74) / 1000),
1025: ((1.0d / 907184.74) / (1.0d / 1000)),
1026: ((1.0d / 907184.74) / (1.0d / 2629743.8)),
1027: ((1.0d / 907184.74) / (1.0d / 31556926)),
1028: ((1.0d / 907184.74) / (1.0d / 1209600)),
1029: ((1.0d / 1016046.9) / 1.0d),
1030: ((1.0d / 1016046.9) / (1.0d / 60)),
1031: ((1.0d / 1016046.9) / (1.0d / 3600)),
1032: ((1.0d / 1016046.9) / (1.0d / 86400)),
1033: ((1.0d / 1016046.9) / (1.0d / 604800)),
1034: ((1.0d / 1016046.9) / 1000),
1035: ((1.0d / 1016046.9) / (1.0d / 1000)),
1036: ((1.0d / 1016046.9) / (1.0d / 2629743.8)),
1037: ((1.0d / 1016046.9) / (1.0d / 31556926)),
1038: ((1.0d / 1016046.9) / (1.0d / 1209600)), };
1039:
1040: public static final double getConvFactor(int i) {
1041: return convFactor[i];
1042: }
1043:
1044: // indexes into factor array
1045: public static final int GRAMS_PER_SECOND = 0;
1046: public static final int GRAMS_PER_MINUTE = 1;
1047: public static final int GRAMS_PER_HOUR = 2;
1048: public static final int GRAMS_PER_DAY = 3;
1049: public static final int GRAMS_PER_WEEK = 4;
1050: public static final int GRAMS_PER_MILLISECOND = 5;
1051: public static final int GRAMS_PER_KILOSECOND = 6;
1052: public static final int GRAMS_PER_MONTH = 7;
1053: public static final int GRAMS_PER_YEAR = 8;
1054: public static final int GRAMS_PER_FORTNIGHT = 9;
1055: public static final int KILOGRAMS_PER_SECOND = 10;
1056: public static final int KILOGRAMS_PER_MINUTE = 11;
1057: public static final int KILOGRAMS_PER_HOUR = 12;
1058: public static final int KILOGRAMS_PER_DAY = 13;
1059: public static final int KILOGRAMS_PER_WEEK = 14;
1060: public static final int KILOGRAMS_PER_MILLISECOND = 15;
1061: public static final int KILOGRAMS_PER_KILOSECOND = 16;
1062: public static final int KILOGRAMS_PER_MONTH = 17;
1063: public static final int KILOGRAMS_PER_YEAR = 18;
1064: public static final int KILOGRAMS_PER_FORTNIGHT = 19;
1065: public static final int OUNCES_PER_SECOND = 20;
1066: public static final int OUNCES_PER_MINUTE = 21;
1067: public static final int OUNCES_PER_HOUR = 22;
1068: public static final int OUNCES_PER_DAY = 23;
1069: public static final int OUNCES_PER_WEEK = 24;
1070: public static final int OUNCES_PER_MILLISECOND = 25;
1071: public static final int OUNCES_PER_KILOSECOND = 26;
1072: public static final int OUNCES_PER_MONTH = 27;
1073: public static final int OUNCES_PER_YEAR = 28;
1074: public static final int OUNCES_PER_FORTNIGHT = 29;
1075: public static final int POUNDS_PER_SECOND = 30;
1076: public static final int POUNDS_PER_MINUTE = 31;
1077: public static final int POUNDS_PER_HOUR = 32;
1078: public static final int POUNDS_PER_DAY = 33;
1079: public static final int POUNDS_PER_WEEK = 34;
1080: public static final int POUNDS_PER_MILLISECOND = 35;
1081: public static final int POUNDS_PER_KILOSECOND = 36;
1082: public static final int POUNDS_PER_MONTH = 37;
1083: public static final int POUNDS_PER_YEAR = 38;
1084: public static final int POUNDS_PER_FORTNIGHT = 39;
1085: public static final int TONS_PER_SECOND = 40;
1086: public static final int TONS_PER_MINUTE = 41;
1087: public static final int TONS_PER_HOUR = 42;
1088: public static final int TONS_PER_DAY = 43;
1089: public static final int TONS_PER_WEEK = 44;
1090: public static final int TONS_PER_MILLISECOND = 45;
1091: public static final int TONS_PER_KILOSECOND = 46;
1092: public static final int TONS_PER_MONTH = 47;
1093: public static final int TONS_PER_YEAR = 48;
1094: public static final int TONS_PER_FORTNIGHT = 49;
1095: public static final int SHORT_TONS_PER_SECOND = 50;
1096: public static final int SHORT_TONS_PER_MINUTE = 51;
1097: public static final int SHORT_TONS_PER_HOUR = 52;
1098: public static final int SHORT_TONS_PER_DAY = 53;
1099: public static final int SHORT_TONS_PER_WEEK = 54;
1100: public static final int SHORT_TONS_PER_MILLISECOND = 55;
1101: public static final int SHORT_TONS_PER_KILOSECOND = 56;
1102: public static final int SHORT_TONS_PER_MONTH = 57;
1103: public static final int SHORT_TONS_PER_YEAR = 58;
1104: public static final int SHORT_TONS_PER_FORTNIGHT = 59;
1105: public static final int LONG_TONS_PER_SECOND = 60;
1106: public static final int LONG_TONS_PER_MINUTE = 61;
1107: public static final int LONG_TONS_PER_HOUR = 62;
1108: public static final int LONG_TONS_PER_DAY = 63;
1109: public static final int LONG_TONS_PER_WEEK = 64;
1110: public static final int LONG_TONS_PER_MILLISECOND = 65;
1111: public static final int LONG_TONS_PER_KILOSECOND = 66;
1112: public static final int LONG_TONS_PER_MONTH = 67;
1113: public static final int LONG_TONS_PER_YEAR = 68;
1114: public static final int LONG_TONS_PER_FORTNIGHT = 69;
1115: static final int MAXUNIT = 69;
1116:
1117: // Index Typed factory methods
1118: /** @param unit One of the constant units of MassTransferRate **/
1119: public static final MassTransferRate newMassTransferRate(double v,
1120: int unit) {
1121: if (unit >= 0 && unit <= MAXUNIT)
1122: return new MassTransferRate(v * getConvFactor(unit));
1123: else
1124: throw new UnknownUnitException();
1125: }
1126:
1127: /** @param unit One of the constant units of MassTransferRate **/
1128: public static final MassTransferRate newMassTransferRate(String s,
1129: int unit) {
1130: if (unit >= 0 && unit <= MAXUNIT)
1131: return new MassTransferRate((Double.valueOf(s)
1132: .doubleValue())
1133: * getConvFactor(unit));
1134: else
1135: throw new UnknownUnitException();
1136: }
1137:
1138: // Index Typed factory methods
1139: /** @param unit1 One of the constant units of Mass
1140: * @param unit2 One of the constant units of Duration
1141: **/
1142: public static final MassTransferRate newMassTransferRate(double v,
1143: int unit1, int unit2) {
1144: if (unit1 >= 0 && unit1 <= Mass.MAXUNIT && unit2 >= 0
1145: && unit2 <= Duration.MAXUNIT)
1146: return new MassTransferRate(v * Mass.getConvFactor(unit1)
1147: / Duration.getConvFactor(unit2));
1148: else
1149: throw new UnknownUnitException();
1150: }
1151:
1152: /** @param num An instance of Mass to use as numerator
1153: * @param den An instance of Durationto use as denominator
1154: **/
1155: public static final MassTransferRate newMassTransferRate(Mass num,
1156: Duration den) {
1157: return new MassTransferRate(num.getValue(0) / den.getValue(0));
1158: }
1159:
1160: /** @param unit1 One of the constant units of Mass
1161: * @param unit2 One of the constant units of Duration
1162: **/
1163: public static final MassTransferRate newMassTransferRate(String s,
1164: int unit1, int unit2) {
1165: if (unit1 >= 0 && unit1 <= Mass.MAXUNIT && unit2 >= 0
1166: && unit2 <= Duration.MAXUNIT)
1167: return new MassTransferRate((Double.valueOf(s)
1168: .doubleValue())
1169: * Mass.getConvFactor(unit1)
1170: / Duration.getConvFactor(unit2));
1171: else
1172: throw new UnknownUnitException();
1173: }
1174:
1175: // Support for AbstractMeasure-level constructor
1176: public static final AbstractMeasure newMeasure(String s, int unit) {
1177: return newMassTransferRate(s, unit);
1178: }
1179:
1180: public static final AbstractMeasure newMeasure(double v, int unit) {
1181: return newMassTransferRate(v, unit);
1182: }
1183:
1184: // simple math : addition and subtraction
1185: public final Measure add(Measure toAdd) {
1186: if (!(toAdd instanceof MassTransferRate))
1187: throw new IllegalArgumentException();
1188: return new MassTransferRate(theValue + toAdd.getNativeValue());
1189: }
1190:
1191: public final Measure subtract(Measure toSubtract) {
1192: if (!(toSubtract instanceof MassTransferRate))
1193: throw new IllegalArgumentException();
1194: return new MassTransferRate(theValue
1195: - toSubtract.getNativeValue());
1196: }
1197:
1198: public final Measure scale(double scale) {
1199: return new MassTransferRate(theValue * scale, 0);
1200: }
1201:
1202: public final Measure negate() {
1203: return newMassTransferRate(-1 * theValue, 0);
1204: }
1205:
1206: public final Measure floor(int unit) {
1207: return newMassTransferRate(Math.floor(getValue(unit)), 0);
1208: }
1209:
1210: public final Measure valueOf(double value) {
1211: return new MassTransferRate(value);
1212: }
1213:
1214: public final Measure valueOf(double value, int unit) {
1215: return new MassTransferRate(value, unit);
1216: }
1217:
1218: public final double getNativeValue() {
1219: return theValue;
1220: }
1221:
1222: public final int getNativeUnit() {
1223: return 0;
1224: }
1225:
1226: public final Duration divide(Rate toRate) {
1227: throw new IllegalArgumentException(
1228: "Call divideRate instead to divide one Rate by another.");
1229: }
1230:
1231: public final double divideRate(Rate toRate) {
1232: if (toRate.getCanonicalNumerator().getClass() != getCanonicalNumerator()
1233: .getClass()
1234: || toRate.getCanonicalDenominator().getClass() != getCanonicalDenominator()
1235: .getClass()) {
1236: throw new IllegalArgumentException(
1237: "Expecting a MassTransferRate"
1238: + ", got a "
1239: + toRate.getCanonicalNumerator().getClass()
1240: + "/"
1241: + toRate.getCanonicalDenominator()
1242: .getClass());
1243: }
1244: return theValue / toRate.getNativeValue();
1245: }
1246:
1247: // Unit-based Reader methods
1248: public double getGramsPerSecond() {
1249: return (theValue * (1.0d / 1.0d));
1250: }
1251:
1252: public double getGramsPerMinute() {
1253: return (theValue * (1.0d / (1.0d / 60)));
1254: }
1255:
1256: public double getGramsPerHour() {
1257: return (theValue * (1.0d / (1.0d / 3600)));
1258: }
1259:
1260: public double getGramsPerDay() {
1261: return (theValue * (1.0d / (1.0d / 86400)));
1262: }
1263:
1264: public double getGramsPerWeek() {
1265: return (theValue * (1.0d / (1.0d / 604800)));
1266: }
1267:
1268: public double getGramsPerMillisecond() {
1269: return (theValue * (1.0d / 1000));
1270: }
1271:
1272: public double getGramsPerKilosecond() {
1273: return (theValue * (1.0d / (1.0d / 1000)));
1274: }
1275:
1276: public double getGramsPerMonth() {
1277: return (theValue * (1.0d / (1.0d / 2629743.8)));
1278: }
1279:
1280: public double getGramsPerYear() {
1281: return (theValue * (1.0d / (1.0d / 31556926)));
1282: }
1283:
1284: public double getGramsPerFortnight() {
1285: return (theValue * (1.0d / (1.0d / 1209600)));
1286: }
1287:
1288: public double getKilogramsPerSecond() {
1289: return (theValue * ((1.0d / 1000) / 1.0d));
1290: }
1291:
1292: public double getKilogramsPerMinute() {
1293: return (theValue * ((1.0d / 1000) / (1.0d / 60)));
1294: }
1295:
1296: public double getKilogramsPerHour() {
1297: return (theValue * ((1.0d / 1000) / (1.0d / 3600)));
1298: }
1299:
1300: public double getKilogramsPerDay() {
1301: return (theValue * ((1.0d / 1000) / (1.0d / 86400)));
1302: }
1303:
1304: public double getKilogramsPerWeek() {
1305: return (theValue * ((1.0d / 1000) / (1.0d / 604800)));
1306: }
1307:
1308: public double getKilogramsPerMillisecond() {
1309: return (theValue * ((1.0d / 1000) / 1000));
1310: }
1311:
1312: public double getKilogramsPerKilosecond() {
1313: return (theValue * ((1.0d / 1000) / (1.0d / 1000)));
1314: }
1315:
1316: public double getKilogramsPerMonth() {
1317: return (theValue * ((1.0d / 1000) / (1.0d / 2629743.8)));
1318: }
1319:
1320: public double getKilogramsPerYear() {
1321: return (theValue * ((1.0d / 1000) / (1.0d / 31556926)));
1322: }
1323:
1324: public double getKilogramsPerFortnight() {
1325: return (theValue * ((1.0d / 1000) / (1.0d / 1209600)));
1326: }
1327:
1328: public double getOuncesPerSecond() {
1329: return (theValue * (0.035273962 / 1.0d));
1330: }
1331:
1332: public double getOuncesPerMinute() {
1333: return (theValue * (0.035273962 / (1.0d / 60)));
1334: }
1335:
1336: public double getOuncesPerHour() {
1337: return (theValue * (0.035273962 / (1.0d / 3600)));
1338: }
1339:
1340: public double getOuncesPerDay() {
1341: return (theValue * (0.035273962 / (1.0d / 86400)));
1342: }
1343:
1344: public double getOuncesPerWeek() {
1345: return (theValue * (0.035273962 / (1.0d / 604800)));
1346: }
1347:
1348: public double getOuncesPerMillisecond() {
1349: return (theValue * (0.035273962 / 1000));
1350: }
1351:
1352: public double getOuncesPerKilosecond() {
1353: return (theValue * (0.035273962 / (1.0d / 1000)));
1354: }
1355:
1356: public double getOuncesPerMonth() {
1357: return (theValue * (0.035273962 / (1.0d / 2629743.8)));
1358: }
1359:
1360: public double getOuncesPerYear() {
1361: return (theValue * (0.035273962 / (1.0d / 31556926)));
1362: }
1363:
1364: public double getOuncesPerFortnight() {
1365: return (theValue * (0.035273962 / (1.0d / 1209600)));
1366: }
1367:
1368: public double getPoundsPerSecond() {
1369: return (theValue * (0.0022046226 / 1.0d));
1370: }
1371:
1372: public double getPoundsPerMinute() {
1373: return (theValue * (0.0022046226 / (1.0d / 60)));
1374: }
1375:
1376: public double getPoundsPerHour() {
1377: return (theValue * (0.0022046226 / (1.0d / 3600)));
1378: }
1379:
1380: public double getPoundsPerDay() {
1381: return (theValue * (0.0022046226 / (1.0d / 86400)));
1382: }
1383:
1384: public double getPoundsPerWeek() {
1385: return (theValue * (0.0022046226 / (1.0d / 604800)));
1386: }
1387:
1388: public double getPoundsPerMillisecond() {
1389: return (theValue * (0.0022046226 / 1000));
1390: }
1391:
1392: public double getPoundsPerKilosecond() {
1393: return (theValue * (0.0022046226 / (1.0d / 1000)));
1394: }
1395:
1396: public double getPoundsPerMonth() {
1397: return (theValue * (0.0022046226 / (1.0d / 2629743.8)));
1398: }
1399:
1400: public double getPoundsPerYear() {
1401: return (theValue * (0.0022046226 / (1.0d / 31556926)));
1402: }
1403:
1404: public double getPoundsPerFortnight() {
1405: return (theValue * (0.0022046226 / (1.0d / 1209600)));
1406: }
1407:
1408: public double getTonsPerSecond() {
1409: return (theValue * ((1.0d / 907184.74) / 1.0d));
1410: }
1411:
1412: public double getTonsPerMinute() {
1413: return (theValue * ((1.0d / 907184.74) / (1.0d / 60)));
1414: }
1415:
1416: public double getTonsPerHour() {
1417: return (theValue * ((1.0d / 907184.74) / (1.0d / 3600)));
1418: }
1419:
1420: public double getTonsPerDay() {
1421: return (theValue * ((1.0d / 907184.74) / (1.0d / 86400)));
1422: }
1423:
1424: public double getTonsPerWeek() {
1425: return (theValue * ((1.0d / 907184.74) / (1.0d / 604800)));
1426: }
1427:
1428: public double getTonsPerMillisecond() {
1429: return (theValue * ((1.0d / 907184.74) / 1000));
1430: }
1431:
1432: public double getTonsPerKilosecond() {
1433: return (theValue * ((1.0d / 907184.74) / (1.0d / 1000)));
1434: }
1435:
1436: public double getTonsPerMonth() {
1437: return (theValue * ((1.0d / 907184.74) / (1.0d / 2629743.8)));
1438: }
1439:
1440: public double getTonsPerYear() {
1441: return (theValue * ((1.0d / 907184.74) / (1.0d / 31556926)));
1442: }
1443:
1444: public double getTonsPerFortnight() {
1445: return (theValue * ((1.0d / 907184.74) / (1.0d / 1209600)));
1446: }
1447:
1448: public double getShortTonsPerSecond() {
1449: return (theValue * ((1.0d / 907184.74) / 1.0d));
1450: }
1451:
1452: public double getShortTonsPerMinute() {
1453: return (theValue * ((1.0d / 907184.74) / (1.0d / 60)));
1454: }
1455:
1456: public double getShortTonsPerHour() {
1457: return (theValue * ((1.0d / 907184.74) / (1.0d / 3600)));
1458: }
1459:
1460: public double getShortTonsPerDay() {
1461: return (theValue * ((1.0d / 907184.74) / (1.0d / 86400)));
1462: }
1463:
1464: public double getShortTonsPerWeek() {
1465: return (theValue * ((1.0d / 907184.74) / (1.0d / 604800)));
1466: }
1467:
1468: public double getShortTonsPerMillisecond() {
1469: return (theValue * ((1.0d / 907184.74) / 1000));
1470: }
1471:
1472: public double getShortTonsPerKilosecond() {
1473: return (theValue * ((1.0d / 907184.74) / (1.0d / 1000)));
1474: }
1475:
1476: public double getShortTonsPerMonth() {
1477: return (theValue * ((1.0d / 907184.74) / (1.0d / 2629743.8)));
1478: }
1479:
1480: public double getShortTonsPerYear() {
1481: return (theValue * ((1.0d / 907184.74) / (1.0d / 31556926)));
1482: }
1483:
1484: public double getShortTonsPerFortnight() {
1485: return (theValue * ((1.0d / 907184.74) / (1.0d / 1209600)));
1486: }
1487:
1488: public double getLongTonsPerSecond() {
1489: return (theValue * ((1.0d / 1016046.9) / 1.0d));
1490: }
1491:
1492: public double getLongTonsPerMinute() {
1493: return (theValue * ((1.0d / 1016046.9) / (1.0d / 60)));
1494: }
1495:
1496: public double getLongTonsPerHour() {
1497: return (theValue * ((1.0d / 1016046.9) / (1.0d / 3600)));
1498: }
1499:
1500: public double getLongTonsPerDay() {
1501: return (theValue * ((1.0d / 1016046.9) / (1.0d / 86400)));
1502: }
1503:
1504: public double getLongTonsPerWeek() {
1505: return (theValue * ((1.0d / 1016046.9) / (1.0d / 604800)));
1506: }
1507:
1508: public double getLongTonsPerMillisecond() {
1509: return (theValue * ((1.0d / 1016046.9) / 1000));
1510: }
1511:
1512: public double getLongTonsPerKilosecond() {
1513: return (theValue * ((1.0d / 1016046.9) / (1.0d / 1000)));
1514: }
1515:
1516: public double getLongTonsPerMonth() {
1517: return (theValue * ((1.0d / 1016046.9) / (1.0d / 2629743.8)));
1518: }
1519:
1520: public double getLongTonsPerYear() {
1521: return (theValue * ((1.0d / 1016046.9) / (1.0d / 31556926)));
1522: }
1523:
1524: public double getLongTonsPerFortnight() {
1525: return (theValue * ((1.0d / 1016046.9) / (1.0d / 1209600)));
1526: }
1527:
1528: /** @param unit One of the constant units of MassTransferRate **/
1529: public double getValue(int unit) {
1530: if (unit >= 0 && unit <= MAXUNIT)
1531: return (theValue * getConvFactor(unit));
1532: else
1533: throw new UnknownUnitException();
1534: }
1535:
1536: /** @param unit1 One of the constant units of Mass
1537: * @param unit2 One of the constant units of Duration
1538: **/
1539: public double getValue(int unit1, int unit2) {
1540: if (unit1 >= 0 && unit1 <= Mass.MAXUNIT && unit2 >= 0
1541: && unit2 <= Duration.MAXUNIT)
1542: return (theValue * Duration.getConvFactor(unit2) / Mass
1543: .getConvFactor(unit1));
1544: else
1545: throw new UnknownUnitException();
1546: }
1547:
1548: public boolean equals(Object o) {
1549: return (o instanceof MassTransferRate && theValue == ((MassTransferRate) o).theValue);
1550: }
1551:
1552: public String toString() {
1553: return Double.toString(theValue) + "g/s";
1554: }
1555:
1556: public int hashCode() {
1557: return (new Double(theValue)).hashCode();
1558: }
1559:
1560: // Derivative
1561: public final Class getNumeratorClass() {
1562: return Mass.class;
1563: }
1564:
1565: public final Class getDenominatorClass() {
1566: return Duration.class;
1567: }
1568:
1569: private final static Mass can_num = new Mass(0.0, 0);
1570:
1571: public final Measure getCanonicalNumerator() {
1572: return can_num;
1573: }
1574:
1575: private final static Duration can_den = new Duration(0.0, 0);
1576:
1577: public final Measure getCanonicalDenominator() {
1578: return can_den;
1579: }
1580:
1581: public final Measure computeNumerator(Measure den) {
1582: if (!(den instanceof Duration))
1583: throw new IllegalArgumentException();
1584: return new Mass(theValue * den.getValue(0), 0);
1585: }
1586:
1587: public final Measure computeDenominator(Measure num) {
1588: if (!(num instanceof Mass))
1589: throw new IllegalArgumentException();
1590: return new Duration(num.getValue(0) / theValue, 0);
1591: }
1592:
1593: // serialization
1594: public void writeExternal(ObjectOutput out) throws IOException {
1595: out.writeDouble(theValue);
1596: }
1597:
1598: public void readExternal(ObjectInput in) throws IOException {
1599: theValue = in.readDouble();
1600: }
1601: }
|