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 /*** Holds the ray parameter, time and distance increments, and optionally
31 * a depth, for a ray passing through some layer.
32 *
33 * @version 1.1.3 Wed Jul 18 15:00:35 GMT 2001
34
35
36
37 * @author H. Philip Crotwell
38 */
39 public class TimeDist implements Cloneable {
40 public double p;
41 public double depth;
42 public double time;
43 public double dist;
44
45 public TimeDist() {
46 this.p = 0;
47 this.depth = 0;
48 this.time = 0;
49 this.dist = 0;
50 }
51
52 public TimeDist(double p) {
53 this.p = p;
54 this.depth = 0;
55 this.time = 0;
56 this.dist = 0;
57 }
58
59 public TimeDist(double p, double time, double dist) {
60 this.p = p;
61 this.depth = 0;
62 this.time = time;
63 this.dist = dist;
64 }
65
66 public TimeDist(double p, double time, double dist, double depth) {
67 this.p = p;
68 this.depth = depth;
69 this.time = time;
70 this.dist = dist;
71 }
72
73 public void add(TimeDist td) {
74 this.time += td.time;
75 this.dist += td.dist;
76 }
77
78 public String toString() {
79 String desc = "p= "+p+" time="+time+" dist="+dist+" depth="+depth;
80 return desc;
81 }
82
83 public Object clone() {
84 try {
85 return super.clone();
86 } catch (CloneNotSupportedException e) {
87 // Can't happen, but...
88 throw new InternalError(e.toString());
89 }
90 }
91 }