KickJava   Java API By Example, From Geeks To Geeks.

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


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 the moment of a force. The system unit for this
16  * quantity is "N·m".
17  * <p> Note: The Newton-metre ("N·m") is also a way of exressing a Joule (unit
18  * of energy). However, torque is not energy. So, to avoid confusion, we
19  * will use the units "N·m" for torque and not "J". This distinction occurs
20  * due to the scalar nature of energy and the vector nature of torque.</p>
21  *
22  * @author <a HREF="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
23  * @version 1.0, October 24, 2004
24  */

25 public class Torque extends Quantity {
26
27     /**
28      * Holds the associated unit.
29      */

30     private final static Unit<Torque> UNIT = SI.NEWTON.times(SI.METER);
31
32     /**
33      * Holds the factory for this class.
34      */

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

44     public final static Torque ZERO = Quantity.valueOf(0, UNIT);
45
46     /**
47      * Default constructor (allows for derivation).
48      */

49     protected Torque() {
50     }
51
52     /**
53      * Shows {@link Torque} instances in the specified unit.
54      *
55      * @param unit the display unit for {@link Torque} instances.
56      */

57     public static void showAs(Unit unit) {
58         QuantityFormat.show(Torque.class, unit);
59     }
60
61     private static final long serialVersionUID = 1L;
62
63 }
64
Popular Tags