KickJava   Java API By Example, From Geeks To Geeks.

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


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
11 import org.jscience.physics.units.SI;
12 import org.jscience.physics.units.Unit;
13
14 /**
15  * This class represents an electric charge. The system unit for this
16  * quantity is "s·A". By default, instances of this class are showed in
17  * Coulomb ("C").
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 ElectricCharge extends Quantity {
23
24     /**
25      * Holds the associated unit.
26      */

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

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

42     public final static ElectricCharge ZERO = Quantity.valueOf(0, UNIT);
43
44     /**
45      * Holds the elementary charge (positron charge).
46      */

47     public final static ElectricCharge ELEMENTARY = Quantity.valueOf(
48             1.602176462e-19, 0.000000063e-19, UNIT);
49
50     /**
51      * Default constructor (allows for derivation).
52      */

53     protected ElectricCharge() {
54     }
55
56     /**
57      * Shows {@link ElectricCharge} instances in the specified unit.
58      *
59      * @param unit the display unit for {@link ElectricCharge} instances.
60      */

61     public static void showAs(Unit unit) {
62         QuantityFormat.show(ElectricCharge.class, unit);
63     }
64
65     private static final long serialVersionUID = 1L;
66
67 }
68
Popular Tags