X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosMag.java;h=c350ae46392f4ddd637b58fe8f34c0c825a9faf1;hb=3c4278a29082a2af5911e22e59f8f52549f549e3;hp=1fa8877b9c639b4d1b5bdd714be5687424dd70be;hpb=00ae706dab6e8fddef4c5730a17c433a022228b7;p=fw%2Faltos diff --git a/altoslib/AltosMag.java b/altoslib/AltosMag.java index 1fa8877b..c350ae46 100644 --- a/altoslib/AltosMag.java +++ b/altoslib/AltosMag.java @@ -15,16 +15,17 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_5; +package org.altusmetrum.altoslib_11; import java.util.concurrent.*; +import java.io.*; -public class AltosMag implements Cloneable { +public class AltosMag implements Cloneable, AltosHashable { public int along; public int across; public int through; - public static double counts_per_gauss = 1090; + public static final double counts_per_gauss = 1090; public static double convert_gauss(double counts) { return counts / counts_per_gauss; @@ -92,4 +93,28 @@ public class AltosMag implements Cloneable { break; } } + + public AltosHashSet hashSet() { + AltosHashSet h = new AltosHashSet(); + + h.putInt("along", along); + h.putInt("across", across); + h.putInt("through", through); + return h; + } + + public AltosMag(AltosHashSet h) { + this(); + + along = h.getInt("along", along); + across = h.getInt("across", across); + through = h.getInt("through", through); + } + + public static AltosMag fromHashSet(AltosHashSet h, AltosMag def) { + if (h == null) + return def; + + return new AltosMag(h); + } }