GDate min = null, max = null;
// Find the min and the max according to the type
switch (sType.getPrimitiveType().getBuiltinTypeCode()) {
case SchemaType.BTC_DATE_TIME: {
XmlDateTime x = (XmlDateTime) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
if (x != null) {
min = x.getGDateValue();
}
x = (XmlDateTime) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
if (x != null) {
if (min == null || min.compareToGDate(x.getGDateValue()) <= 0) {
min = x.getGDateValue();
}
}
x = (XmlDateTime) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
if (x != null) {
max = x.getGDateValue();
}
x = (XmlDateTime) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
if (x != null) {
if (max == null || max.compareToGDate(x.getGDateValue()) >= 0) {
max = x.getGDateValue();
}
}
break;
}
case SchemaType.BTC_TIME: {
XmlTime x = (XmlTime) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
if (x != null) {
min = x.getGDateValue();
}
x = (XmlTime) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
if (x != null) {
if (min == null || min.compareToGDate(x.getGDateValue()) <= 0) {
min = x.getGDateValue();
}
}
x = (XmlTime) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
if (x != null) {
max = x.getGDateValue();
}
x = (XmlTime) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
if (x != null) {
if (max == null || max.compareToGDate(x.getGDateValue()) >= 0) {
max = x.getGDateValue();
}
}
break;
}
case SchemaType.BTC_DATE: {
XmlDate x = (XmlDate) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
if (x != null) {
min = x.getGDateValue();
}
x = (XmlDate) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
if (x != null) {
if (min == null || min.compareToGDate(x.getGDateValue()) <= 0) {
min = x.getGDateValue();
}
}
x = (XmlDate) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
if (x != null) {
max = x.getGDateValue();
}
x = (XmlDate) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
if (x != null) {
if (max == null || max.compareToGDate(x.getGDateValue()) >= 0) {
max = x.getGDateValue();
}
}
break;
}
case SchemaType.BTC_G_YEAR_MONTH: {
XmlGYearMonth x = (XmlGYearMonth) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
if (x != null) {
min = x.getGDateValue();
}
x = (XmlGYearMonth) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
if (x != null) {
if (min == null || min.compareToGDate(x.getGDateValue()) <= 0) {
min = x.getGDateValue();
}
}
x = (XmlGYearMonth) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
if (x != null) {
max = x.getGDateValue();
}
x = (XmlGYearMonth) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
if (x != null) {
if (max == null || max.compareToGDate(x.getGDateValue()) >= 0) {
max = x.getGDateValue();
}
}
break;
}
case SchemaType.BTC_G_YEAR: {
XmlGYear x = (XmlGYear) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
if (x != null) {
min = x.getGDateValue();
}
x = (XmlGYear) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
if (x != null) {
if (min == null || min.compareToGDate(x.getGDateValue()) <= 0) {
min = x.getGDateValue();
}
}
x = (XmlGYear) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
if (x != null) {
max = x.getGDateValue();
}
x = (XmlGYear) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
if (x != null) {
if (max == null || max.compareToGDate(x.getGDateValue()) >= 0) {
max = x.getGDateValue();
}
}
break;
}
case SchemaType.BTC_G_MONTH_DAY: {
XmlGMonthDay x = (XmlGMonthDay) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
if (x != null) {
min = x.getGDateValue();
}
x = (XmlGMonthDay) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
if (x != null) {
if (min == null || min.compareToGDate(x.getGDateValue()) <= 0) {
min = x.getGDateValue();
}
}
x = (XmlGMonthDay) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
if (x != null) {
max = x.getGDateValue();
}
x = (XmlGMonthDay) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
if (x != null) {
if (max == null || max.compareToGDate(x.getGDateValue()) >= 0) {
max = x.getGDateValue();
}
}
break;
}
case SchemaType.BTC_G_DAY: {
XmlGDay x = (XmlGDay) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
if (x != null) {
min = x.getGDateValue();
}
x = (XmlGDay) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
if (x != null) {
if (min == null || min.compareToGDate(x.getGDateValue()) <= 0) {
min = x.getGDateValue();
}
}
x = (XmlGDay) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
if (x != null) {
max = x.getGDateValue();
}
x = (XmlGDay) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
if (x != null) {
if (max == null || max.compareToGDate(x.getGDateValue()) >= 0) {
max = x.getGDateValue();
}
}
break;
}
case SchemaType.BTC_G_MONTH: {
XmlGMonth x = (XmlGMonth) sType.getFacet(SchemaType.FACET_MIN_INCLUSIVE);
if (x != null) {
min = x.getGDateValue();
}
x = (XmlGMonth) sType.getFacet(SchemaType.FACET_MIN_EXCLUSIVE);
if (x != null) {
if (min == null || min.compareToGDate(x.getGDateValue()) <= 0) {
min = x.getGDateValue();
}
}
x = (XmlGMonth) sType.getFacet(SchemaType.FACET_MAX_INCLUSIVE);
if (x != null) {
max = x.getGDateValue();
}
x = (XmlGMonth) sType.getFacet(SchemaType.FACET_MAX_EXCLUSIVE);
if (x != null) {
if (max == null || max.compareToGDate(x.getGDateValue()) >= 0) {
max = x.getGDateValue();
}
}
break;
}
}