KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jscience > physics > quantities > Mass


1 /*
2  * JScience - Java(TM) Tools and Libraries for the Advancement of Sciences.
3  * Copyright (C) 2005 - 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 org.jscience.physics.quantities;
10 import org.jscience.physics.units.SI;
11 import org.jscience.physics.units.Unit;
12
13 /**
14  * This class represents the measure of the quantity of matter that a body
15  * or an object contains. The mass of the body is not dependent on gravity
16  * and therefore is different from but proportional to its weight.
17  * The system unit for this quantity is "kg" (Système International d'Unités).
18  *
19  * @author <a HREF="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
20  * @version 1.0, October 24, 2004
21  */

22 public class Mass extends Quantity {
23
24     /**
25      * Holds the associated unit.
26      */

27     private final static Unit<Mass> UNIT = SI.KILOGRAM;
28
29     /**
30      * Holds the factory for this class.
31      */

32     private final static Factory<Mass> FACTORY = new Factory<Mass>(
33             UNIT) {
34         protected Mass create() {
35             return new Mass();
36         }
37     };
38
39     /**
40      * Represents a {@link Mass} amounting to nothing.
41      */

42     public final static Mass ZERO = Quantity.valueOf(0, UNIT);
43
44     /**
45      * Holds the electron rest mass.
46      */

47     public final static Mass ELECTRON
48         = Quantity.valueOf(9.10938188e-31, 0.00000072e-31, SI.KILOGRAM);
49
50     /**
51      * Holds the proton rest mass.
52      */

53     public final static Mass PROTON
54         = Quantity.valueOf(1.67262158e-27, 0.00000013e-27, SI.KILOGRAM);
55
56     /**
57      * Holds the neutron rest mass.
58      */

59     public final static Mass NEUTRON
60         = Quantity.valueOf(1.67492716e-27, 0.00000013e-27, SI.KILOGRAM);
61
62     /**
63      * Holds the deuteron rest mass.
64      */

65     public final static Mass DEUTERON
66         = Quantity.valueOf(3.34358309e-27, 0.00000026e-27, SI.KILOGRAM);
67
68     /**
69      * Holds the muon rest mass.
70      */

71     public final static Mass MUON
72         = Quantity.valueOf(1.88353109e-28, 0.00000016e-28, SI.KILOGRAM);
73
74     /**
75      * Default constructor (allows for derivation).
76      */

77     protected Mass() {
78     }
79
80     /**
81      * Shows {@link Mass} instances in the specified unit.
82      *
83      * @param unit the display unit for {@link Mass} instances.
84      */

85     public static void showAs(Unit unit) {
86         QuantityFormat.show(Mass.class, unit);
87     }
88
89     private static final long serialVersionUID = 1L;
90
91 }
92
Popular Tags