View Javadoc

1   /*
2     The TauP Toolkit: Flexible Seismic Travel-Time and Raypath Utilities.
3     Copyright (C) 1998-2000 University of South Carolina
4   
5     This program is free software; you can redistribute it and/or
6     modify it under the terms of the GNU General Public License
7     as published by the Free Software Foundation; either version 2
8     of the License, or (at your option) any later version.
9   
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14  
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18  
19    The current version can be found at 
20    <A HREF="www.seis.sc.edu">http://www.seis.sc.edu</A>
21  
22    Bug reports and comments should be directed to 
23    H. Philip Crotwell, crotwell@seis.sc.edu or
24    Tom Owens, owens@seis.sc.edu
25  
26  */
27  
28  package edu.sc.seis.TauP;
29  
30  import java.util.Properties;
31  
32  /***
33   * Outputs.java contains formating, similar to printf, routines for
34   * the output types in the TauP package.
35   *
36   *
37   * Created: Tue Sep 21 11:45:35 1999
38   *
39   * @author Philip Crotwell
40   * @version 1.1.3 Wed Jul 18 15:00:35 GMT 2001
41  
42  
43  
44   */
45  
46  public class Outputs  {
47      
48      public Outputs(Properties props) {
49          String formString;
50  
51          formString = "%8."+props.getProperty("taup.depth.precision", "1")+"f";
52          depthFormat = new Format(formString);
53  
54          formString ="%8."+props.getProperty("taup.distance.precision","2")+"f";
55          distanceFormat = new Format(formString);
56  
57          formString = "%8."+props.getProperty("taup.time.precision", "2")+"f";
58          timeFormat = new Format(formString);
59  
60          formString ="%8."+props.getProperty("taup.rayparam.precision","3")+"f";
61          rayParamFormat = new Format(formString);
62  
63          formString ="%8."+props.getProperty("taup.latlon.precision","2")+"f";
64          latLonFormat = new Format(formString);
65      }
66      
67      public String formatDepth(double depth) {
68          return depthFormat.form(depth);
69      }
70  
71      public String formatDistance(double distance) {
72          return distanceFormat.form(distance);
73      }
74  
75      public String formatTime(double time) {
76          return timeFormat.form(time);
77      }
78  
79      public String formatRayParam(double rayParam) {
80          return rayParamFormat.form(rayParam);
81      }
82      
83      public String formatLatLon(double latlon) {
84          return latLonFormat.form(latlon);
85      }
86  
87      protected Format depthFormat;
88  
89      protected Format distanceFormat;
90  
91      protected Format timeFormat;
92  
93      protected Format rayParamFormat;
94  
95      protected Format latLonFormat;
96  
97  
98  
99  } // Outputs