if (def.getBaseUnit() == null)
throw new IllegalArgumentException("basePeriod");
if (def.getSubPeriodPattern() != null && !def.getBaseUnit().equals(def.getSubPeriodPattern().getBasePeriod()))
throw new IllegalArgumentException("basePeriods differ");
// step 1: find domain matching required attributes
TimeDomain domain = getTimeDomain(def);
// step 2: if not found, verify that label is available, then create new domain
if (domain == null) {
if (def.getLabel() == null) {
def.setLabel(inventLabel());
} else {
domain = domains.get(def.getLabel());
if (domain != null) {
Exception cause = T2Msg.exception(K.T0007, domain.toString());
throw T2Msg.runtimeException(K.T0001, cause);
}
}
ExternalTimeFormat externalFormat = getExternalTimeFormat();
if (externalFormat == null)