KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > measure > units > NonSI


1 /*
2  * JScience - Java(TM) Tools and Libraries for the Advancement of Sciences.
3  * Copyright (C) 2006 - JScience (http://jscience.org/)
4  * All rights reserved.
5  *
6  * Permission to use, copy, modify, and distribute this software is
7  * freely granted, provided that this notice is preserved.
8  */

9 package javax.measure.units;
10
11 import java.util.Collections JavaDoc;
12 import java.util.HashSet JavaDoc;
13 import java.util.Set JavaDoc;
14
15 import javax.measure.converters.LogConverter;
16 import javax.measure.converters.RationalConverter;
17 import javax.measure.quantities.*;
18
19 import static javax.measure.units.SI.*;
20
21 /**
22  * <p> This class contains units that are not part of the International
23  * System of Units, that is, they are outside the SI, but are important
24  * and widely used.</p>
25  *
26  * <p> A collection of all the NonSI units defined can be retrieved using the
27  * {@link #units() NonSI.units()} static method.</p>
28  *
29  * @author <a HREF="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
30  * @version 3.1, April 22, 2006
31  */

32 public final class NonSI {
33
34     /**
35      * Holds collection of NonSI units.
36      */

37     private static HashSet JavaDoc<Unit<?>> INSTANCES = new HashSet JavaDoc<Unit<?>>();
38
39     /**
40      * Holds the standard gravity constant: 9.80665 m/s² exact.
41      */

42     private static final int STANDARD_GRAVITY_DIVIDEND = 980665;
43     private static final int STANDARD_GRAVITY_DIVISOR = 100000;
44
45     /**
46      * Holds the international foot: 0.3048 m exact.
47      */

48     private static final int INTERNATIONAL_FOOT_DIVIDEND = 3048;
49     private static final int INTERNATIONAL_FOOT_DIViSOR = 10000;
50
51     /**
52      * Holds the avoirdupois pound: 0.45359237 kg exact
53      */

54     private static final int AVOIRDUPOIS_POUND_DIVIDEND = 45359237;
55     private static final int AVOIRDUPOIS_POUND_DIVISOR = 100000000;
56
57     /**
58      * Holds the Avogadro constant.
59      */

60     private static final double AVOGADRO_CONSTANT = 6.02214199e23; // (1/mol).
61

62     /**
63      * Holds the electric charge of one electron.
64      */

65     private static final double ELEMENTARY_CHARGE = 1.602176462e-19; // (C).
66

67     /**
68      * Default constructor (prevents this class from being instantiated).
69      */

70     private NonSI() {
71     }
72
73     ///////////////////
74
// Dimensionless //
75
///////////////////
76

77     /**
78      * A dimensionless unit equals to <code>0.01</code>
79      * (standard name <code>%</code>).
80      */

81     public static final Unit<Dimensionless> PERCENT = nonSI(Unit.ONE.divide(100));
82
83     /**
84      * A logarithmic unit used to describe a ratio
85      * (standard name <code>dB</code>).
86      */

87     public static final Unit<Dimensionless> DECIBEL = nonSI(Unit.ONE
88             .transform(new LogConverter(10).inverse().concatenate(
89                     new RationalConverter(1, 10))));
90
91     //////////////////
92
// Acceleration //
93
//////////////////
94

95     /**
96      * A unit of acceleration equal to the gravity at the earth's surface
97      * (standard name <code>grav</code>).
98      */

99     public static final Unit<Acceleration> G = nonSI(METER_PER_SQUARE_SECOND
100             .times(STANDARD_GRAVITY_DIVIDEND).divide(STANDARD_GRAVITY_DIVISOR));
101
102     /////////////////////////
103
// Amount of substance //
104
/////////////////////////
105

106     /**
107      * A unit of amount of substance equals to one atom
108      * (standard name <code>atom</code>).
109      */

110     public static final Unit<AmountOfSubstance> ATOM = nonSI(MOLE
111             .divide(AVOGADRO_CONSTANT));
112
113     ///////////
114
// Angle //
115
///////////
116

117     /**
118      * A unit of angle equal to a full circle or <code>2<i>&pi;</i>
119      * {@link SI#RADIAN}</code> (standard name <code>rev</code>).
120      */

121     public static final Unit<Angle> REVOLUTION = nonSI(RADIAN.times(2.0 * Math.PI));
122
123     /**
124      * A unit of angle equal to <code>1/360 {@link #REVOLUTION}</code>
125      * (standard name <code>°</code>).
126      */

127     public static final Unit<Angle> DEGREE_ANGLE = nonSI(REVOLUTION.divide(360));
128
129     /**
130      * A unit of angle equal to <code>1/60 {@link #DEGREE_ANGLE}</code>
131      * (standard name <code>′</code>).
132      */

133     public static final Unit<Angle> MINUTE_ANGLE = nonSI(DEGREE_ANGLE.divide(60));
134
135     /**
136      * A unit of angle equal to <code>1/60 {@link #MINUTE_ANGLE}</code>
137      * (standard name <code>"</code>).
138      */

139     public static final Unit<Angle> SECOND_ANGLE = nonSI(MINUTE_ANGLE.divide(60));
140
141     /**
142      * A unit of angle equal to <code>0.01 {@link SI#RADIAN}</code>
143      * (standard name <code>centiradian</code>).
144      */

145     public static final Unit<Angle> CENTIRADIAN = nonSI(RADIAN.divide(100));
146
147     /**
148      * A unit of angle measure equal to <code>1/400 {@link #REVOLUTION}</code>
149      * (standard name <code>grade</code>).
150      */

151     public static final Unit<Angle> GRADE = nonSI(REVOLUTION.divide(400));
152
153     //////////
154
// Area //
155
//////////
156

157     /**
158      * A unit of area equal to <code>100 m²</code>
159      * (standard name <code>a</code>).
160      */

161     public static final Unit<Area> ARE = nonSI(SQUARE_METER.times(100));
162
163     /**
164      * A unit of area equal to <code>100 {@link #ARE}</code>
165      * (standard name <code>ha</code>).
166      */

167     public static final Unit<Area> HECTARE = nonSI(ARE.times(100)); // Exact.
168

169     /////////////////
170
// Data Amount //
171
/////////////////
172

173     /**
174      * A unit of data amount equal to <code>8 {@link SI#BIT}</code>
175      * (BinarY TErm, standard name <code>byte</code>).
176      */

177     public static final Unit<DataAmount> BYTE = nonSI(BIT.times(8));
178
179     /**
180      * Equivalent {@link #BYTE}
181      */

182     public static final Unit<DataAmount> OCTET = BYTE;
183
184     //////////////
185
// Duration //
186
//////////////
187

188     /**
189      * A unit of duration equal to <code>60 s</code>
190      * (standard name <code>min</code>).
191      */

192     public static final Unit<Duration> MINUTE = nonSI(SI.SECOND.times(60));
193
194     /**
195      * A unit of duration equal to <code>60 {@link #MINUTE}</code>
196      * (standard name <code>h</code>).
197      */

198     public static final Unit<Duration> HOUR = nonSI(MINUTE.times(60));
199
200     /**
201      * A unit of duration equal to <code>24 {@link #HOUR}</code>
202      * (standard name <code>d</code>).
203      */

204     public static final Unit<Duration> DAY = nonSI(HOUR.times(24));
205
206     /**
207      * A unit of duration equal to <code>7 {@link #DAY}</code>
208      * (standard name <code>week</code>).
209      */

210     public static final Unit<Duration> WEEK = nonSI(DAY.times(7));
211
212     /**
213      * A unit of duration equal to 365 days, 5 hours, 49 minutes,
214      * and 12 seconds (standard name <code>year</code>).
215      */

216     public static final Unit<Duration> YEAR = nonSI(SECOND.times(31556952));
217
218     /**
219      * A unit of duration equal to one twelfth of a year
220      * (standard name <code>month</code>).
221      */

222     public static final Unit<Duration> MONTH = nonSI(YEAR.divide(12));
223
224     /**
225      * A unit of duration equal to the time required for a complete rotation of
226      * the earth in reference to any star or to the vernal equinox at the
227      * meridian, equal to 23 hours, 56 minutes, 4.09 seconds
228      * (standard name <code>day_sidereal</code>).
229      */

230     public static final Unit<Duration> DAY_SIDEREAL = nonSI(SECOND.times(86164.09));
231
232     /**
233      * A unit of duration equal to one complete revolution of the
234      * earth about the sun, relative to the fixed stars, or 365 days, 6 hours,
235      * 9 minutes, 9.54 seconds (standard name <code>year_sidereal</code>).
236      */

237     public static final Unit<Duration> YEAR_SIDEREAL = nonSI(SECOND
238             .times(31558149.54));
239
240     /**
241      * A unit of duration equal to <code>365 {@link #DAY}</code>
242      * (standard name <code>year_calendar</code>).
243      */

244     public static final Unit<Duration> YEAR_CALENDAR = nonSI(DAY.times(365));
245
246     /////////////////////
247
// Electric charge //
248
/////////////////////
249

250     /**
251      * A unit of electric charge equal to the charge on one electron
252      * (standard name <code>e</code>).
253      */

254     public static final Unit<ElectricCharge> E = nonSI(COULOMB
255             .times(ELEMENTARY_CHARGE));
256
257     /**
258      * A unit of electric charge equal to equal to the product of Avogadro's
259      * number (see {@link SI#MOLE}) and the charge (1 e) on a single electron
260      * (standard name <code>Fd</code>).
261      */

262     public static final Unit<ElectricCharge> FARADAY = nonSI(COULOMB
263             .times(ELEMENTARY_CHARGE * AVOGADRO_CONSTANT)); // e/mol
264

265     /**
266      * A unit of electric charge which exerts a force of one dyne on an equal
267      * charge at a distance of one centimeter
268      * (standard name <code>Fr</code>).
269      */

270     public static final Unit<ElectricCharge> FRANKLIN = nonSI(COULOMB
271             .times(3.3356e-10));
272
273     //////////////////////
274
// Electric current //
275
//////////////////////
276

277     /**
278      * A unit of electric charge equal to the centimeter-gram-second
279      * electromagnetic unit of magnetomotive force, equal to <code>10/4
280      * &pi;ampere-turn</code> (standard name <code>Gi</code>).
281      */

282     public static final Unit<ElectricCurrent> GILBERT = nonSI(SI.AMPERE
283             .times(10.0 / (4.0 * Math.PI)));
284
285     ////////////
286
// Energy //
287
////////////
288

289     /**
290      * A unit of energy equal to <code>1E-7 J</code>
291      * (standard name <code>erg</code>).
292      */

293     public static final Unit<Energy> ERG = nonSI(JOULE.divide(10000000));
294
295     /**
296      * A unit of energy equal to one electron-volt (standard name
297      * <code>eV</code>, also recognized <code>keV, MeV, GeV</code>).
298      */

299     public static final Unit<Energy> ELECTRON_VOLT = nonSI(JOULE
300             .times(ELEMENTARY_CHARGE));
301
302     /////////////////
303
// Illuminance //
304
/////////////////
305

306     /**
307      * A unit of illuminance equal to <code>1E4 Lx</code>
308      * (standard name <code>La</code>).
309      */

310     public static final Unit<Illuminance> LAMBERT = nonSI(LUX.times(10000));
311
312     ////////////
313
// Length //
314
////////////
315

316     /**
317      * A unit of length equal to <code>0.3048 m</code>
318      * (standard name <code>ft</code>).
319      */

320     public static final Unit<Length> FOOT = nonSI(METER.times(INTERNATIONAL_FOOT_DIVIDEND).divide(INTERNATIONAL_FOOT_DIViSOR));
321
322     /**
323      * A unit of length equal to <code>1200/3937 m</code>
324      * (standard name <code>foot_survey_us</code>).
325      * See also: <a HREF="http://www.sizes.com/units/foot.htm">foot</a>
326      */

327     public static final Unit<Length> FOOT_SURVEY_US = nonSI(METER
328             .times(1200).divide(3937));
329
330     /**
331      * A unit of length equal to <code>0.9144 m</code>
332      * (standard name <code>yd</code>).
333      */

334     public static final Unit<Length> YARD = nonSI(FOOT.times(3));
335
336     /**
337      * A unit of length equal to <code>0.0254 m</code>
338      * (standard name <code>in</code>).
339      */

340     public static final Unit<Length> INCH = nonSI(FOOT.divide(12));
341
342     /**
343      * A unit of length equal to <code>1609.344 m</code>
344      * (standard name <code>mi</code>).
345      */

346     public static final Unit<Length> MILE = nonSI(METER.times(1609344).divide(1000));
347
348     /**
349      * A unit of length equal to <code>1852.0 m</code>
350      * (standard name <code>nmi</code>).
351      */

352     public static final Unit<Length> NAUTICAL_MILE = nonSI(METER.times(1852));
353
354     /**
355      * A unit of length equal to <code>1E-10 m</code>
356      * (standard name <code>Å</code>).
357      */

358     public static final Unit<Length> ANGSTROM = nonSI(METER.divide(10000000000L));
359
360     /**
361      * A unit of length equal to the average distance from the center of the
362      * Earth to the center of the Sun (standard name <code>ua</code>).
363      */

364     public static final Unit<Length> ASTRONOMICAL_UNIT = nonSI(METER
365             .times(149597870691.0));
366
367     /**
368      * A unit of length equal to the distance that light travels in one year
369      * through a vacuum (standard name <code>ly</code>).
370      */

371     public static final Unit<Length> LIGHT_YEAR = nonSI(METER.times(9.460528405e15));
372
373     /**
374      * A unit of length equal to the distance at which a star would appear to
375      * shift its position by one arcsecond over the course the time
376      * (about 3 months) in which the Earth moves a distance of
377      * {@link #ASTRONOMICAL_UNIT} in the direction perpendicular to the
378      * direction to the star (standard name <code>pc</code>).
379      */

380     public static final Unit<Length> PARSEC = nonSI(METER.times(30856770e9));
381
382     /**
383      * A unit of length equal to <code>0.013837 {@link #INCH}</code> exactly
384      * (standard name <code>pt</code>).
385      * @see #PIXEL
386      */

387     public static final Unit<Length> POINT = nonSI(INCH.times(13837).divide(1000000));
388
389     /**
390      * A unit of length equal to <code>1/72 {@link #INCH}</code>
391      * (standard name <code>pixel</code>).
392      * It is the American point rounded to an even 1/72 inch.
393      * @see #POINT
394      */

395     public static final Unit<Length> PIXEL = nonSI(INCH.divide(72));
396
397     /**
398      * Equivalent {@link #PIXEL}
399      */

400     public static final Unit<Length> COMPUTER_POINT = PIXEL;
401
402     ///////////////////
403
// Magnetic Flux //
404
///////////////////
405

406     /**
407      * A unit of magnetic flux equal <code>1E-8 Wb</code>
408      * (standard name <code>Mx</code>).
409      */

410     public static final Unit<MagneticFlux> MAXWELL = nonSI(WEBER.divide(100000000));
411
412     ///////////////////////////
413
// Magnetic Flux Density //
414
///////////////////////////
415

416     /**
417      * A unit of magnetic flux density equal <code>1000 A/m</code>
418      * (standard name <code>G</code>).
419      */

420     public static final Unit<MagneticFluxDensity> GAUSS = nonSI(TESLA.divide(10000));
421
422     //////////
423
// Mass //
424
//////////
425

426     /**
427      * A unit of mass equal to 1/12 the mass of the carbon-12 atom
428      * (standard name <code>u</code>).
429      */

430     public static final Unit<Mass> ATOMIC_MASS = nonSI(KILOGRAM
431             .times(1e-3 / AVOGADRO_CONSTANT));
432
433     /**
434      * A unit of mass equal to the mass of the electron
435      * (standard name <code>me</code>).
436      */

437     public static final Unit<Mass> ELECTRON_MASS = nonSI(KILOGRAM
438             .times(9.10938188e-31));
439
440     /**
441      * A unit of mass equal to <code>453.59237 grams</code> (avoirdupois pound,
442      * standard name <code>lb</code>).
443      */

444     public static final Unit<Mass> POUND = nonSI(KILOGRAM.times(AVOIRDUPOIS_POUND_DIVIDEND).divide(AVOIRDUPOIS_POUND_DIVISOR));
445
446     /**
447      * A unit of mass equal to <code>1 / 16 {@link #POUND}</code>
448      * (standard name <code>oz</code>).
449      */

450     public static final Unit<Mass> OUNCE = nonSI(POUND.divide(16));
451
452     /**
453      * A unit of mass equal to <code>2000 {@link #POUND}</code> (short ton,
454      * standard name <code>ton_us</code>).
455      */

456     public static final Unit<Mass> TON_US = nonSI(POUND.times(2000));
457
458     /**
459      * A unit of mass equal to <code>2240 {@link #POUND}</code> (long ton,
460      * standard name <code>ton_uk</code>).
461      */

462     public static final Unit<Mass> TON_UK = nonSI(POUND.times(2240));
463
464     /**
465      * A unit of mass equal to <code>1000 kg</code> (metric ton,
466      * standard name <code>t</code>).
467      */

468     public static final Unit<Mass> METRIC_TON = nonSI(KILOGRAM.times(1000));
469
470     ///////////
471
// Force //
472
///////////
473

474     /**
475      * A unit of force equal to <code>1E-5 N</code>
476      * (standard name <code>dyn</code>).
477      */

478     public static final Unit<Force> DYNE = nonSI(NEWTON.divide(100000));
479
480     /**
481      * A unit of force equal to <code>9.80665 N</code>
482      * (standard name <code>kgf</code>).
483      */

484     public static final Unit<Force> KILOGRAM_FORCE = nonSI(NEWTON
485             .times(STANDARD_GRAVITY_DIVIDEND).divide(STANDARD_GRAVITY_DIVISOR));
486
487     /**
488      * A unit of force equal to <code>{@link #POUND}·{@link #G}</code>
489      * (standard name <code>lbf</code>).
490      */

491     public static final Unit<Force> POUND_FORCE = nonSI(NEWTON
492             .times(1L * AVOIRDUPOIS_POUND_DIVIDEND * STANDARD_GRAVITY_DIVIDEND).divide(
493                     1L * AVOIRDUPOIS_POUND_DIVISOR * STANDARD_GRAVITY_DIVISOR));
494
495     ///////////
496
// Power //
497
///////////
498

499     /**
500      * A unit of power equal to the power required to raise a mass of 75
501      * kilograms at a velocity of 1 meter per second (metric,
502      * standard name <code>hp</code>).
503      */

504     public static final Unit<Power> HORSEPOWER = nonSI(WATT.times(735.499));
505
506     //////////////
507
// Pressure //
508
//////////////
509

510     /**
511      * A unit of pressure equal to the average pressure of the Earth's
512      * atmosphere at sea level (standard name <code>atm</code>).
513      */

514     public static final Unit<Pressure> ATMOSPHERE = nonSI(PASCAL.times(101325));
515
516     /**
517      * A unit of pressure equal to <code>100 kPa</code>
518      * (standard name <code>bar</code>).
519      */

520     public static final Unit<Pressure> BAR = nonSI(PASCAL.times(100000));
521
522     /**
523      * A unit of pressure equal to the pressure exerted at the Earth's
524      * surface by a column of mercury 1 millimeter high
525      * (standard name <code>mmHg</code>).
526      */

527     public static final Unit<Pressure> MILLIMETER_OF_MERCURY =nonSI(PASCAL
528             .times(133.322));
529
530     /**
531      * A unit of pressure equal to the pressure exerted at the Earth's
532      * surface by a column of mercury 1 inch high
533      * (standard name <code>inHg</code>).
534      */

535     public static final Unit<Pressure> INCH_OF_MERCURY = nonSI(PASCAL.times(3386.388));
536
537     /////////////////////////////
538
// Radiation dose absorbed //
539
/////////////////////////////
540

541     /**
542      * A unit of radiation dose absorbed equal to a dose of 0.01 joule of
543      * energy per kilogram of mass (J/kg) (standard name <code>rd</code>).
544      */

545     public static final Unit<RadiationDoseAbsorbed> RAD = nonSI(GRAY.divide(100));
546
547     /**
548      * A unit of radiation dose effective equal to <code>0.01 Sv</code>
549      * (standard name <code>rem</code>).
550      */

551     public static final Unit<RadiationDoseEffective> REM = nonSI(SIEVERT.divide(100));
552
553     //////////////////////////
554
// Radioactive activity //
555
//////////////////////////
556

557     /**
558      * A unit of radioctive activity equal to the activity of a gram of radium
559      * (standard name <code>Ci</code>).
560      */

561     public static final Unit<RadioactiveActivity> CURIE = nonSI(BECQUEREL
562             .times(37000000000L));
563
564     /**
565      * A unit of radioctive activity equal to 1 million radioactive
566      * disintegrations per second (standard name <code>Rd</code>).
567      */

568     public static final Unit<RadioactiveActivity> RUTHERFORD = nonSI(SI.BECQUEREL
569             .times(1000000));
570
571     /////////////////
572
// Solid angle //
573
/////////////////
574

575     /**
576      * A unit of solid angle equal to <code>4 <i>&pi;</i> steradians</code>
577      * (standard name <code>sphere</code>).
578      */

579     public static final Unit<SolidAngle> SPHERE = nonSI(STERADIAN
580             .times(4.0 * Math.PI));
581
582     /////////////////
583
// Temperature //
584
/////////////////
585

586     /**
587      * A unit of temperature equal to <code>5/9 °K</code>
588      * (standard name <code>°R</code>).
589      */

590     public static final Unit<Temperature> RANKINE = nonSI(KELVIN.times(5).divide(9));
591
592     /**
593      * A unit of temperature equal to degree Rankine minus
594      * <code>459.67 °R</code> (standard name <code>°F</code>).
595      * @see #RANKINE
596      */

597     public static final Unit<Temperature> FAHRENHEIT = nonSI(RANKINE.plus(459.67));
598
599     //////////////
600
// Velocity //
601
//////////////
602

603     /**
604      * A unit of velocity equal to one {@link #NAUTICAL_MILE} per {@link #HOUR}
605      * (standard name <code>Mach</code>).
606      */

607     public static final Unit<Velocity> KNOT
608         = nonSI(NAUTICAL_MILE.divide(HOUR).sameTypeAs(METER_PER_SECOND));
609
610     /**
611      * A unit of velocity to express the speed of an aircraft relative to
612      * the speed of sound (standard name <code>Mach</code>).
613      */

614     public static final Unit<Velocity> MACH = nonSI(METER_PER_SECOND.times(331.6));
615
616     /**
617      * A unit of velocity relative to the speed of light
618      * (standard name <code>c</code>).
619      */

620     public static final Unit<Velocity> C = nonSI(METER_PER_SECOND.times(299792458));
621
622     ////////////
623
// Volume //
624
////////////
625

626     /**
627      * A unit of volume equal to one cubic decimeter (default label
628      * <code>L</code>, also recognized <code>µL, mL, cL, dL</code>).
629      */

630     public static final Unit<Volume> LITER = nonSI(CUBIC_METER.divide(1000));
631
632     /**
633      * A unit of volume equal to one cubic inch (<code>in³</code>).
634      */

635     public static final Unit<Volume> CUBIC_INCH = nonSI(
636             INCH.pow(3).sameTypeAs(SI.CUBIC_METER));
637
638     /**
639      * A unit of volume equal to one US gallon, Liquid Unit. The U.S. liquid
640      * gallon is based on the Queen Anne or Wine gallon occupying 231 cubic
641      * inches (standard name <code>gal</code>).
642      */

643     public static final Unit<Volume> GALLON_LIQUID_US = nonSI(CUBIC_INCH.times(231));
644
645     /**
646      * A unit of volume equal to <code>1 / 128 {@link #GALLON_LIQUID_US}</code>
647      * (standard name <code>oz_fl</code>).
648      */

649     public static final Unit<Volume> OUNCE_LIQUID_US = nonSI(GALLON_LIQUID_US
650             .divide(128));
651
652     /**
653      * A unit of volume equal to one US dry gallon.
654      * (standard name <code>gallon_dry_us</code>).
655      */

656     public static final Unit<Volume> GALLON_DRY_US = nonSI(CUBIC_INCH.times(2688025).divide(10000));
657
658     /**
659      * A unit of volume equal to <code>4.546 09 {@link #LITER}</code>
660      * (standard name <code>gal_uk</code>).
661      */

662     public static final Unit<Volume> GALLON_UK = nonSI(LITER.times(454609).divide(100000));
663
664     /**
665      * A unit of volume equal to <code>1 / 160 {@link #GALLON_UK}</code>
666      * (standard name <code>oz_fl_uk</code>).
667      */

668     public static final Unit<Volume> OUNCE_LIQUID_UK = nonSI(GALLON_UK.divide(160));
669
670     ///////////////
671
// Viscosity //
672
///////////////
673

674     /**
675      * A unit of dynamic viscosity equal to <code>1 g/(cm·s)</code>
676      * (cgs unit).
677      */

678     @SuppressWarnings JavaDoc("unchecked")
679     public static final Unit<DynamicViscosity>
680          POISE = nonSI((Unit<DynamicViscosity>) GRAM.divide(CENTI(METER).times(SECOND)));
681
682     /**
683      * A unit of kinematic viscosity equal to <code>1 cm²/s</code>
684      * (cgs unit).
685      */

686     @SuppressWarnings JavaDoc("unchecked")
687     public static final Unit<KinematicViscosity>
688          STOKE = nonSI((Unit<KinematicViscosity>) CENTI(METER).pow(2).divide(SECOND));
689     
690
691     ////////////
692
// Others //
693
////////////
694

695     /**
696      * A unit used to measure the ionizing ability of radiation
697      * (standard name <code>Roentgen</code>).
698      */

699     public static final Unit<?> ROENTGEN = nonSI(COULOMB.divide(KILOGRAM).times(2.58e-4));
700
701     
702     /////////////////////
703
// Collection View //
704
/////////////////////
705

706     /**
707      * Returns a read only view over the SI units defined in this class.
708      *
709      * @return the collection of SI units.
710      */

711     public static Set JavaDoc<Unit<?>> units() {
712         return Collections.unmodifiableSet(INSTANCES);
713     }
714
715     /**
716      * Adds a new unit to the collection.
717      *
718      * @param unit the unit being added.
719      * @return <code>unit</code>.
720      */

721     private static <U extends Unit> U nonSI(U unit) {
722         INSTANCES.add(unit);
723         return unit;
724     }
725
726
727 }
Popular Tags