Initial commit
[debian/openrocket] / src / net / sf / openrocket / unit / DegreeUnit.java
1 package net.sf.openrocket.unit;
2
3 import java.text.DecimalFormat;
4
5 public class DegreeUnit extends GeneralUnit {
6
7         public DegreeUnit() {
8                 super(Math.PI/180.0,"\u00b0");
9         }
10
11         @Override
12         public boolean hasSpace() {
13                 return false;
14         }
15
16         @Override
17         public double round(double v) {
18                 return Math.rint(v);
19         }
20
21         private final DecimalFormat decFormat = new DecimalFormat("0.#");
22         @Override
23         public String toString(double value) {
24                 double val = toUnit(value);
25                 return decFormat.format(val);
26         }
27 }