KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jscience > physics > models > StandardModel


1 /*
2  * JScience - Java(TM) Tools and Libraries for the Advancement of Sciences.
3  * Copyright (C) 2006 - 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.models;
10
11 import javax.measure.converters.UnitConverter;
12 import javax.measure.units.BaseUnit;
13 import javax.measure.units.Dimension;
14
15 /**
16  * This class represents the standard model.
17  *
18  * @author <a HREF="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a>
19  * @version 3.1, April 22, 2006
20  */

21 public class StandardModel extends PhysicalModel {
22
23     /**
24      * Holds the single instance of this class.
25      */

26     final static StandardModel INSTANCE = new StandardModel();
27
28     /**
29      * Default constructor (allows for derivation).
30      */

31     protected StandardModel() {
32     }
33
34     /**
35      * Selects the standard model as the current model.
36      */

37     public static void select() {
38         PhysicalModel.setCurrent(INSTANCE);
39     }
40
41     // Implements Dimension.Model
42
public Dimension getDimension(BaseUnit unit) {
43         return Dimension.Model.STANDARD.getDimension(unit);
44     }
45
46     // Implements Dimension.Model
47
public UnitConverter getTransform(BaseUnit unit) {
48         return Dimension.Model.STANDARD.getTransform(unit);
49     }
50
51 }
Popular Tags