for (int i = 0; i < field.length; i++) {
fieldRight[i] = formatRight.getField(field[i]);
}
}
for (int i = 0; i < field.length; i++) {
final ValueObject vLeft = left.getValue(fieldLeft[i]);
final ValueObject vRight = right.getValue(fieldRight[i]);
boolean asc = ascending == null || ascending[i];
if (vLeft == vRight) {
continue;
}
if (vLeft == null) {
return asc ? 1 : -1;
}
if (vRight == null) {
return asc ? -1 : 1;
}
final ValueObject.TYPE tLeft = vLeft.getObjectType();
final ValueObject.TYPE tRight = vRight.getObjectType();
if (tLeft != tRight || tLeft == ValueObject.TYPE.STRING) {
final int val = vLeft.toString().compareTo(vRight.toString());
if (val != 0) {
return asc ? val : -val;
} else {
continue;
}
}
int val = defaultValue;
switch (tLeft) {
case FLOAT:
final double vl = vLeft.asDouble().getDouble();
final double vr = vRight.asDouble().getDouble();
if (vl != vr) {
val = vl > vr ? 1 : -1;
}
break;
case INT:
final long il = vLeft.asLong().getLong();
final long ir = vRight.asLong().getLong();
if (il != ir) {
val = il > ir ? 1 : -1;
}
break;
}