+
+ public AltosDistance() {
+ range_metric = new AltosUnitsRange[2];
+
+ range_metric[0] = new AltosUnitsRange(0, "m", "meters") {
+ double value(double v) {
+ return v;
+ }
+ int show_fraction(int width) {
+ return width / 9;
+ }
+ int say_fraction() {
+ return 0;
+ }
+ };
+ range_metric[1] = new AltosUnitsRange(2000, "km", "kilometers") {
+ double value(double v) {
+ return v / 1000;
+ }
+ int show_fraction(int width) {
+ return width / 5;
+ }
+ int say_fraction() {
+ return 1;
+ }
+ };
+
+ range_imperial = new AltosUnitsRange[2];
+
+ range_imperial[0] = new AltosUnitsRange(0, "ft", "feet") {
+ double value(double v) {
+ return AltosConvert.meters_to_feet(v);
+ }
+ int show_fraction(int width) {
+ return width / 9;
+ }
+ int say_fraction() {
+ return 0;
+ }
+ };
+
+ range_imperial[1] = new AltosUnitsRange(AltosConvert.feet_to_meters(5280),
+ "mi", "miles") {
+ double value(double v) {
+ return AltosConvert.meters_to_miles(v);
+ }
+ int show_fraction(int width) {
+ return width / 5;
+ }
+ int say_fraction() {
+ return 1;
+ }
+ };
+ }
+}