public int compare(Schema schema, Criteria c, ITuple w1, int[] index1, ITuple w2,
int[] index2,Serializer[] serializers) {
for(int i = 0; i < c.getElements().size(); i++) {
Field field = schema.getField(i);
SortElement e = c.getElements().get(i);
Object o1 = w1.get(index1[i]);
Object o2 = w2.get(index2[i]);
Serializer serializer = (serializers == null) ? null : serializers[i];
int comparison = compareObjects(o1, o2, e.getCustomComparator(), field.getType(),serializer);
if(comparison != 0) {
return(e.getOrder() == Order.ASC ? comparison : -comparison);
}
}
return 0;
}