1 package com.stateofflow.eclipse.metrics.location.comparator;
2
3 import java.util.Comparator;
4
5 import com.stateofflow.eclipse.metrics.location.MetricLocation;
6
7 public abstract class LocationComparator implements Comparator<MetricLocation> {
8 public final int compare(final MetricLocation obj1, final MetricLocation obj2) {
9 return compareMetricLocation(obj1, obj2);
10 }
11
12 private int compareMetricLocation(final MetricLocation l1, final MetricLocation l2) {
13 int comparison = compareParticular(l1, l2);
14 if (comparison == 0) {
15 comparison = l1.compareTo(l2);
16 }
17
18 return comparison;
19 }
20
21 protected abstract int compareParticular(MetricLocation l1, MetricLocation l2);
22 }