KickJava   Java API By Example, From Geeks To Geeks.

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


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 number of times a specified phenomenon occurs
16  * within a specified interval. The system unit for this quantity is "1/s".
17  * By default, instances of this quantity are showed in Hertz ("Hz").
18  *
19  *
20  * @author <a HREF="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
21  * @version 1.0, October 24, 2004
22  */

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

28     private final static Unit<Frequency> UNIT = SI.HERTZ;
29
30     /**
31      * Holds the factory for this class.
32      */

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

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

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

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