Initial commit
[debian/openrocket] / src / net / sf / openrocket / gui / plot / Axis.java
1 package net.sf.openrocket.gui.plot;
2
3 public class Axis implements Cloneable {
4
5         private double minValue = Double.NaN;
6         private double maxValue = Double.NaN;
7         
8         
9         
10         public void addBound(double value) {
11                 
12                 if (value < minValue  ||  Double.isNaN(minValue)) {
13                         minValue = value;
14                 }
15                 if (value > maxValue  ||  Double.isNaN(maxValue)) {
16                         maxValue = value;
17                 }
18                 
19         }
20         
21         
22         public double getMinValue() {
23                 return minValue;
24         }
25         
26         public double getMaxValue() {
27                 return maxValue;
28         }
29         
30         public double getRangeLength() {
31                 return maxValue - minValue;
32         }
33         
34         public void reset() {
35                 minValue = Double.NaN;
36                 maxValue = Double.NaN;
37         }
38         
39         
40         
41         @Override
42         public Axis clone() {
43                 try {
44                         
45                         return (Axis) super.clone();
46                         
47                 } catch (CloneNotSupportedException e) {
48                         throw new RuntimeException("BUG! Could not clone().");
49                 }
50         }
51         
52 }