int compareResols = getTimeDomain().getResolution().compareTo(otherTime.getTimeDomain().getResolution());
if (compareResols == 0) {
// convert both to unrestricted domain
TimeDomainDefinition def = new TimeDomainDefinition(null, getTimeDomain().getResolution(), 0L);
TimeDomain unrestrictedDomain = TimeDomainManager.getFactory().get(def, true);
TimeIndex converted = convertOrThrowRTE(unrestrictedDomain, this);
TimeIndex otherConverted = convertOrThrowRTE(unrestrictedDomain, otherTime);
return converted.compareTo(otherConverted);
} else if (compareResols < 0) {
// convert both to highest resolution
TimeDomainDefinition def = new TimeDomainDefinition(null, otherTime.getTimeDomain().getResolution(), 0L);
TimeDomain unrestrictedDomain = TimeDomainManager.getFactory().get(def, true);
TimeIndex converted = convertOrThrowRTE(unrestrictedDomain, this);
return converted.compareTo(otherTime);
} else {
// convert both to highest resolution
TimeDomainDefinition def = new TimeDomainDefinition(null, getTimeDomain().getResolution(), 0L);
TimeDomain unrestrictedDomain = TimeDomainManager.getFactory().get(def, true);
TimeIndex otherConverted = convertOrThrowRTE(unrestrictedDomain, otherTime);
return compareTo(otherConverted);
}
}
}