From ea7cb8eb1d250988092ebc72fd71dff0f30c7421 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Mon, 22 Feb 2016 12:42:03 +0100 Subject: added comparator for locations --- .../java/org/openslx/thrifthelper/Comparators.java | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/openslx/thrifthelper/Comparators.java b/src/main/java/org/openslx/thrifthelper/Comparators.java index 9f068c2..ec42966 100644 --- a/src/main/java/org/openslx/thrifthelper/Comparators.java +++ b/src/main/java/org/openslx/thrifthelper/Comparators.java @@ -4,6 +4,7 @@ import java.util.Comparator; import org.openslx.bwlp.thrift.iface.ImageSummaryRead; import org.openslx.bwlp.thrift.iface.ImageVersionDetails; +import org.openslx.bwlp.thrift.iface.Location; import org.openslx.bwlp.thrift.iface.OperatingSystem; import org.openslx.bwlp.thrift.iface.Organization; import org.openslx.bwlp.thrift.iface.UserInfo; @@ -88,16 +89,16 @@ public class Comparators } }; -// public static final Comparator location = new Comparator() { -// @Override -// public int compare( Location o1, Location o2 ) -// { -// if ( o1 == null || o1.loca == null ) -// return o2 == null || o2.organizationId == null ? 0 : 1; -// if ( o2 == null || o2.organizationId == null ) -// return -1; -// return o1.organizationId.compareTo( o2.organizationId ); -// } -// }; + public static final Comparator location = new Comparator() { + @Override + public int compare( Location o1, Location o2 ) + { + if ( o1 == null || o1.locationName == null ) + return o2 == null || o2.locationName == null ? 0 : 1; + if ( o2 == null || o2.locationName == null ) + return -1; + return o1.locationName.compareTo( o2.locationName ); + } + }; } -- cgit v1.2.3-55-g7522