Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/classes/SortSobs.cls
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ public class SortSobs{
//infer sort type
BaseSOBQuickSort quickSort;
Schema.SoapType sType = sortField.getDescribe().getSoapType();
if(sType == Schema.SoapType.Integer || sType == Schema.SoapType.Double || sType == Schema.SoapType.Time){
if(sType == Schema.SoapType.Integer || sType == Schema.SoapType.Double){
quickSort = new DecimalSOBQuicksort();
}else if(sType == Schema.SoapType.String || sType == Schema.SoapType.Id || sType == Schema.SoapType.Base64binary){
}else if(sType == Schema.SoapType.Time) {
quickSort = new TimeSOBQuicksort();
}
else if(sType == Schema.SoapType.String || sType == Schema.SoapType.Id || sType == Schema.SoapType.Base64binary){
quickSort = new StringSOBQuicksort();
}else if(sType == Schema.SoapType.Date || sType == Schema.SoapType.DateTime){
quickSort = new DatetimeSOBQuicksort();
Expand Down Expand Up @@ -107,6 +110,17 @@ public class SortSobs{
}
}

private class TimeSOBQuicksort extends BaseSOBQuickSort{

private override Integer compareToPivot(Object value, Object pivot){
Time val = (Time)value;
Time piv = (Time)pivot;
if(val == piv){ return 0; }
if(val > piv){ return 1; }
return -1;
}
}

private class StringSOBQuicksort extends BaseSOBQuickSort{

private override Integer compareToPivot(Object value, Object pivot){
Expand Down Expand Up @@ -217,4 +231,4 @@ public class SortSobs{
sobs[j] = temp;
}
}
}
}