From c9ab9a9c6f1c22ebf29c3e6c31954a5457e01b7c Mon Sep 17 00:00:00 2001
From: Brandon Clayton <bclayton@usgs.gov>
Date: Thu, 21 Jul 2022 16:05:31 -0600
Subject: [PATCH] add compare to

---
 .../java/gov/usgs/earthquake/nshmp/netcdf/Netcdf.java     | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/lib/src/main/java/gov/usgs/earthquake/nshmp/netcdf/Netcdf.java b/src/lib/src/main/java/gov/usgs/earthquake/nshmp/netcdf/Netcdf.java
index 65f9f2d..1a5b58c 100644
--- a/src/lib/src/main/java/gov/usgs/earthquake/nshmp/netcdf/Netcdf.java
+++ b/src/lib/src/main/java/gov/usgs/earthquake/nshmp/netcdf/Netcdf.java
@@ -18,7 +18,7 @@ import gov.usgs.earthquake.nshmp.netcdf.reader.Reader;
  *
  * @author U.S. Geological Survey
  */
-public abstract class Netcdf<T> {
+public abstract class Netcdf<T> implements Comparable<Netcdf<T>> {
 
   protected final Path netcdfPath;
   protected final NetcdfData netcdfData;
@@ -84,5 +84,11 @@ public abstract class Netcdf<T> {
    */
   public abstract T staticData(Location site, NehrpSiteClass siteClass);
 
+  @Override
+  public int compareTo(Netcdf<T> that) {
+    return this.netcdfData().scienceBaseMetadata().label
+        .compareTo(that.netcdfData().scienceBaseMetadata().label);
+  }
+
   abstract Reader getNetcdfData(Path netcdfPath);
 }
-- 
GitLab