throw new IllegalArgumentException("rhs");
}
if (lhs.getTModelInstanceInfo().isEmpty() || rhs.getTModelInstanceInfo().isEmpty()) {
throw new IllegalArgumentException("no data to compare");
}
InstanceDetails lhsc = null;
InstanceDetails rhsc = null;
for (int i = 0; i < lhs.getTModelInstanceInfo().size(); i++) {
if (lhs.getTModelInstanceInfo().get(i).getTModelKey().equalsIgnoreCase(compareField)) {
lhsc = lhs.getTModelInstanceInfo().get(i).getInstanceDetails();
}
}
for (int i = 0; i < rhs.getTModelInstanceInfo().size(); i++) {
if (rhs.getTModelInstanceInfo().get(i).getTModelKey().equalsIgnoreCase(compareField)) {
rhsc = rhs.getTModelInstanceInfo().get(i).getInstanceDetails();
}
}
if (lhsc == null) {
throw new IllegalArgumentException(compareField + " not found for lhs");
}
if (rhsc == null) {
throw new IllegalArgumentException(compareField + " not found for rhs");
}
if (lhsc.getInstanceParms() == null) {
throw new IllegalArgumentException(compareField + " found lhs, but no data");
}
if (rhsc.getInstanceParms() == null) {
throw new IllegalArgumentException(compareField + " found rhs, but no data");
}
if (isNumber) {
Double l = Double.parseDouble(lhsc.getInstanceParms());
Double r = Double.parseDouble(rhsc.getInstanceParms());
return l.compareTo(r);
}
if (isDate) {
XMLGregorianCalendar l = fac.newXMLGregorianCalendar(lhsc.getInstanceParms());
XMLGregorianCalendar r = fac.newXMLGregorianCalendar(rhsc.getInstanceParms());
//System.out.println(l.toXMLFormat() + " " + r.toXMLFormat());
int x = l.compare(r);
if (x == DatatypeConstants.LESSER) {
return -1;
}
if (x == DatatypeConstants.GREATER) {
return 1;
}
if (x == DatatypeConstants.EQUAL) {
return 0;
}
throw new ArrayIndexOutOfBoundsException("cannot compare, result was " + x);
}
if (isDuration) {
Duration l = fac.newDuration(lhsc.getInstanceParms());
Duration r = fac.newDuration(rhsc.getInstanceParms());
// System.out.println(l.toString() + " " + r.toString());
int x = l.compare(r);
if (x == DatatypeConstants.LESSER) {
return -1;