From c309c71b84aed5d5219332afb99263546ae5bea4 Mon Sep 17 00:00:00 2001 From: Anton Romanov Date: Tue, 19 Apr 2022 22:19:49 +0400 Subject: [PATCH] #3 -- fix comparator --- src/main/java/ru/ulstu/db/model/TimeSeriesMeta.java | 7 ++++++- src/main/java/ru/ulstu/db/model/TimeSeriesSet.java | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/ru/ulstu/db/model/TimeSeriesMeta.java b/src/main/java/ru/ulstu/db/model/TimeSeriesMeta.java index 6e92adb..05b4fda 100644 --- a/src/main/java/ru/ulstu/db/model/TimeSeriesMeta.java +++ b/src/main/java/ru/ulstu/db/model/TimeSeriesMeta.java @@ -2,7 +2,7 @@ package ru.ulstu.db.model; import ru.ulstu.datamodel.ts.TimeSeries; -public class TimeSeriesMeta { +public class TimeSeriesMeta implements Comparable { private String key; private int size; private boolean hasDateTime; @@ -31,4 +31,9 @@ public class TimeSeriesMeta { public boolean isHasDateTime() { return hasDateTime; } + + @Override + public int compareTo(TimeSeriesMeta o) { + return o != null ? key.compareTo(o.getKey()) : 0; + } } diff --git a/src/main/java/ru/ulstu/db/model/TimeSeriesSet.java b/src/main/java/ru/ulstu/db/model/TimeSeriesSet.java index 5dbbfbf..8decb21 100644 --- a/src/main/java/ru/ulstu/db/model/TimeSeriesSet.java +++ b/src/main/java/ru/ulstu/db/model/TimeSeriesSet.java @@ -2,7 +2,7 @@ package ru.ulstu.db.model; import java.io.File; -public class TimeSeriesSet { +public class TimeSeriesSet implements Comparable { private final String key; public TimeSeriesSet(File dir) { @@ -16,4 +16,9 @@ public class TimeSeriesSet { public String getKey() { return key; } + + @Override + public int compareTo(TimeSeriesSet o) { + return o != null ? key.compareTo(o.getKey()) : 0; + } }