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 TimeRate.
0029: **/package org.cougaar.planning.ldm.measure;
0030:
0031: import java.io.*;
0032:
0033: public final class TimeRate extends AbstractMeasure implements
0034: Externalizable, Derivative, Rate {
0035: // the value is stored as seconds/second
0036: private double theValue;
0037:
0038: /** No-arg constructor is only for use by serialization **/
0039: public TimeRate() {
0040: }
0041:
0042: // private constructor
0043: private TimeRate(double v) {
0044: theValue = v;
0045: }
0046:
0047: /** @param unit One of the constant units of TimeRate **/
0048: public TimeRate(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 Duration
0056: * @param unit2 One of the constant units of Duration
0057: **/
0058: public TimeRate(double v, int unit1, int unit2) {
0059: if (unit1 >= 0 && unit1 <= Duration.MAXUNIT && unit2 >= 0
0060: && unit2 <= Duration.MAXUNIT)
0061: theValue = v * Duration.getConvFactor(unit1)
0062: / Duration.getConvFactor(unit2);
0063: else
0064: throw new UnknownUnitException();
0065: }
0066:
0067: /** @param num An instance of Duration to use as numerator
0068: * @param den An instance of Durationto use as denominator
0069: **/
0070: public TimeRate(Duration num, Duration den) {
0071: theValue = num.getValue(0) / den.getValue(0);
0072: }
0073:
0074: /** takes strings of the form "Number unit" **/
0075: public TimeRate(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("secondspersecond"))
0083: theValue = n / (1.0d / 1.0d);
0084: else if (u.equals("secondsperminute"))
0085: theValue = n / (1.0d / (1.0d / 60));
0086: else if (u.equals("secondsperhour"))
0087: theValue = n / (1.0d / (1.0d / 3600));
0088: else if (u.equals("secondsperday"))
0089: theValue = n / (1.0d / (1.0d / 86400));
0090: else if (u.equals("secondsperweek"))
0091: theValue = n / (1.0d / (1.0d / 604800));
0092: else if (u.equals("secondspermillisecond"))
0093: theValue = n / (1.0d / 1000);
0094: else if (u.equals("secondsperkilosecond"))
0095: theValue = n / (1.0d / (1.0d / 1000));
0096: else if (u.equals("secondspermonth"))
0097: theValue = n / (1.0d / (1.0d / 2629743.8));
0098: else if (u.equals("secondsperyear"))
0099: theValue = n / (1.0d / (1.0d / 31556926));
0100: else if (u.equals("secondsperfortnight"))
0101: theValue = n / (1.0d / (1.0d / 1209600));
0102: else if (u.equals("minutespersecond"))
0103: theValue = n / ((1.0d / 60) / 1.0d);
0104: else if (u.equals("minutesperminute"))
0105: theValue = n / ((1.0d / 60) / (1.0d / 60));
0106: else if (u.equals("minutesperhour"))
0107: theValue = n / ((1.0d / 60) / (1.0d / 3600));
0108: else if (u.equals("minutesperday"))
0109: theValue = n / ((1.0d / 60) / (1.0d / 86400));
0110: else if (u.equals("minutesperweek"))
0111: theValue = n / ((1.0d / 60) / (1.0d / 604800));
0112: else if (u.equals("minutespermillisecond"))
0113: theValue = n / ((1.0d / 60) / 1000);
0114: else if (u.equals("minutesperkilosecond"))
0115: theValue = n / ((1.0d / 60) / (1.0d / 1000));
0116: else if (u.equals("minutespermonth"))
0117: theValue = n / ((1.0d / 60) / (1.0d / 2629743.8));
0118: else if (u.equals("minutesperyear"))
0119: theValue = n / ((1.0d / 60) / (1.0d / 31556926));
0120: else if (u.equals("minutesperfortnight"))
0121: theValue = n / ((1.0d / 60) / (1.0d / 1209600));
0122: else if (u.equals("hourspersecond"))
0123: theValue = n / ((1.0d / 3600) / 1.0d);
0124: else if (u.equals("hoursperminute"))
0125: theValue = n / ((1.0d / 3600) / (1.0d / 60));
0126: else if (u.equals("hoursperhour"))
0127: theValue = n / ((1.0d / 3600) / (1.0d / 3600));
0128: else if (u.equals("hoursperday"))
0129: theValue = n / ((1.0d / 3600) / (1.0d / 86400));
0130: else if (u.equals("hoursperweek"))
0131: theValue = n / ((1.0d / 3600) / (1.0d / 604800));
0132: else if (u.equals("hourspermillisecond"))
0133: theValue = n / ((1.0d / 3600) / 1000);
0134: else if (u.equals("hoursperkilosecond"))
0135: theValue = n / ((1.0d / 3600) / (1.0d / 1000));
0136: else if (u.equals("hourspermonth"))
0137: theValue = n / ((1.0d / 3600) / (1.0d / 2629743.8));
0138: else if (u.equals("hoursperyear"))
0139: theValue = n / ((1.0d / 3600) / (1.0d / 31556926));
0140: else if (u.equals("hoursperfortnight"))
0141: theValue = n / ((1.0d / 3600) / (1.0d / 1209600));
0142: else if (u.equals("dayspersecond"))
0143: theValue = n / ((1.0d / 86400) / 1.0d);
0144: else if (u.equals("daysperminute"))
0145: theValue = n / ((1.0d / 86400) / (1.0d / 60));
0146: else if (u.equals("daysperhour"))
0147: theValue = n / ((1.0d / 86400) / (1.0d / 3600));
0148: else if (u.equals("daysperday"))
0149: theValue = n / ((1.0d / 86400) / (1.0d / 86400));
0150: else if (u.equals("daysperweek"))
0151: theValue = n / ((1.0d / 86400) / (1.0d / 604800));
0152: else if (u.equals("dayspermillisecond"))
0153: theValue = n / ((1.0d / 86400) / 1000);
0154: else if (u.equals("daysperkilosecond"))
0155: theValue = n / ((1.0d / 86400) / (1.0d / 1000));
0156: else if (u.equals("dayspermonth"))
0157: theValue = n / ((1.0d / 86400) / (1.0d / 2629743.8));
0158: else if (u.equals("daysperyear"))
0159: theValue = n / ((1.0d / 86400) / (1.0d / 31556926));
0160: else if (u.equals("daysperfortnight"))
0161: theValue = n / ((1.0d / 86400) / (1.0d / 1209600));
0162: else if (u.equals("weekspersecond"))
0163: theValue = n / ((1.0d / 604800) / 1.0d);
0164: else if (u.equals("weeksperminute"))
0165: theValue = n / ((1.0d / 604800) / (1.0d / 60));
0166: else if (u.equals("weeksperhour"))
0167: theValue = n / ((1.0d / 604800) / (1.0d / 3600));
0168: else if (u.equals("weeksperday"))
0169: theValue = n / ((1.0d / 604800) / (1.0d / 86400));
0170: else if (u.equals("weeksperweek"))
0171: theValue = n / ((1.0d / 604800) / (1.0d / 604800));
0172: else if (u.equals("weekspermillisecond"))
0173: theValue = n / ((1.0d / 604800) / 1000);
0174: else if (u.equals("weeksperkilosecond"))
0175: theValue = n / ((1.0d / 604800) / (1.0d / 1000));
0176: else if (u.equals("weekspermonth"))
0177: theValue = n / ((1.0d / 604800) / (1.0d / 2629743.8));
0178: else if (u.equals("weeksperyear"))
0179: theValue = n / ((1.0d / 604800) / (1.0d / 31556926));
0180: else if (u.equals("weeksperfortnight"))
0181: theValue = n / ((1.0d / 604800) / (1.0d / 1209600));
0182: else if (u.equals("millisecondspersecond"))
0183: theValue = n / (1000 / 1.0d);
0184: else if (u.equals("millisecondsperminute"))
0185: theValue = n / (1000 / (1.0d / 60));
0186: else if (u.equals("millisecondsperhour"))
0187: theValue = n / (1000 / (1.0d / 3600));
0188: else if (u.equals("millisecondsperday"))
0189: theValue = n / (1000 / (1.0d / 86400));
0190: else if (u.equals("millisecondsperweek"))
0191: theValue = n / (1000 / (1.0d / 604800));
0192: else if (u.equals("millisecondspermillisecond"))
0193: theValue = n / (1000 / 1000);
0194: else if (u.equals("millisecondsperkilosecond"))
0195: theValue = n / (1000 / (1.0d / 1000));
0196: else if (u.equals("millisecondspermonth"))
0197: theValue = n / (1000 / (1.0d / 2629743.8));
0198: else if (u.equals("millisecondsperyear"))
0199: theValue = n / (1000 / (1.0d / 31556926));
0200: else if (u.equals("millisecondsperfortnight"))
0201: theValue = n / (1000 / (1.0d / 1209600));
0202: else if (u.equals("kilosecondspersecond"))
0203: theValue = n / ((1.0d / 1000) / 1.0d);
0204: else if (u.equals("kilosecondsperminute"))
0205: theValue = n / ((1.0d / 1000) / (1.0d / 60));
0206: else if (u.equals("kilosecondsperhour"))
0207: theValue = n / ((1.0d / 1000) / (1.0d / 3600));
0208: else if (u.equals("kilosecondsperday"))
0209: theValue = n / ((1.0d / 1000) / (1.0d / 86400));
0210: else if (u.equals("kilosecondsperweek"))
0211: theValue = n / ((1.0d / 1000) / (1.0d / 604800));
0212: else if (u.equals("kilosecondspermillisecond"))
0213: theValue = n / ((1.0d / 1000) / 1000);
0214: else if (u.equals("kilosecondsperkilosecond"))
0215: theValue = n / ((1.0d / 1000) / (1.0d / 1000));
0216: else if (u.equals("kilosecondspermonth"))
0217: theValue = n / ((1.0d / 1000) / (1.0d / 2629743.8));
0218: else if (u.equals("kilosecondsperyear"))
0219: theValue = n / ((1.0d / 1000) / (1.0d / 31556926));
0220: else if (u.equals("kilosecondsperfortnight"))
0221: theValue = n / ((1.0d / 1000) / (1.0d / 1209600));
0222: else if (u.equals("monthspersecond"))
0223: theValue = n / ((1.0d / 2629743.8) / 1.0d);
0224: else if (u.equals("monthsperminute"))
0225: theValue = n / ((1.0d / 2629743.8) / (1.0d / 60));
0226: else if (u.equals("monthsperhour"))
0227: theValue = n / ((1.0d / 2629743.8) / (1.0d / 3600));
0228: else if (u.equals("monthsperday"))
0229: theValue = n / ((1.0d / 2629743.8) / (1.0d / 86400));
0230: else if (u.equals("monthsperweek"))
0231: theValue = n / ((1.0d / 2629743.8) / (1.0d / 604800));
0232: else if (u.equals("monthspermillisecond"))
0233: theValue = n / ((1.0d / 2629743.8) / 1000);
0234: else if (u.equals("monthsperkilosecond"))
0235: theValue = n / ((1.0d / 2629743.8) / (1.0d / 1000));
0236: else if (u.equals("monthspermonth"))
0237: theValue = n / ((1.0d / 2629743.8) / (1.0d / 2629743.8));
0238: else if (u.equals("monthsperyear"))
0239: theValue = n / ((1.0d / 2629743.8) / (1.0d / 31556926));
0240: else if (u.equals("monthsperfortnight"))
0241: theValue = n / ((1.0d / 2629743.8) / (1.0d / 1209600));
0242: else if (u.equals("yearspersecond"))
0243: theValue = n / ((1.0d / 31556926) / 1.0d);
0244: else if (u.equals("yearsperminute"))
0245: theValue = n / ((1.0d / 31556926) / (1.0d / 60));
0246: else if (u.equals("yearsperhour"))
0247: theValue = n / ((1.0d / 31556926) / (1.0d / 3600));
0248: else if (u.equals("yearsperday"))
0249: theValue = n / ((1.0d / 31556926) / (1.0d / 86400));
0250: else if (u.equals("yearsperweek"))
0251: theValue = n / ((1.0d / 31556926) / (1.0d / 604800));
0252: else if (u.equals("yearspermillisecond"))
0253: theValue = n / ((1.0d / 31556926) / 1000);
0254: else if (u.equals("yearsperkilosecond"))
0255: theValue = n / ((1.0d / 31556926) / (1.0d / 1000));
0256: else if (u.equals("yearspermonth"))
0257: theValue = n / ((1.0d / 31556926) / (1.0d / 2629743.8));
0258: else if (u.equals("yearsperyear"))
0259: theValue = n / ((1.0d / 31556926) / (1.0d / 31556926));
0260: else if (u.equals("yearsperfortnight"))
0261: theValue = n / ((1.0d / 31556926) / (1.0d / 1209600));
0262: else if (u.equals("fortnightspersecond"))
0263: theValue = n / ((1.0d / 1209600) / 1.0d);
0264: else if (u.equals("fortnightsperminute"))
0265: theValue = n / ((1.0d / 1209600) / (1.0d / 60));
0266: else if (u.equals("fortnightsperhour"))
0267: theValue = n / ((1.0d / 1209600) / (1.0d / 3600));
0268: else if (u.equals("fortnightsperday"))
0269: theValue = n / ((1.0d / 1209600) / (1.0d / 86400));
0270: else if (u.equals("fortnightsperweek"))
0271: theValue = n / ((1.0d / 1209600) / (1.0d / 604800));
0272: else if (u.equals("fortnightspermillisecond"))
0273: theValue = n / ((1.0d / 1209600) / 1000);
0274: else if (u.equals("fortnightsperkilosecond"))
0275: theValue = n / ((1.0d / 1209600) / (1.0d / 1000));
0276: else if (u.equals("fortnightspermonth"))
0277: theValue = n / ((1.0d / 1209600) / (1.0d / 2629743.8));
0278: else if (u.equals("fortnightsperyear"))
0279: theValue = n / ((1.0d / 1209600) / (1.0d / 31556926));
0280: else if (u.equals("fortnightsperfortnight"))
0281: theValue = n / ((1.0d / 1209600) / (1.0d / 1209600));
0282: else
0283: throw new UnknownUnitException();
0284: }
0285:
0286: // TypeNamed factory methods
0287: public static final TimeRate newSecondsPerSecond(double v) {
0288: return new TimeRate(v * (1.0d / (1.0d / 1.0d)));
0289: }
0290:
0291: public static final TimeRate newSecondsPerSecond(String s) {
0292: return new TimeRate((Double.valueOf(s).doubleValue())
0293: * (1.0d / (1.0d / 1.0d)));
0294: }
0295:
0296: public static final TimeRate newSecondsPerMinute(double v) {
0297: return new TimeRate(v * (1.0d / (1.0d / (1.0d / 60))));
0298: }
0299:
0300: public static final TimeRate newSecondsPerMinute(String s) {
0301: return new TimeRate((Double.valueOf(s).doubleValue())
0302: * (1.0d / (1.0d / (1.0d / 60))));
0303: }
0304:
0305: public static final TimeRate newSecondsPerHour(double v) {
0306: return new TimeRate(v * (1.0d / (1.0d / (1.0d / 3600))));
0307: }
0308:
0309: public static final TimeRate newSecondsPerHour(String s) {
0310: return new TimeRate((Double.valueOf(s).doubleValue())
0311: * (1.0d / (1.0d / (1.0d / 3600))));
0312: }
0313:
0314: public static final TimeRate newSecondsPerDay(double v) {
0315: return new TimeRate(v * (1.0d / (1.0d / (1.0d / 86400))));
0316: }
0317:
0318: public static final TimeRate newSecondsPerDay(String s) {
0319: return new TimeRate((Double.valueOf(s).doubleValue())
0320: * (1.0d / (1.0d / (1.0d / 86400))));
0321: }
0322:
0323: public static final TimeRate newSecondsPerWeek(double v) {
0324: return new TimeRate(v * (1.0d / (1.0d / (1.0d / 604800))));
0325: }
0326:
0327: public static final TimeRate newSecondsPerWeek(String s) {
0328: return new TimeRate((Double.valueOf(s).doubleValue())
0329: * (1.0d / (1.0d / (1.0d / 604800))));
0330: }
0331:
0332: public static final TimeRate newSecondsPerMillisecond(double v) {
0333: return new TimeRate(v * (1.0d / (1.0d / 1000)));
0334: }
0335:
0336: public static final TimeRate newSecondsPerMillisecond(String s) {
0337: return new TimeRate((Double.valueOf(s).doubleValue())
0338: * (1.0d / (1.0d / 1000)));
0339: }
0340:
0341: public static final TimeRate newSecondsPerKilosecond(double v) {
0342: return new TimeRate(v * (1.0d / (1.0d / (1.0d / 1000))));
0343: }
0344:
0345: public static final TimeRate newSecondsPerKilosecond(String s) {
0346: return new TimeRate((Double.valueOf(s).doubleValue())
0347: * (1.0d / (1.0d / (1.0d / 1000))));
0348: }
0349:
0350: public static final TimeRate newSecondsPerMonth(double v) {
0351: return new TimeRate(v * (1.0d / (1.0d / (1.0d / 2629743.8))));
0352: }
0353:
0354: public static final TimeRate newSecondsPerMonth(String s) {
0355: return new TimeRate((Double.valueOf(s).doubleValue())
0356: * (1.0d / (1.0d / (1.0d / 2629743.8))));
0357: }
0358:
0359: public static final TimeRate newSecondsPerYear(double v) {
0360: return new TimeRate(v * (1.0d / (1.0d / (1.0d / 31556926))));
0361: }
0362:
0363: public static final TimeRate newSecondsPerYear(String s) {
0364: return new TimeRate((Double.valueOf(s).doubleValue())
0365: * (1.0d / (1.0d / (1.0d / 31556926))));
0366: }
0367:
0368: public static final TimeRate newSecondsPerFortnight(double v) {
0369: return new TimeRate(v * (1.0d / (1.0d / (1.0d / 1209600))));
0370: }
0371:
0372: public static final TimeRate newSecondsPerFortnight(String s) {
0373: return new TimeRate((Double.valueOf(s).doubleValue())
0374: * (1.0d / (1.0d / (1.0d / 1209600))));
0375: }
0376:
0377: public static final TimeRate newMinutesPerSecond(double v) {
0378: return new TimeRate(v * (1.0d / ((1.0d / 60) / 1.0d)));
0379: }
0380:
0381: public static final TimeRate newMinutesPerSecond(String s) {
0382: return new TimeRate((Double.valueOf(s).doubleValue())
0383: * (1.0d / ((1.0d / 60) / 1.0d)));
0384: }
0385:
0386: public static final TimeRate newMinutesPerMinute(double v) {
0387: return new TimeRate(v * (1.0d / ((1.0d / 60) / (1.0d / 60))));
0388: }
0389:
0390: public static final TimeRate newMinutesPerMinute(String s) {
0391: return new TimeRate((Double.valueOf(s).doubleValue())
0392: * (1.0d / ((1.0d / 60) / (1.0d / 60))));
0393: }
0394:
0395: public static final TimeRate newMinutesPerHour(double v) {
0396: return new TimeRate(v * (1.0d / ((1.0d / 60) / (1.0d / 3600))));
0397: }
0398:
0399: public static final TimeRate newMinutesPerHour(String s) {
0400: return new TimeRate((Double.valueOf(s).doubleValue())
0401: * (1.0d / ((1.0d / 60) / (1.0d / 3600))));
0402: }
0403:
0404: public static final TimeRate newMinutesPerDay(double v) {
0405: return new TimeRate(v * (1.0d / ((1.0d / 60) / (1.0d / 86400))));
0406: }
0407:
0408: public static final TimeRate newMinutesPerDay(String s) {
0409: return new TimeRate((Double.valueOf(s).doubleValue())
0410: * (1.0d / ((1.0d / 60) / (1.0d / 86400))));
0411: }
0412:
0413: public static final TimeRate newMinutesPerWeek(double v) {
0414: return new TimeRate(v
0415: * (1.0d / ((1.0d / 60) / (1.0d / 604800))));
0416: }
0417:
0418: public static final TimeRate newMinutesPerWeek(String s) {
0419: return new TimeRate((Double.valueOf(s).doubleValue())
0420: * (1.0d / ((1.0d / 60) / (1.0d / 604800))));
0421: }
0422:
0423: public static final TimeRate newMinutesPerMillisecond(double v) {
0424: return new TimeRate(v * (1.0d / ((1.0d / 60) / 1000)));
0425: }
0426:
0427: public static final TimeRate newMinutesPerMillisecond(String s) {
0428: return new TimeRate((Double.valueOf(s).doubleValue())
0429: * (1.0d / ((1.0d / 60) / 1000)));
0430: }
0431:
0432: public static final TimeRate newMinutesPerKilosecond(double v) {
0433: return new TimeRate(v * (1.0d / ((1.0d / 60) / (1.0d / 1000))));
0434: }
0435:
0436: public static final TimeRate newMinutesPerKilosecond(String s) {
0437: return new TimeRate((Double.valueOf(s).doubleValue())
0438: * (1.0d / ((1.0d / 60) / (1.0d / 1000))));
0439: }
0440:
0441: public static final TimeRate newMinutesPerMonth(double v) {
0442: return new TimeRate(v
0443: * (1.0d / ((1.0d / 60) / (1.0d / 2629743.8))));
0444: }
0445:
0446: public static final TimeRate newMinutesPerMonth(String s) {
0447: return new TimeRate((Double.valueOf(s).doubleValue())
0448: * (1.0d / ((1.0d / 60) / (1.0d / 2629743.8))));
0449: }
0450:
0451: public static final TimeRate newMinutesPerYear(double v) {
0452: return new TimeRate(v
0453: * (1.0d / ((1.0d / 60) / (1.0d / 31556926))));
0454: }
0455:
0456: public static final TimeRate newMinutesPerYear(String s) {
0457: return new TimeRate((Double.valueOf(s).doubleValue())
0458: * (1.0d / ((1.0d / 60) / (1.0d / 31556926))));
0459: }
0460:
0461: public static final TimeRate newMinutesPerFortnight(double v) {
0462: return new TimeRate(v
0463: * (1.0d / ((1.0d / 60) / (1.0d / 1209600))));
0464: }
0465:
0466: public static final TimeRate newMinutesPerFortnight(String s) {
0467: return new TimeRate((Double.valueOf(s).doubleValue())
0468: * (1.0d / ((1.0d / 60) / (1.0d / 1209600))));
0469: }
0470:
0471: public static final TimeRate newHoursPerSecond(double v) {
0472: return new TimeRate(v * (1.0d / ((1.0d / 3600) / 1.0d)));
0473: }
0474:
0475: public static final TimeRate newHoursPerSecond(String s) {
0476: return new TimeRate((Double.valueOf(s).doubleValue())
0477: * (1.0d / ((1.0d / 3600) / 1.0d)));
0478: }
0479:
0480: public static final TimeRate newHoursPerMinute(double v) {
0481: return new TimeRate(v * (1.0d / ((1.0d / 3600) / (1.0d / 60))));
0482: }
0483:
0484: public static final TimeRate newHoursPerMinute(String s) {
0485: return new TimeRate((Double.valueOf(s).doubleValue())
0486: * (1.0d / ((1.0d / 3600) / (1.0d / 60))));
0487: }
0488:
0489: public static final TimeRate newHoursPerHour(double v) {
0490: return new TimeRate(v
0491: * (1.0d / ((1.0d / 3600) / (1.0d / 3600))));
0492: }
0493:
0494: public static final TimeRate newHoursPerHour(String s) {
0495: return new TimeRate((Double.valueOf(s).doubleValue())
0496: * (1.0d / ((1.0d / 3600) / (1.0d / 3600))));
0497: }
0498:
0499: public static final TimeRate newHoursPerDay(double v) {
0500: return new TimeRate(v
0501: * (1.0d / ((1.0d / 3600) / (1.0d / 86400))));
0502: }
0503:
0504: public static final TimeRate newHoursPerDay(String s) {
0505: return new TimeRate((Double.valueOf(s).doubleValue())
0506: * (1.0d / ((1.0d / 3600) / (1.0d / 86400))));
0507: }
0508:
0509: public static final TimeRate newHoursPerWeek(double v) {
0510: return new TimeRate(v
0511: * (1.0d / ((1.0d / 3600) / (1.0d / 604800))));
0512: }
0513:
0514: public static final TimeRate newHoursPerWeek(String s) {
0515: return new TimeRate((Double.valueOf(s).doubleValue())
0516: * (1.0d / ((1.0d / 3600) / (1.0d / 604800))));
0517: }
0518:
0519: public static final TimeRate newHoursPerMillisecond(double v) {
0520: return new TimeRate(v * (1.0d / ((1.0d / 3600) / 1000)));
0521: }
0522:
0523: public static final TimeRate newHoursPerMillisecond(String s) {
0524: return new TimeRate((Double.valueOf(s).doubleValue())
0525: * (1.0d / ((1.0d / 3600) / 1000)));
0526: }
0527:
0528: public static final TimeRate newHoursPerKilosecond(double v) {
0529: return new TimeRate(v
0530: * (1.0d / ((1.0d / 3600) / (1.0d / 1000))));
0531: }
0532:
0533: public static final TimeRate newHoursPerKilosecond(String s) {
0534: return new TimeRate((Double.valueOf(s).doubleValue())
0535: * (1.0d / ((1.0d / 3600) / (1.0d / 1000))));
0536: }
0537:
0538: public static final TimeRate newHoursPerMonth(double v) {
0539: return new TimeRate(v
0540: * (1.0d / ((1.0d / 3600) / (1.0d / 2629743.8))));
0541: }
0542:
0543: public static final TimeRate newHoursPerMonth(String s) {
0544: return new TimeRate((Double.valueOf(s).doubleValue())
0545: * (1.0d / ((1.0d / 3600) / (1.0d / 2629743.8))));
0546: }
0547:
0548: public static final TimeRate newHoursPerYear(double v) {
0549: return new TimeRate(v
0550: * (1.0d / ((1.0d / 3600) / (1.0d / 31556926))));
0551: }
0552:
0553: public static final TimeRate newHoursPerYear(String s) {
0554: return new TimeRate((Double.valueOf(s).doubleValue())
0555: * (1.0d / ((1.0d / 3600) / (1.0d / 31556926))));
0556: }
0557:
0558: public static final TimeRate newHoursPerFortnight(double v) {
0559: return new TimeRate(v
0560: * (1.0d / ((1.0d / 3600) / (1.0d / 1209600))));
0561: }
0562:
0563: public static final TimeRate newHoursPerFortnight(String s) {
0564: return new TimeRate((Double.valueOf(s).doubleValue())
0565: * (1.0d / ((1.0d / 3600) / (1.0d / 1209600))));
0566: }
0567:
0568: public static final TimeRate newDaysPerSecond(double v) {
0569: return new TimeRate(v * (1.0d / ((1.0d / 86400) / 1.0d)));
0570: }
0571:
0572: public static final TimeRate newDaysPerSecond(String s) {
0573: return new TimeRate((Double.valueOf(s).doubleValue())
0574: * (1.0d / ((1.0d / 86400) / 1.0d)));
0575: }
0576:
0577: public static final TimeRate newDaysPerMinute(double v) {
0578: return new TimeRate(v * (1.0d / ((1.0d / 86400) / (1.0d / 60))));
0579: }
0580:
0581: public static final TimeRate newDaysPerMinute(String s) {
0582: return new TimeRate((Double.valueOf(s).doubleValue())
0583: * (1.0d / ((1.0d / 86400) / (1.0d / 60))));
0584: }
0585:
0586: public static final TimeRate newDaysPerHour(double v) {
0587: return new TimeRate(v
0588: * (1.0d / ((1.0d / 86400) / (1.0d / 3600))));
0589: }
0590:
0591: public static final TimeRate newDaysPerHour(String s) {
0592: return new TimeRate((Double.valueOf(s).doubleValue())
0593: * (1.0d / ((1.0d / 86400) / (1.0d / 3600))));
0594: }
0595:
0596: public static final TimeRate newDaysPerDay(double v) {
0597: return new TimeRate(v
0598: * (1.0d / ((1.0d / 86400) / (1.0d / 86400))));
0599: }
0600:
0601: public static final TimeRate newDaysPerDay(String s) {
0602: return new TimeRate((Double.valueOf(s).doubleValue())
0603: * (1.0d / ((1.0d / 86400) / (1.0d / 86400))));
0604: }
0605:
0606: public static final TimeRate newDaysPerWeek(double v) {
0607: return new TimeRate(v
0608: * (1.0d / ((1.0d / 86400) / (1.0d / 604800))));
0609: }
0610:
0611: public static final TimeRate newDaysPerWeek(String s) {
0612: return new TimeRate((Double.valueOf(s).doubleValue())
0613: * (1.0d / ((1.0d / 86400) / (1.0d / 604800))));
0614: }
0615:
0616: public static final TimeRate newDaysPerMillisecond(double v) {
0617: return new TimeRate(v * (1.0d / ((1.0d / 86400) / 1000)));
0618: }
0619:
0620: public static final TimeRate newDaysPerMillisecond(String s) {
0621: return new TimeRate((Double.valueOf(s).doubleValue())
0622: * (1.0d / ((1.0d / 86400) / 1000)));
0623: }
0624:
0625: public static final TimeRate newDaysPerKilosecond(double v) {
0626: return new TimeRate(v
0627: * (1.0d / ((1.0d / 86400) / (1.0d / 1000))));
0628: }
0629:
0630: public static final TimeRate newDaysPerKilosecond(String s) {
0631: return new TimeRate((Double.valueOf(s).doubleValue())
0632: * (1.0d / ((1.0d / 86400) / (1.0d / 1000))));
0633: }
0634:
0635: public static final TimeRate newDaysPerMonth(double v) {
0636: return new TimeRate(v
0637: * (1.0d / ((1.0d / 86400) / (1.0d / 2629743.8))));
0638: }
0639:
0640: public static final TimeRate newDaysPerMonth(String s) {
0641: return new TimeRate((Double.valueOf(s).doubleValue())
0642: * (1.0d / ((1.0d / 86400) / (1.0d / 2629743.8))));
0643: }
0644:
0645: public static final TimeRate newDaysPerYear(double v) {
0646: return new TimeRate(v
0647: * (1.0d / ((1.0d / 86400) / (1.0d / 31556926))));
0648: }
0649:
0650: public static final TimeRate newDaysPerYear(String s) {
0651: return new TimeRate((Double.valueOf(s).doubleValue())
0652: * (1.0d / ((1.0d / 86400) / (1.0d / 31556926))));
0653: }
0654:
0655: public static final TimeRate newDaysPerFortnight(double v) {
0656: return new TimeRate(v
0657: * (1.0d / ((1.0d / 86400) / (1.0d / 1209600))));
0658: }
0659:
0660: public static final TimeRate newDaysPerFortnight(String s) {
0661: return new TimeRate((Double.valueOf(s).doubleValue())
0662: * (1.0d / ((1.0d / 86400) / (1.0d / 1209600))));
0663: }
0664:
0665: public static final TimeRate newWeeksPerSecond(double v) {
0666: return new TimeRate(v * (1.0d / ((1.0d / 604800) / 1.0d)));
0667: }
0668:
0669: public static final TimeRate newWeeksPerSecond(String s) {
0670: return new TimeRate((Double.valueOf(s).doubleValue())
0671: * (1.0d / ((1.0d / 604800) / 1.0d)));
0672: }
0673:
0674: public static final TimeRate newWeeksPerMinute(double v) {
0675: return new TimeRate(v
0676: * (1.0d / ((1.0d / 604800) / (1.0d / 60))));
0677: }
0678:
0679: public static final TimeRate newWeeksPerMinute(String s) {
0680: return new TimeRate((Double.valueOf(s).doubleValue())
0681: * (1.0d / ((1.0d / 604800) / (1.0d / 60))));
0682: }
0683:
0684: public static final TimeRate newWeeksPerHour(double v) {
0685: return new TimeRate(v
0686: * (1.0d / ((1.0d / 604800) / (1.0d / 3600))));
0687: }
0688:
0689: public static final TimeRate newWeeksPerHour(String s) {
0690: return new TimeRate((Double.valueOf(s).doubleValue())
0691: * (1.0d / ((1.0d / 604800) / (1.0d / 3600))));
0692: }
0693:
0694: public static final TimeRate newWeeksPerDay(double v) {
0695: return new TimeRate(v
0696: * (1.0d / ((1.0d / 604800) / (1.0d / 86400))));
0697: }
0698:
0699: public static final TimeRate newWeeksPerDay(String s) {
0700: return new TimeRate((Double.valueOf(s).doubleValue())
0701: * (1.0d / ((1.0d / 604800) / (1.0d / 86400))));
0702: }
0703:
0704: public static final TimeRate newWeeksPerWeek(double v) {
0705: return new TimeRate(v
0706: * (1.0d / ((1.0d / 604800) / (1.0d / 604800))));
0707: }
0708:
0709: public static final TimeRate newWeeksPerWeek(String s) {
0710: return new TimeRate((Double.valueOf(s).doubleValue())
0711: * (1.0d / ((1.0d / 604800) / (1.0d / 604800))));
0712: }
0713:
0714: public static final TimeRate newWeeksPerMillisecond(double v) {
0715: return new TimeRate(v * (1.0d / ((1.0d / 604800) / 1000)));
0716: }
0717:
0718: public static final TimeRate newWeeksPerMillisecond(String s) {
0719: return new TimeRate((Double.valueOf(s).doubleValue())
0720: * (1.0d / ((1.0d / 604800) / 1000)));
0721: }
0722:
0723: public static final TimeRate newWeeksPerKilosecond(double v) {
0724: return new TimeRate(v
0725: * (1.0d / ((1.0d / 604800) / (1.0d / 1000))));
0726: }
0727:
0728: public static final TimeRate newWeeksPerKilosecond(String s) {
0729: return new TimeRate((Double.valueOf(s).doubleValue())
0730: * (1.0d / ((1.0d / 604800) / (1.0d / 1000))));
0731: }
0732:
0733: public static final TimeRate newWeeksPerMonth(double v) {
0734: return new TimeRate(v
0735: * (1.0d / ((1.0d / 604800) / (1.0d / 2629743.8))));
0736: }
0737:
0738: public static final TimeRate newWeeksPerMonth(String s) {
0739: return new TimeRate((Double.valueOf(s).doubleValue())
0740: * (1.0d / ((1.0d / 604800) / (1.0d / 2629743.8))));
0741: }
0742:
0743: public static final TimeRate newWeeksPerYear(double v) {
0744: return new TimeRate(v
0745: * (1.0d / ((1.0d / 604800) / (1.0d / 31556926))));
0746: }
0747:
0748: public static final TimeRate newWeeksPerYear(String s) {
0749: return new TimeRate((Double.valueOf(s).doubleValue())
0750: * (1.0d / ((1.0d / 604800) / (1.0d / 31556926))));
0751: }
0752:
0753: public static final TimeRate newWeeksPerFortnight(double v) {
0754: return new TimeRate(v
0755: * (1.0d / ((1.0d / 604800) / (1.0d / 1209600))));
0756: }
0757:
0758: public static final TimeRate newWeeksPerFortnight(String s) {
0759: return new TimeRate((Double.valueOf(s).doubleValue())
0760: * (1.0d / ((1.0d / 604800) / (1.0d / 1209600))));
0761: }
0762:
0763: public static final TimeRate newMillisecondsPerSecond(double v) {
0764: return new TimeRate(v * (1.0d / (1000 / 1.0d)));
0765: }
0766:
0767: public static final TimeRate newMillisecondsPerSecond(String s) {
0768: return new TimeRate((Double.valueOf(s).doubleValue())
0769: * (1.0d / (1000 / 1.0d)));
0770: }
0771:
0772: public static final TimeRate newMillisecondsPerMinute(double v) {
0773: return new TimeRate(v * (1.0d / (1000 / (1.0d / 60))));
0774: }
0775:
0776: public static final TimeRate newMillisecondsPerMinute(String s) {
0777: return new TimeRate((Double.valueOf(s).doubleValue())
0778: * (1.0d / (1000 / (1.0d / 60))));
0779: }
0780:
0781: public static final TimeRate newMillisecondsPerHour(double v) {
0782: return new TimeRate(v * (1.0d / (1000 / (1.0d / 3600))));
0783: }
0784:
0785: public static final TimeRate newMillisecondsPerHour(String s) {
0786: return new TimeRate((Double.valueOf(s).doubleValue())
0787: * (1.0d / (1000 / (1.0d / 3600))));
0788: }
0789:
0790: public static final TimeRate newMillisecondsPerDay(double v) {
0791: return new TimeRate(v * (1.0d / (1000 / (1.0d / 86400))));
0792: }
0793:
0794: public static final TimeRate newMillisecondsPerDay(String s) {
0795: return new TimeRate((Double.valueOf(s).doubleValue())
0796: * (1.0d / (1000 / (1.0d / 86400))));
0797: }
0798:
0799: public static final TimeRate newMillisecondsPerWeek(double v) {
0800: return new TimeRate(v * (1.0d / (1000 / (1.0d / 604800))));
0801: }
0802:
0803: public static final TimeRate newMillisecondsPerWeek(String s) {
0804: return new TimeRate((Double.valueOf(s).doubleValue())
0805: * (1.0d / (1000 / (1.0d / 604800))));
0806: }
0807:
0808: public static final TimeRate newMillisecondsPerMillisecond(double v) {
0809: return new TimeRate(v * (1.0d / (1000 / 1000)));
0810: }
0811:
0812: public static final TimeRate newMillisecondsPerMillisecond(String s) {
0813: return new TimeRate((Double.valueOf(s).doubleValue())
0814: * (1.0d / (1000 / 1000)));
0815: }
0816:
0817: public static final TimeRate newMillisecondsPerKilosecond(double v) {
0818: return new TimeRate(v * (1.0d / (1000 / (1.0d / 1000))));
0819: }
0820:
0821: public static final TimeRate newMillisecondsPerKilosecond(String s) {
0822: return new TimeRate((Double.valueOf(s).doubleValue())
0823: * (1.0d / (1000 / (1.0d / 1000))));
0824: }
0825:
0826: public static final TimeRate newMillisecondsPerMonth(double v) {
0827: return new TimeRate(v * (1.0d / (1000 / (1.0d / 2629743.8))));
0828: }
0829:
0830: public static final TimeRate newMillisecondsPerMonth(String s) {
0831: return new TimeRate((Double.valueOf(s).doubleValue())
0832: * (1.0d / (1000 / (1.0d / 2629743.8))));
0833: }
0834:
0835: public static final TimeRate newMillisecondsPerYear(double v) {
0836: return new TimeRate(v * (1.0d / (1000 / (1.0d / 31556926))));
0837: }
0838:
0839: public static final TimeRate newMillisecondsPerYear(String s) {
0840: return new TimeRate((Double.valueOf(s).doubleValue())
0841: * (1.0d / (1000 / (1.0d / 31556926))));
0842: }
0843:
0844: public static final TimeRate newMillisecondsPerFortnight(double v) {
0845: return new TimeRate(v * (1.0d / (1000 / (1.0d / 1209600))));
0846: }
0847:
0848: public static final TimeRate newMillisecondsPerFortnight(String s) {
0849: return new TimeRate((Double.valueOf(s).doubleValue())
0850: * (1.0d / (1000 / (1.0d / 1209600))));
0851: }
0852:
0853: public static final TimeRate newKilosecondsPerSecond(double v) {
0854: return new TimeRate(v * (1.0d / ((1.0d / 1000) / 1.0d)));
0855: }
0856:
0857: public static final TimeRate newKilosecondsPerSecond(String s) {
0858: return new TimeRate((Double.valueOf(s).doubleValue())
0859: * (1.0d / ((1.0d / 1000) / 1.0d)));
0860: }
0861:
0862: public static final TimeRate newKilosecondsPerMinute(double v) {
0863: return new TimeRate(v * (1.0d / ((1.0d / 1000) / (1.0d / 60))));
0864: }
0865:
0866: public static final TimeRate newKilosecondsPerMinute(String s) {
0867: return new TimeRate((Double.valueOf(s).doubleValue())
0868: * (1.0d / ((1.0d / 1000) / (1.0d / 60))));
0869: }
0870:
0871: public static final TimeRate newKilosecondsPerHour(double v) {
0872: return new TimeRate(v
0873: * (1.0d / ((1.0d / 1000) / (1.0d / 3600))));
0874: }
0875:
0876: public static final TimeRate newKilosecondsPerHour(String s) {
0877: return new TimeRate((Double.valueOf(s).doubleValue())
0878: * (1.0d / ((1.0d / 1000) / (1.0d / 3600))));
0879: }
0880:
0881: public static final TimeRate newKilosecondsPerDay(double v) {
0882: return new TimeRate(v
0883: * (1.0d / ((1.0d / 1000) / (1.0d / 86400))));
0884: }
0885:
0886: public static final TimeRate newKilosecondsPerDay(String s) {
0887: return new TimeRate((Double.valueOf(s).doubleValue())
0888: * (1.0d / ((1.0d / 1000) / (1.0d / 86400))));
0889: }
0890:
0891: public static final TimeRate newKilosecondsPerWeek(double v) {
0892: return new TimeRate(v
0893: * (1.0d / ((1.0d / 1000) / (1.0d / 604800))));
0894: }
0895:
0896: public static final TimeRate newKilosecondsPerWeek(String s) {
0897: return new TimeRate((Double.valueOf(s).doubleValue())
0898: * (1.0d / ((1.0d / 1000) / (1.0d / 604800))));
0899: }
0900:
0901: public static final TimeRate newKilosecondsPerMillisecond(double v) {
0902: return new TimeRate(v * (1.0d / ((1.0d / 1000) / 1000)));
0903: }
0904:
0905: public static final TimeRate newKilosecondsPerMillisecond(String s) {
0906: return new TimeRate((Double.valueOf(s).doubleValue())
0907: * (1.0d / ((1.0d / 1000) / 1000)));
0908: }
0909:
0910: public static final TimeRate newKilosecondsPerKilosecond(double v) {
0911: return new TimeRate(v
0912: * (1.0d / ((1.0d / 1000) / (1.0d / 1000))));
0913: }
0914:
0915: public static final TimeRate newKilosecondsPerKilosecond(String s) {
0916: return new TimeRate((Double.valueOf(s).doubleValue())
0917: * (1.0d / ((1.0d / 1000) / (1.0d / 1000))));
0918: }
0919:
0920: public static final TimeRate newKilosecondsPerMonth(double v) {
0921: return new TimeRate(v
0922: * (1.0d / ((1.0d / 1000) / (1.0d / 2629743.8))));
0923: }
0924:
0925: public static final TimeRate newKilosecondsPerMonth(String s) {
0926: return new TimeRate((Double.valueOf(s).doubleValue())
0927: * (1.0d / ((1.0d / 1000) / (1.0d / 2629743.8))));
0928: }
0929:
0930: public static final TimeRate newKilosecondsPerYear(double v) {
0931: return new TimeRate(v
0932: * (1.0d / ((1.0d / 1000) / (1.0d / 31556926))));
0933: }
0934:
0935: public static final TimeRate newKilosecondsPerYear(String s) {
0936: return new TimeRate((Double.valueOf(s).doubleValue())
0937: * (1.0d / ((1.0d / 1000) / (1.0d / 31556926))));
0938: }
0939:
0940: public static final TimeRate newKilosecondsPerFortnight(double v) {
0941: return new TimeRate(v
0942: * (1.0d / ((1.0d / 1000) / (1.0d / 1209600))));
0943: }
0944:
0945: public static final TimeRate newKilosecondsPerFortnight(String s) {
0946: return new TimeRate((Double.valueOf(s).doubleValue())
0947: * (1.0d / ((1.0d / 1000) / (1.0d / 1209600))));
0948: }
0949:
0950: public static final TimeRate newMonthsPerSecond(double v) {
0951: return new TimeRate(v * (1.0d / ((1.0d / 2629743.8) / 1.0d)));
0952: }
0953:
0954: public static final TimeRate newMonthsPerSecond(String s) {
0955: return new TimeRate((Double.valueOf(s).doubleValue())
0956: * (1.0d / ((1.0d / 2629743.8) / 1.0d)));
0957: }
0958:
0959: public static final TimeRate newMonthsPerMinute(double v) {
0960: return new TimeRate(v
0961: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 60))));
0962: }
0963:
0964: public static final TimeRate newMonthsPerMinute(String s) {
0965: return new TimeRate((Double.valueOf(s).doubleValue())
0966: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 60))));
0967: }
0968:
0969: public static final TimeRate newMonthsPerHour(double v) {
0970: return new TimeRate(v
0971: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 3600))));
0972: }
0973:
0974: public static final TimeRate newMonthsPerHour(String s) {
0975: return new TimeRate((Double.valueOf(s).doubleValue())
0976: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 3600))));
0977: }
0978:
0979: public static final TimeRate newMonthsPerDay(double v) {
0980: return new TimeRate(v
0981: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 86400))));
0982: }
0983:
0984: public static final TimeRate newMonthsPerDay(String s) {
0985: return new TimeRate((Double.valueOf(s).doubleValue())
0986: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 86400))));
0987: }
0988:
0989: public static final TimeRate newMonthsPerWeek(double v) {
0990: return new TimeRate(v
0991: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 604800))));
0992: }
0993:
0994: public static final TimeRate newMonthsPerWeek(String s) {
0995: return new TimeRate((Double.valueOf(s).doubleValue())
0996: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 604800))));
0997: }
0998:
0999: public static final TimeRate newMonthsPerMillisecond(double v) {
1000: return new TimeRate(v * (1.0d / ((1.0d / 2629743.8) / 1000)));
1001: }
1002:
1003: public static final TimeRate newMonthsPerMillisecond(String s) {
1004: return new TimeRate((Double.valueOf(s).doubleValue())
1005: * (1.0d / ((1.0d / 2629743.8) / 1000)));
1006: }
1007:
1008: public static final TimeRate newMonthsPerKilosecond(double v) {
1009: return new TimeRate(v
1010: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 1000))));
1011: }
1012:
1013: public static final TimeRate newMonthsPerKilosecond(String s) {
1014: return new TimeRate((Double.valueOf(s).doubleValue())
1015: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 1000))));
1016: }
1017:
1018: public static final TimeRate newMonthsPerMonth(double v) {
1019: return new TimeRate(v
1020: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 2629743.8))));
1021: }
1022:
1023: public static final TimeRate newMonthsPerMonth(String s) {
1024: return new TimeRate((Double.valueOf(s).doubleValue())
1025: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 2629743.8))));
1026: }
1027:
1028: public static final TimeRate newMonthsPerYear(double v) {
1029: return new TimeRate(v
1030: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 31556926))));
1031: }
1032:
1033: public static final TimeRate newMonthsPerYear(String s) {
1034: return new TimeRate((Double.valueOf(s).doubleValue())
1035: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 31556926))));
1036: }
1037:
1038: public static final TimeRate newMonthsPerFortnight(double v) {
1039: return new TimeRate(v
1040: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 1209600))));
1041: }
1042:
1043: public static final TimeRate newMonthsPerFortnight(String s) {
1044: return new TimeRate((Double.valueOf(s).doubleValue())
1045: * (1.0d / ((1.0d / 2629743.8) / (1.0d / 1209600))));
1046: }
1047:
1048: public static final TimeRate newYearsPerSecond(double v) {
1049: return new TimeRate(v * (1.0d / ((1.0d / 31556926) / 1.0d)));
1050: }
1051:
1052: public static final TimeRate newYearsPerSecond(String s) {
1053: return new TimeRate((Double.valueOf(s).doubleValue())
1054: * (1.0d / ((1.0d / 31556926) / 1.0d)));
1055: }
1056:
1057: public static final TimeRate newYearsPerMinute(double v) {
1058: return new TimeRate(v
1059: * (1.0d / ((1.0d / 31556926) / (1.0d / 60))));
1060: }
1061:
1062: public static final TimeRate newYearsPerMinute(String s) {
1063: return new TimeRate((Double.valueOf(s).doubleValue())
1064: * (1.0d / ((1.0d / 31556926) / (1.0d / 60))));
1065: }
1066:
1067: public static final TimeRate newYearsPerHour(double v) {
1068: return new TimeRate(v
1069: * (1.0d / ((1.0d / 31556926) / (1.0d / 3600))));
1070: }
1071:
1072: public static final TimeRate newYearsPerHour(String s) {
1073: return new TimeRate((Double.valueOf(s).doubleValue())
1074: * (1.0d / ((1.0d / 31556926) / (1.0d / 3600))));
1075: }
1076:
1077: public static final TimeRate newYearsPerDay(double v) {
1078: return new TimeRate(v
1079: * (1.0d / ((1.0d / 31556926) / (1.0d / 86400))));
1080: }
1081:
1082: public static final TimeRate newYearsPerDay(String s) {
1083: return new TimeRate((Double.valueOf(s).doubleValue())
1084: * (1.0d / ((1.0d / 31556926) / (1.0d / 86400))));
1085: }
1086:
1087: public static final TimeRate newYearsPerWeek(double v) {
1088: return new TimeRate(v
1089: * (1.0d / ((1.0d / 31556926) / (1.0d / 604800))));
1090: }
1091:
1092: public static final TimeRate newYearsPerWeek(String s) {
1093: return new TimeRate((Double.valueOf(s).doubleValue())
1094: * (1.0d / ((1.0d / 31556926) / (1.0d / 604800))));
1095: }
1096:
1097: public static final TimeRate newYearsPerMillisecond(double v) {
1098: return new TimeRate(v * (1.0d / ((1.0d / 31556926) / 1000)));
1099: }
1100:
1101: public static final TimeRate newYearsPerMillisecond(String s) {
1102: return new TimeRate((Double.valueOf(s).doubleValue())
1103: * (1.0d / ((1.0d / 31556926) / 1000)));
1104: }
1105:
1106: public static final TimeRate newYearsPerKilosecond(double v) {
1107: return new TimeRate(v
1108: * (1.0d / ((1.0d / 31556926) / (1.0d / 1000))));
1109: }
1110:
1111: public static final TimeRate newYearsPerKilosecond(String s) {
1112: return new TimeRate((Double.valueOf(s).doubleValue())
1113: * (1.0d / ((1.0d / 31556926) / (1.0d / 1000))));
1114: }
1115:
1116: public static final TimeRate newYearsPerMonth(double v) {
1117: return new TimeRate(v
1118: * (1.0d / ((1.0d / 31556926) / (1.0d / 2629743.8))));
1119: }
1120:
1121: public static final TimeRate newYearsPerMonth(String s) {
1122: return new TimeRate((Double.valueOf(s).doubleValue())
1123: * (1.0d / ((1.0d / 31556926) / (1.0d / 2629743.8))));
1124: }
1125:
1126: public static final TimeRate newYearsPerYear(double v) {
1127: return new TimeRate(v
1128: * (1.0d / ((1.0d / 31556926) / (1.0d / 31556926))));
1129: }
1130:
1131: public static final TimeRate newYearsPerYear(String s) {
1132: return new TimeRate((Double.valueOf(s).doubleValue())
1133: * (1.0d / ((1.0d / 31556926) / (1.0d / 31556926))));
1134: }
1135:
1136: public static final TimeRate newYearsPerFortnight(double v) {
1137: return new TimeRate(v
1138: * (1.0d / ((1.0d / 31556926) / (1.0d / 1209600))));
1139: }
1140:
1141: public static final TimeRate newYearsPerFortnight(String s) {
1142: return new TimeRate((Double.valueOf(s).doubleValue())
1143: * (1.0d / ((1.0d / 31556926) / (1.0d / 1209600))));
1144: }
1145:
1146: public static final TimeRate newFortnightsPerSecond(double v) {
1147: return new TimeRate(v * (1.0d / ((1.0d / 1209600) / 1.0d)));
1148: }
1149:
1150: public static final TimeRate newFortnightsPerSecond(String s) {
1151: return new TimeRate((Double.valueOf(s).doubleValue())
1152: * (1.0d / ((1.0d / 1209600) / 1.0d)));
1153: }
1154:
1155: public static final TimeRate newFortnightsPerMinute(double v) {
1156: return new TimeRate(v
1157: * (1.0d / ((1.0d / 1209600) / (1.0d / 60))));
1158: }
1159:
1160: public static final TimeRate newFortnightsPerMinute(String s) {
1161: return new TimeRate((Double.valueOf(s).doubleValue())
1162: * (1.0d / ((1.0d / 1209600) / (1.0d / 60))));
1163: }
1164:
1165: public static final TimeRate newFortnightsPerHour(double v) {
1166: return new TimeRate(v
1167: * (1.0d / ((1.0d / 1209600) / (1.0d / 3600))));
1168: }
1169:
1170: public static final TimeRate newFortnightsPerHour(String s) {
1171: return new TimeRate((Double.valueOf(s).doubleValue())
1172: * (1.0d / ((1.0d / 1209600) / (1.0d / 3600))));
1173: }
1174:
1175: public static final TimeRate newFortnightsPerDay(double v) {
1176: return new TimeRate(v
1177: * (1.0d / ((1.0d / 1209600) / (1.0d / 86400))));
1178: }
1179:
1180: public static final TimeRate newFortnightsPerDay(String s) {
1181: return new TimeRate((Double.valueOf(s).doubleValue())
1182: * (1.0d / ((1.0d / 1209600) / (1.0d / 86400))));
1183: }
1184:
1185: public static final TimeRate newFortnightsPerWeek(double v) {
1186: return new TimeRate(v
1187: * (1.0d / ((1.0d / 1209600) / (1.0d / 604800))));
1188: }
1189:
1190: public static final TimeRate newFortnightsPerWeek(String s) {
1191: return new TimeRate((Double.valueOf(s).doubleValue())
1192: * (1.0d / ((1.0d / 1209600) / (1.0d / 604800))));
1193: }
1194:
1195: public static final TimeRate newFortnightsPerMillisecond(double v) {
1196: return new TimeRate(v * (1.0d / ((1.0d / 1209600) / 1000)));
1197: }
1198:
1199: public static final TimeRate newFortnightsPerMillisecond(String s) {
1200: return new TimeRate((Double.valueOf(s).doubleValue())
1201: * (1.0d / ((1.0d / 1209600) / 1000)));
1202: }
1203:
1204: public static final TimeRate newFortnightsPerKilosecond(double v) {
1205: return new TimeRate(v
1206: * (1.0d / ((1.0d / 1209600) / (1.0d / 1000))));
1207: }
1208:
1209: public static final TimeRate newFortnightsPerKilosecond(String s) {
1210: return new TimeRate((Double.valueOf(s).doubleValue())
1211: * (1.0d / ((1.0d / 1209600) / (1.0d / 1000))));
1212: }
1213:
1214: public static final TimeRate newFortnightsPerMonth(double v) {
1215: return new TimeRate(v
1216: * (1.0d / ((1.0d / 1209600) / (1.0d / 2629743.8))));
1217: }
1218:
1219: public static final TimeRate newFortnightsPerMonth(String s) {
1220: return new TimeRate((Double.valueOf(s).doubleValue())
1221: * (1.0d / ((1.0d / 1209600) / (1.0d / 2629743.8))));
1222: }
1223:
1224: public static final TimeRate newFortnightsPerYear(double v) {
1225: return new TimeRate(v
1226: * (1.0d / ((1.0d / 1209600) / (1.0d / 31556926))));
1227: }
1228:
1229: public static final TimeRate newFortnightsPerYear(String s) {
1230: return new TimeRate((Double.valueOf(s).doubleValue())
1231: * (1.0d / ((1.0d / 1209600) / (1.0d / 31556926))));
1232: }
1233:
1234: public static final TimeRate newFortnightsPerFortnight(double v) {
1235: return new TimeRate(v
1236: * (1.0d / ((1.0d / 1209600) / (1.0d / 1209600))));
1237: }
1238:
1239: public static final TimeRate newFortnightsPerFortnight(String s) {
1240: return new TimeRate((Double.valueOf(s).doubleValue())
1241: * (1.0d / ((1.0d / 1209600) / (1.0d / 1209600))));
1242: }
1243:
1244: public int getCommonUnit() {
1245: return 23;
1246: }
1247:
1248: public int getMaxUnit() {
1249: return MAXUNIT;
1250: }
1251:
1252: // unit names for getUnitName
1253: private static final String unitNames[] = { "seconds/second",
1254: "seconds/minute", "seconds/hour", "seconds/day",
1255: "seconds/week", "seconds/millisecond",
1256: "seconds/kilosecond", "seconds/month", "seconds/year",
1257: "seconds/fortnight", "minutes/second", "minutes/minute",
1258: "minutes/hour", "minutes/day", "minutes/week",
1259: "minutes/millisecond", "minutes/kilosecond",
1260: "minutes/month", "minutes/year", "minutes/fortnight",
1261: "hours/second", "hours/minute", "hours/hour", "hours/day",
1262: "hours/week", "hours/millisecond", "hours/kilosecond",
1263: "hours/month", "hours/year", "hours/fortnight",
1264: "days/second", "days/minute", "days/hour", "days/day",
1265: "days/week", "days/millisecond", "days/kilosecond",
1266: "days/month", "days/year", "days/fortnight",
1267: "weeks/second", "weeks/minute", "weeks/hour", "weeks/day",
1268: "weeks/week", "weeks/millisecond", "weeks/kilosecond",
1269: "weeks/month", "weeks/year", "weeks/fortnight",
1270: "milliseconds/second", "milliseconds/minute",
1271: "milliseconds/hour", "milliseconds/day",
1272: "milliseconds/week", "milliseconds/millisecond",
1273: "milliseconds/kilosecond", "milliseconds/month",
1274: "milliseconds/year", "milliseconds/fortnight",
1275: "kiloseconds/second", "kiloseconds/minute",
1276: "kiloseconds/hour", "kiloseconds/day", "kiloseconds/week",
1277: "kiloseconds/millisecond", "kiloseconds/kilosecond",
1278: "kiloseconds/month", "kiloseconds/year",
1279: "kiloseconds/fortnight", "months/second", "months/minute",
1280: "months/hour", "months/day", "months/week",
1281: "months/millisecond", "months/kilosecond", "months/month",
1282: "months/year", "months/fortnight", "years/second",
1283: "years/minute", "years/hour", "years/day", "years/week",
1284: "years/millisecond", "years/kilosecond", "years/month",
1285: "years/year", "years/fortnight", "fortnights/second",
1286: "fortnights/minute", "fortnights/hour", "fortnights/day",
1287: "fortnights/week", "fortnights/millisecond",
1288: "fortnights/kilosecond", "fortnights/month",
1289: "fortnights/year", "fortnights/fortnight", };
1290:
1291: /** @param unit One of the constant units of TimeRate **/
1292: public final String getUnitName(int unit) {
1293: return unitNames[unit];
1294: }
1295:
1296: // Index Typed factory methods
1297: static final double convFactor[] = { (1.0d / 1.0d),
1298: (1.0d / (1.0d / 60)), (1.0d / (1.0d / 3600)),
1299: (1.0d / (1.0d / 86400)), (1.0d / (1.0d / 604800)),
1300: (1.0d / 1000), (1.0d / (1.0d / 1000)),
1301: (1.0d / (1.0d / 2629743.8)), (1.0d / (1.0d / 31556926)),
1302: (1.0d / (1.0d / 1209600)), ((1.0d / 60) / 1.0d),
1303: ((1.0d / 60) / (1.0d / 60)), ((1.0d / 60) / (1.0d / 3600)),
1304: ((1.0d / 60) / (1.0d / 86400)),
1305: ((1.0d / 60) / (1.0d / 604800)), ((1.0d / 60) / 1000),
1306: ((1.0d / 60) / (1.0d / 1000)),
1307: ((1.0d / 60) / (1.0d / 2629743.8)),
1308: ((1.0d / 60) / (1.0d / 31556926)),
1309: ((1.0d / 60) / (1.0d / 1209600)), ((1.0d / 3600) / 1.0d),
1310: ((1.0d / 3600) / (1.0d / 60)),
1311: ((1.0d / 3600) / (1.0d / 3600)),
1312: ((1.0d / 3600) / (1.0d / 86400)),
1313: ((1.0d / 3600) / (1.0d / 604800)), ((1.0d / 3600) / 1000),
1314: ((1.0d / 3600) / (1.0d / 1000)),
1315: ((1.0d / 3600) / (1.0d / 2629743.8)),
1316: ((1.0d / 3600) / (1.0d / 31556926)),
1317: ((1.0d / 3600) / (1.0d / 1209600)),
1318: ((1.0d / 86400) / 1.0d), ((1.0d / 86400) / (1.0d / 60)),
1319: ((1.0d / 86400) / (1.0d / 3600)),
1320: ((1.0d / 86400) / (1.0d / 86400)),
1321: ((1.0d / 86400) / (1.0d / 604800)),
1322: ((1.0d / 86400) / 1000), ((1.0d / 86400) / (1.0d / 1000)),
1323: ((1.0d / 86400) / (1.0d / 2629743.8)),
1324: ((1.0d / 86400) / (1.0d / 31556926)),
1325: ((1.0d / 86400) / (1.0d / 1209600)),
1326: ((1.0d / 604800) / 1.0d), ((1.0d / 604800) / (1.0d / 60)),
1327: ((1.0d / 604800) / (1.0d / 3600)),
1328: ((1.0d / 604800) / (1.0d / 86400)),
1329: ((1.0d / 604800) / (1.0d / 604800)),
1330: ((1.0d / 604800) / 1000),
1331: ((1.0d / 604800) / (1.0d / 1000)),
1332: ((1.0d / 604800) / (1.0d / 2629743.8)),
1333: ((1.0d / 604800) / (1.0d / 31556926)),
1334: ((1.0d / 604800) / (1.0d / 1209600)), (1000 / 1.0d),
1335: (1000 / (1.0d / 60)), (1000 / (1.0d / 3600)),
1336: (1000 / (1.0d / 86400)), (1000 / (1.0d / 604800)),
1337: (1000 / 1000), (1000 / (1.0d / 1000)),
1338: (1000 / (1.0d / 2629743.8)), (1000 / (1.0d / 31556926)),
1339: (1000 / (1.0d / 1209600)), ((1.0d / 1000) / 1.0d),
1340: ((1.0d / 1000) / (1.0d / 60)),
1341: ((1.0d / 1000) / (1.0d / 3600)),
1342: ((1.0d / 1000) / (1.0d / 86400)),
1343: ((1.0d / 1000) / (1.0d / 604800)), ((1.0d / 1000) / 1000),
1344: ((1.0d / 1000) / (1.0d / 1000)),
1345: ((1.0d / 1000) / (1.0d / 2629743.8)),
1346: ((1.0d / 1000) / (1.0d / 31556926)),
1347: ((1.0d / 1000) / (1.0d / 1209600)),
1348: ((1.0d / 2629743.8) / 1.0d),
1349: ((1.0d / 2629743.8) / (1.0d / 60)),
1350: ((1.0d / 2629743.8) / (1.0d / 3600)),
1351: ((1.0d / 2629743.8) / (1.0d / 86400)),
1352: ((1.0d / 2629743.8) / (1.0d / 604800)),
1353: ((1.0d / 2629743.8) / 1000),
1354: ((1.0d / 2629743.8) / (1.0d / 1000)),
1355: ((1.0d / 2629743.8) / (1.0d / 2629743.8)),
1356: ((1.0d / 2629743.8) / (1.0d / 31556926)),
1357: ((1.0d / 2629743.8) / (1.0d / 1209600)),
1358: ((1.0d / 31556926) / 1.0d),
1359: ((1.0d / 31556926) / (1.0d / 60)),
1360: ((1.0d / 31556926) / (1.0d / 3600)),
1361: ((1.0d / 31556926) / (1.0d / 86400)),
1362: ((1.0d / 31556926) / (1.0d / 604800)),
1363: ((1.0d / 31556926) / 1000),
1364: ((1.0d / 31556926) / (1.0d / 1000)),
1365: ((1.0d / 31556926) / (1.0d / 2629743.8)),
1366: ((1.0d / 31556926) / (1.0d / 31556926)),
1367: ((1.0d / 31556926) / (1.0d / 1209600)),
1368: ((1.0d / 1209600) / 1.0d),
1369: ((1.0d / 1209600) / (1.0d / 60)),
1370: ((1.0d / 1209600) / (1.0d / 3600)),
1371: ((1.0d / 1209600) / (1.0d / 86400)),
1372: ((1.0d / 1209600) / (1.0d / 604800)),
1373: ((1.0d / 1209600) / 1000),
1374: ((1.0d / 1209600) / (1.0d / 1000)),
1375: ((1.0d / 1209600) / (1.0d / 2629743.8)),
1376: ((1.0d / 1209600) / (1.0d / 31556926)),
1377: ((1.0d / 1209600) / (1.0d / 1209600)), };
1378:
1379: public static final double getConvFactor(int i) {
1380: return convFactor[i];
1381: }
1382:
1383: // indexes into factor array
1384: public static final int SECONDS_PER_SECOND = 0;
1385: public static final int SECONDS_PER_MINUTE = 1;
1386: public static final int SECONDS_PER_HOUR = 2;
1387: public static final int SECONDS_PER_DAY = 3;
1388: public static final int SECONDS_PER_WEEK = 4;
1389: public static final int SECONDS_PER_MILLISECOND = 5;
1390: public static final int SECONDS_PER_KILOSECOND = 6;
1391: public static final int SECONDS_PER_MONTH = 7;
1392: public static final int SECONDS_PER_YEAR = 8;
1393: public static final int SECONDS_PER_FORTNIGHT = 9;
1394: public static final int MINUTES_PER_SECOND = 10;
1395: public static final int MINUTES_PER_MINUTE = 11;
1396: public static final int MINUTES_PER_HOUR = 12;
1397: public static final int MINUTES_PER_DAY = 13;
1398: public static final int MINUTES_PER_WEEK = 14;
1399: public static final int MINUTES_PER_MILLISECOND = 15;
1400: public static final int MINUTES_PER_KILOSECOND = 16;
1401: public static final int MINUTES_PER_MONTH = 17;
1402: public static final int MINUTES_PER_YEAR = 18;
1403: public static final int MINUTES_PER_FORTNIGHT = 19;
1404: public static final int HOURS_PER_SECOND = 20;
1405: public static final int HOURS_PER_MINUTE = 21;
1406: public static final int HOURS_PER_HOUR = 22;
1407: public static final int HOURS_PER_DAY = 23;
1408: public static final int HOURS_PER_WEEK = 24;
1409: public static final int HOURS_PER_MILLISECOND = 25;
1410: public static final int HOURS_PER_KILOSECOND = 26;
1411: public static final int HOURS_PER_MONTH = 27;
1412: public static final int HOURS_PER_YEAR = 28;
1413: public static final int HOURS_PER_FORTNIGHT = 29;
1414: public static final int DAYS_PER_SECOND = 30;
1415: public static final int DAYS_PER_MINUTE = 31;
1416: public static final int DAYS_PER_HOUR = 32;
1417: public static final int DAYS_PER_DAY = 33;
1418: public static final int DAYS_PER_WEEK = 34;
1419: public static final int DAYS_PER_MILLISECOND = 35;
1420: public static final int DAYS_PER_KILOSECOND = 36;
1421: public static final int DAYS_PER_MONTH = 37;
1422: public static final int DAYS_PER_YEAR = 38;
1423: public static final int DAYS_PER_FORTNIGHT = 39;
1424: public static final int WEEKS_PER_SECOND = 40;
1425: public static final int WEEKS_PER_MINUTE = 41;
1426: public static final int WEEKS_PER_HOUR = 42;
1427: public static final int WEEKS_PER_DAY = 43;
1428: public static final int WEEKS_PER_WEEK = 44;
1429: public static final int WEEKS_PER_MILLISECOND = 45;
1430: public static final int WEEKS_PER_KILOSECOND = 46;
1431: public static final int WEEKS_PER_MONTH = 47;
1432: public static final int WEEKS_PER_YEAR = 48;
1433: public static final int WEEKS_PER_FORTNIGHT = 49;
1434: public static final int MILLISECONDS_PER_SECOND = 50;
1435: public static final int MILLISECONDS_PER_MINUTE = 51;
1436: public static final int MILLISECONDS_PER_HOUR = 52;
1437: public static final int MILLISECONDS_PER_DAY = 53;
1438: public static final int MILLISECONDS_PER_WEEK = 54;
1439: public static final int MILLISECONDS_PER_MILLISECOND = 55;
1440: public static final int MILLISECONDS_PER_KILOSECOND = 56;
1441: public static final int MILLISECONDS_PER_MONTH = 57;
1442: public static final int MILLISECONDS_PER_YEAR = 58;
1443: public static final int MILLISECONDS_PER_FORTNIGHT = 59;
1444: public static final int KILOSECONDS_PER_SECOND = 60;
1445: public static final int KILOSECONDS_PER_MINUTE = 61;
1446: public static final int KILOSECONDS_PER_HOUR = 62;
1447: public static final int KILOSECONDS_PER_DAY = 63;
1448: public static final int KILOSECONDS_PER_WEEK = 64;
1449: public static final int KILOSECONDS_PER_MILLISECOND = 65;
1450: public static final int KILOSECONDS_PER_KILOSECOND = 66;
1451: public static final int KILOSECONDS_PER_MONTH = 67;
1452: public static final int KILOSECONDS_PER_YEAR = 68;
1453: public static final int KILOSECONDS_PER_FORTNIGHT = 69;
1454: public static final int MONTHS_PER_SECOND = 70;
1455: public static final int MONTHS_PER_MINUTE = 71;
1456: public static final int MONTHS_PER_HOUR = 72;
1457: public static final int MONTHS_PER_DAY = 73;
1458: public static final int MONTHS_PER_WEEK = 74;
1459: public static final int MONTHS_PER_MILLISECOND = 75;
1460: public static final int MONTHS_PER_KILOSECOND = 76;
1461: public static final int MONTHS_PER_MONTH = 77;
1462: public static final int MONTHS_PER_YEAR = 78;
1463: public static final int MONTHS_PER_FORTNIGHT = 79;
1464: public static final int YEARS_PER_SECOND = 80;
1465: public static final int YEARS_PER_MINUTE = 81;
1466: public static final int YEARS_PER_HOUR = 82;
1467: public static final int YEARS_PER_DAY = 83;
1468: public static final int YEARS_PER_WEEK = 84;
1469: public static final int YEARS_PER_MILLISECOND = 85;
1470: public static final int YEARS_PER_KILOSECOND = 86;
1471: public static final int YEARS_PER_MONTH = 87;
1472: public static final int YEARS_PER_YEAR = 88;
1473: public static final int YEARS_PER_FORTNIGHT = 89;
1474: public static final int FORTNIGHTS_PER_SECOND = 90;
1475: public static final int FORTNIGHTS_PER_MINUTE = 91;
1476: public static final int FORTNIGHTS_PER_HOUR = 92;
1477: public static final int FORTNIGHTS_PER_DAY = 93;
1478: public static final int FORTNIGHTS_PER_WEEK = 94;
1479: public static final int FORTNIGHTS_PER_MILLISECOND = 95;
1480: public static final int FORTNIGHTS_PER_KILOSECOND = 96;
1481: public static final int FORTNIGHTS_PER_MONTH = 97;
1482: public static final int FORTNIGHTS_PER_YEAR = 98;
1483: public static final int FORTNIGHTS_PER_FORTNIGHT = 99;
1484: static final int MAXUNIT = 99;
1485:
1486: // Index Typed factory methods
1487: /** @param unit One of the constant units of TimeRate **/
1488: public static final TimeRate newTimeRate(double v, int unit) {
1489: if (unit >= 0 && unit <= MAXUNIT)
1490: return new TimeRate(v * getConvFactor(unit));
1491: else
1492: throw new UnknownUnitException();
1493: }
1494:
1495: /** @param unit One of the constant units of TimeRate **/
1496: public static final TimeRate newTimeRate(String s, int unit) {
1497: if (unit >= 0 && unit <= MAXUNIT)
1498: return new TimeRate((Double.valueOf(s).doubleValue())
1499: * getConvFactor(unit));
1500: else
1501: throw new UnknownUnitException();
1502: }
1503:
1504: // Index Typed factory methods
1505: /** @param unit1 One of the constant units of Duration
1506: * @param unit2 One of the constant units of Duration
1507: **/
1508: public static final TimeRate newTimeRate(double v, int unit1,
1509: int unit2) {
1510: if (unit1 >= 0 && unit1 <= Duration.MAXUNIT && unit2 >= 0
1511: && unit2 <= Duration.MAXUNIT)
1512: return new TimeRate(v * Duration.getConvFactor(unit1)
1513: / Duration.getConvFactor(unit2));
1514: else
1515: throw new UnknownUnitException();
1516: }
1517:
1518: /** @param num An instance of Duration to use as numerator
1519: * @param den An instance of Durationto use as denominator
1520: **/
1521: public static final TimeRate newTimeRate(Duration num, Duration den) {
1522: return new TimeRate(num.getValue(0) / den.getValue(0));
1523: }
1524:
1525: /** @param unit1 One of the constant units of Duration
1526: * @param unit2 One of the constant units of Duration
1527: **/
1528: public static final TimeRate newTimeRate(String s, int unit1,
1529: int unit2) {
1530: if (unit1 >= 0 && unit1 <= Duration.MAXUNIT && unit2 >= 0
1531: && unit2 <= Duration.MAXUNIT)
1532: return new TimeRate((Double.valueOf(s).doubleValue())
1533: * Duration.getConvFactor(unit1)
1534: / Duration.getConvFactor(unit2));
1535: else
1536: throw new UnknownUnitException();
1537: }
1538:
1539: // Support for AbstractMeasure-level constructor
1540: public static final AbstractMeasure newMeasure(String s, int unit) {
1541: return newTimeRate(s, unit);
1542: }
1543:
1544: public static final AbstractMeasure newMeasure(double v, int unit) {
1545: return newTimeRate(v, unit);
1546: }
1547:
1548: // simple math : addition and subtraction
1549: public final Measure add(Measure toAdd) {
1550: if (!(toAdd instanceof TimeRate))
1551: throw new IllegalArgumentException();
1552: return new TimeRate(theValue + toAdd.getNativeValue());
1553: }
1554:
1555: public final Measure subtract(Measure toSubtract) {
1556: if (!(toSubtract instanceof TimeRate))
1557: throw new IllegalArgumentException();
1558: return new TimeRate(theValue - toSubtract.getNativeValue());
1559: }
1560:
1561: public final Measure scale(double scale) {
1562: return new TimeRate(theValue * scale, 0);
1563: }
1564:
1565: public final Measure negate() {
1566: return newTimeRate(-1 * theValue, 0);
1567: }
1568:
1569: public final Measure floor(int unit) {
1570: return newTimeRate(Math.floor(getValue(unit)), 0);
1571: }
1572:
1573: public final Measure valueOf(double value) {
1574: return new TimeRate(value);
1575: }
1576:
1577: public final Measure valueOf(double value, int unit) {
1578: return new TimeRate(value, unit);
1579: }
1580:
1581: public final double getNativeValue() {
1582: return theValue;
1583: }
1584:
1585: public final int getNativeUnit() {
1586: return 0;
1587: }
1588:
1589: public final Duration divide(Rate toRate) {
1590: throw new IllegalArgumentException(
1591: "Call divideRate instead to divide one Rate by another.");
1592: }
1593:
1594: public final double divideRate(Rate toRate) {
1595: if (toRate.getCanonicalNumerator().getClass() != getCanonicalNumerator()
1596: .getClass()
1597: || toRate.getCanonicalDenominator().getClass() != getCanonicalDenominator()
1598: .getClass()) {
1599: throw new IllegalArgumentException("Expecting a TimeRate"
1600: + ", got a "
1601: + toRate.getCanonicalNumerator().getClass() + "/"
1602: + toRate.getCanonicalDenominator().getClass());
1603: }
1604: return theValue / toRate.getNativeValue();
1605: }
1606:
1607: // Unit-based Reader methods
1608: public double getSecondsPerSecond() {
1609: return (theValue * (1.0d / 1.0d));
1610: }
1611:
1612: public double getSecondsPerMinute() {
1613: return (theValue * (1.0d / (1.0d / 60)));
1614: }
1615:
1616: public double getSecondsPerHour() {
1617: return (theValue * (1.0d / (1.0d / 3600)));
1618: }
1619:
1620: public double getSecondsPerDay() {
1621: return (theValue * (1.0d / (1.0d / 86400)));
1622: }
1623:
1624: public double getSecondsPerWeek() {
1625: return (theValue * (1.0d / (1.0d / 604800)));
1626: }
1627:
1628: public double getSecondsPerMillisecond() {
1629: return (theValue * (1.0d / 1000));
1630: }
1631:
1632: public double getSecondsPerKilosecond() {
1633: return (theValue * (1.0d / (1.0d / 1000)));
1634: }
1635:
1636: public double getSecondsPerMonth() {
1637: return (theValue * (1.0d / (1.0d / 2629743.8)));
1638: }
1639:
1640: public double getSecondsPerYear() {
1641: return (theValue * (1.0d / (1.0d / 31556926)));
1642: }
1643:
1644: public double getSecondsPerFortnight() {
1645: return (theValue * (1.0d / (1.0d / 1209600)));
1646: }
1647:
1648: public double getMinutesPerSecond() {
1649: return (theValue * ((1.0d / 60) / 1.0d));
1650: }
1651:
1652: public double getMinutesPerMinute() {
1653: return (theValue * ((1.0d / 60) / (1.0d / 60)));
1654: }
1655:
1656: public double getMinutesPerHour() {
1657: return (theValue * ((1.0d / 60) / (1.0d / 3600)));
1658: }
1659:
1660: public double getMinutesPerDay() {
1661: return (theValue * ((1.0d / 60) / (1.0d / 86400)));
1662: }
1663:
1664: public double getMinutesPerWeek() {
1665: return (theValue * ((1.0d / 60) / (1.0d / 604800)));
1666: }
1667:
1668: public double getMinutesPerMillisecond() {
1669: return (theValue * ((1.0d / 60) / 1000));
1670: }
1671:
1672: public double getMinutesPerKilosecond() {
1673: return (theValue * ((1.0d / 60) / (1.0d / 1000)));
1674: }
1675:
1676: public double getMinutesPerMonth() {
1677: return (theValue * ((1.0d / 60) / (1.0d / 2629743.8)));
1678: }
1679:
1680: public double getMinutesPerYear() {
1681: return (theValue * ((1.0d / 60) / (1.0d / 31556926)));
1682: }
1683:
1684: public double getMinutesPerFortnight() {
1685: return (theValue * ((1.0d / 60) / (1.0d / 1209600)));
1686: }
1687:
1688: public double getHoursPerSecond() {
1689: return (theValue * ((1.0d / 3600) / 1.0d));
1690: }
1691:
1692: public double getHoursPerMinute() {
1693: return (theValue * ((1.0d / 3600) / (1.0d / 60)));
1694: }
1695:
1696: public double getHoursPerHour() {
1697: return (theValue * ((1.0d / 3600) / (1.0d / 3600)));
1698: }
1699:
1700: public double getHoursPerDay() {
1701: return (theValue * ((1.0d / 3600) / (1.0d / 86400)));
1702: }
1703:
1704: public double getHoursPerWeek() {
1705: return (theValue * ((1.0d / 3600) / (1.0d / 604800)));
1706: }
1707:
1708: public double getHoursPerMillisecond() {
1709: return (theValue * ((1.0d / 3600) / 1000));
1710: }
1711:
1712: public double getHoursPerKilosecond() {
1713: return (theValue * ((1.0d / 3600) / (1.0d / 1000)));
1714: }
1715:
1716: public double getHoursPerMonth() {
1717: return (theValue * ((1.0d / 3600) / (1.0d / 2629743.8)));
1718: }
1719:
1720: public double getHoursPerYear() {
1721: return (theValue * ((1.0d / 3600) / (1.0d / 31556926)));
1722: }
1723:
1724: public double getHoursPerFortnight() {
1725: return (theValue * ((1.0d / 3600) / (1.0d / 1209600)));
1726: }
1727:
1728: public double getDaysPerSecond() {
1729: return (theValue * ((1.0d / 86400) / 1.0d));
1730: }
1731:
1732: public double getDaysPerMinute() {
1733: return (theValue * ((1.0d / 86400) / (1.0d / 60)));
1734: }
1735:
1736: public double getDaysPerHour() {
1737: return (theValue * ((1.0d / 86400) / (1.0d / 3600)));
1738: }
1739:
1740: public double getDaysPerDay() {
1741: return (theValue * ((1.0d / 86400) / (1.0d / 86400)));
1742: }
1743:
1744: public double getDaysPerWeek() {
1745: return (theValue * ((1.0d / 86400) / (1.0d / 604800)));
1746: }
1747:
1748: public double getDaysPerMillisecond() {
1749: return (theValue * ((1.0d / 86400) / 1000));
1750: }
1751:
1752: public double getDaysPerKilosecond() {
1753: return (theValue * ((1.0d / 86400) / (1.0d / 1000)));
1754: }
1755:
1756: public double getDaysPerMonth() {
1757: return (theValue * ((1.0d / 86400) / (1.0d / 2629743.8)));
1758: }
1759:
1760: public double getDaysPerYear() {
1761: return (theValue * ((1.0d / 86400) / (1.0d / 31556926)));
1762: }
1763:
1764: public double getDaysPerFortnight() {
1765: return (theValue * ((1.0d / 86400) / (1.0d / 1209600)));
1766: }
1767:
1768: public double getWeeksPerSecond() {
1769: return (theValue * ((1.0d / 604800) / 1.0d));
1770: }
1771:
1772: public double getWeeksPerMinute() {
1773: return (theValue * ((1.0d / 604800) / (1.0d / 60)));
1774: }
1775:
1776: public double getWeeksPerHour() {
1777: return (theValue * ((1.0d / 604800) / (1.0d / 3600)));
1778: }
1779:
1780: public double getWeeksPerDay() {
1781: return (theValue * ((1.0d / 604800) / (1.0d / 86400)));
1782: }
1783:
1784: public double getWeeksPerWeek() {
1785: return (theValue * ((1.0d / 604800) / (1.0d / 604800)));
1786: }
1787:
1788: public double getWeeksPerMillisecond() {
1789: return (theValue * ((1.0d / 604800) / 1000));
1790: }
1791:
1792: public double getWeeksPerKilosecond() {
1793: return (theValue * ((1.0d / 604800) / (1.0d / 1000)));
1794: }
1795:
1796: public double getWeeksPerMonth() {
1797: return (theValue * ((1.0d / 604800) / (1.0d / 2629743.8)));
1798: }
1799:
1800: public double getWeeksPerYear() {
1801: return (theValue * ((1.0d / 604800) / (1.0d / 31556926)));
1802: }
1803:
1804: public double getWeeksPerFortnight() {
1805: return (theValue * ((1.0d / 604800) / (1.0d / 1209600)));
1806: }
1807:
1808: public double getMillisecondsPerSecond() {
1809: return (theValue * (1000 / 1.0d));
1810: }
1811:
1812: public double getMillisecondsPerMinute() {
1813: return (theValue * (1000 / (1.0d / 60)));
1814: }
1815:
1816: public double getMillisecondsPerHour() {
1817: return (theValue * (1000 / (1.0d / 3600)));
1818: }
1819:
1820: public double getMillisecondsPerDay() {
1821: return (theValue * (1000 / (1.0d / 86400)));
1822: }
1823:
1824: public double getMillisecondsPerWeek() {
1825: return (theValue * (1000 / (1.0d / 604800)));
1826: }
1827:
1828: public double getMillisecondsPerMillisecond() {
1829: return (theValue * (1000 / 1000));
1830: }
1831:
1832: public double getMillisecondsPerKilosecond() {
1833: return (theValue * (1000 / (1.0d / 1000)));
1834: }
1835:
1836: public double getMillisecondsPerMonth() {
1837: return (theValue * (1000 / (1.0d / 2629743.8)));
1838: }
1839:
1840: public double getMillisecondsPerYear() {
1841: return (theValue * (1000 / (1.0d / 31556926)));
1842: }
1843:
1844: public double getMillisecondsPerFortnight() {
1845: return (theValue * (1000 / (1.0d / 1209600)));
1846: }
1847:
1848: public double getKilosecondsPerSecond() {
1849: return (theValue * ((1.0d / 1000) / 1.0d));
1850: }
1851:
1852: public double getKilosecondsPerMinute() {
1853: return (theValue * ((1.0d / 1000) / (1.0d / 60)));
1854: }
1855:
1856: public double getKilosecondsPerHour() {
1857: return (theValue * ((1.0d / 1000) / (1.0d / 3600)));
1858: }
1859:
1860: public double getKilosecondsPerDay() {
1861: return (theValue * ((1.0d / 1000) / (1.0d / 86400)));
1862: }
1863:
1864: public double getKilosecondsPerWeek() {
1865: return (theValue * ((1.0d / 1000) / (1.0d / 604800)));
1866: }
1867:
1868: public double getKilosecondsPerMillisecond() {
1869: return (theValue * ((1.0d / 1000) / 1000));
1870: }
1871:
1872: public double getKilosecondsPerKilosecond() {
1873: return (theValue * ((1.0d / 1000) / (1.0d / 1000)));
1874: }
1875:
1876: public double getKilosecondsPerMonth() {
1877: return (theValue * ((1.0d / 1000) / (1.0d / 2629743.8)));
1878: }
1879:
1880: public double getKilosecondsPerYear() {
1881: return (theValue * ((1.0d / 1000) / (1.0d / 31556926)));
1882: }
1883:
1884: public double getKilosecondsPerFortnight() {
1885: return (theValue * ((1.0d / 1000) / (1.0d / 1209600)));
1886: }
1887:
1888: public double getMonthsPerSecond() {
1889: return (theValue * ((1.0d / 2629743.8) / 1.0d));
1890: }
1891:
1892: public double getMonthsPerMinute() {
1893: return (theValue * ((1.0d / 2629743.8) / (1.0d / 60)));
1894: }
1895:
1896: public double getMonthsPerHour() {
1897: return (theValue * ((1.0d / 2629743.8) / (1.0d / 3600)));
1898: }
1899:
1900: public double getMonthsPerDay() {
1901: return (theValue * ((1.0d / 2629743.8) / (1.0d / 86400)));
1902: }
1903:
1904: public double getMonthsPerWeek() {
1905: return (theValue * ((1.0d / 2629743.8) / (1.0d / 604800)));
1906: }
1907:
1908: public double getMonthsPerMillisecond() {
1909: return (theValue * ((1.0d / 2629743.8) / 1000));
1910: }
1911:
1912: public double getMonthsPerKilosecond() {
1913: return (theValue * ((1.0d / 2629743.8) / (1.0d / 1000)));
1914: }
1915:
1916: public double getMonthsPerMonth() {
1917: return (theValue * ((1.0d / 2629743.8) / (1.0d / 2629743.8)));
1918: }
1919:
1920: public double getMonthsPerYear() {
1921: return (theValue * ((1.0d / 2629743.8) / (1.0d / 31556926)));
1922: }
1923:
1924: public double getMonthsPerFortnight() {
1925: return (theValue * ((1.0d / 2629743.8) / (1.0d / 1209600)));
1926: }
1927:
1928: public double getYearsPerSecond() {
1929: return (theValue * ((1.0d / 31556926) / 1.0d));
1930: }
1931:
1932: public double getYearsPerMinute() {
1933: return (theValue * ((1.0d / 31556926) / (1.0d / 60)));
1934: }
1935:
1936: public double getYearsPerHour() {
1937: return (theValue * ((1.0d / 31556926) / (1.0d / 3600)));
1938: }
1939:
1940: public double getYearsPerDay() {
1941: return (theValue * ((1.0d / 31556926) / (1.0d / 86400)));
1942: }
1943:
1944: public double getYearsPerWeek() {
1945: return (theValue * ((1.0d / 31556926) / (1.0d / 604800)));
1946: }
1947:
1948: public double getYearsPerMillisecond() {
1949: return (theValue * ((1.0d / 31556926) / 1000));
1950: }
1951:
1952: public double getYearsPerKilosecond() {
1953: return (theValue * ((1.0d / 31556926) / (1.0d / 1000)));
1954: }
1955:
1956: public double getYearsPerMonth() {
1957: return (theValue * ((1.0d / 31556926) / (1.0d / 2629743.8)));
1958: }
1959:
1960: public double getYearsPerYear() {
1961: return (theValue * ((1.0d / 31556926) / (1.0d / 31556926)));
1962: }
1963:
1964: public double getYearsPerFortnight() {
1965: return (theValue * ((1.0d / 31556926) / (1.0d / 1209600)));
1966: }
1967:
1968: public double getFortnightsPerSecond() {
1969: return (theValue * ((1.0d / 1209600) / 1.0d));
1970: }
1971:
1972: public double getFortnightsPerMinute() {
1973: return (theValue * ((1.0d / 1209600) / (1.0d / 60)));
1974: }
1975:
1976: public double getFortnightsPerHour() {
1977: return (theValue * ((1.0d / 1209600) / (1.0d / 3600)));
1978: }
1979:
1980: public double getFortnightsPerDay() {
1981: return (theValue * ((1.0d / 1209600) / (1.0d / 86400)));
1982: }
1983:
1984: public double getFortnightsPerWeek() {
1985: return (theValue * ((1.0d / 1209600) / (1.0d / 604800)));
1986: }
1987:
1988: public double getFortnightsPerMillisecond() {
1989: return (theValue * ((1.0d / 1209600) / 1000));
1990: }
1991:
1992: public double getFortnightsPerKilosecond() {
1993: return (theValue * ((1.0d / 1209600) / (1.0d / 1000)));
1994: }
1995:
1996: public double getFortnightsPerMonth() {
1997: return (theValue * ((1.0d / 1209600) / (1.0d / 2629743.8)));
1998: }
1999:
2000: public double getFortnightsPerYear() {
2001: return (theValue * ((1.0d / 1209600) / (1.0d / 31556926)));
2002: }
2003:
2004: public double getFortnightsPerFortnight() {
2005: return (theValue * ((1.0d / 1209600) / (1.0d / 1209600)));
2006: }
2007:
2008: /** @param unit One of the constant units of TimeRate **/
2009: public double getValue(int unit) {
2010: if (unit >= 0 && unit <= MAXUNIT)
2011: return (theValue * getConvFactor(unit));
2012: else
2013: throw new UnknownUnitException();
2014: }
2015:
2016: /** @param unit1 One of the constant units of Duration
2017: * @param unit2 One of the constant units of Duration
2018: **/
2019: public double getValue(int unit1, int unit2) {
2020: if (unit1 >= 0 && unit1 <= Duration.MAXUNIT && unit2 >= 0
2021: && unit2 <= Duration.MAXUNIT)
2022: return (theValue * Duration.getConvFactor(unit2) / Duration
2023: .getConvFactor(unit1));
2024: else
2025: throw new UnknownUnitException();
2026: }
2027:
2028: public boolean equals(Object o) {
2029: return (o instanceof TimeRate && theValue == ((TimeRate) o).theValue);
2030: }
2031:
2032: public String toString() {
2033: return Double.toString(theValue) + "s/s";
2034: }
2035:
2036: public int hashCode() {
2037: return (new Double(theValue)).hashCode();
2038: }
2039:
2040: // Derivative
2041: public final Class getNumeratorClass() {
2042: return Duration.class;
2043: }
2044:
2045: public final Class getDenominatorClass() {
2046: return Duration.class;
2047: }
2048:
2049: private final static Duration can_num = new Duration(0.0, 0);
2050:
2051: public final Measure getCanonicalNumerator() {
2052: return can_num;
2053: }
2054:
2055: private final static Duration can_den = new Duration(0.0, 0);
2056:
2057: public final Measure getCanonicalDenominator() {
2058: return can_den;
2059: }
2060:
2061: public final Measure computeNumerator(Measure den) {
2062: if (!(den instanceof Duration))
2063: throw new IllegalArgumentException();
2064: return new Duration(theValue * den.getValue(0), 0);
2065: }
2066:
2067: public final Measure computeDenominator(Measure num) {
2068: if (!(num instanceof Duration))
2069: throw new IllegalArgumentException();
2070: return new Duration(num.getValue(0) / theValue, 0);
2071: }
2072:
2073: // serialization
2074: public void writeExternal(ObjectOutput out) throws IOException {
2075: out.writeDouble(theValue);
2076: }
2077:
2078: public void readExternal(ObjectInput in) throws IOException {
2079: theValue = in.readDouble();
2080: }
2081: }
|