KickJava   Java API By Example, From Geeks To Geeks.

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


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 a distance traveled divided by the time of travel.
15  * The system unit for this quantity is "m/s".
16  *
17  * @author <a HREF="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
18  * @version 1.0, October 24, 2004
19  */

20 public class Velocity extends Quantity {
21
22     /**
23      * Holds the associated unit.
24      */

25     private final static Unit<Velocity> UNIT = SI.METER_PER_SECOND;
26
27     /**
28      * Holds the factory for this class.
29      */

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

40     public final static Velocity ZERO = Quantity.valueOf(0, UNIT);
41
42     /**
43      * Holds the speed of light in vacuum (exact).
44      */

45     public final static Velocity SPEED_OF_LIGHT = Quantity.valueOf(299792458, UNIT);
46
47     /**
48      * Default constructor (allows for derivation).
49      */

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

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