Search in sources :

Example 1 with LastUpdateComparator

use of org.onebusaway.admin.comparator.LastUpdateComparator in project onebusaway-application-modules by camsys.

the class VehicleStatusServiceImpl method sort.

@Override
public void sort(List<VehicleStatus> vehiclesPerPage, String field, String order) {
    VehicleSortFields sortField = VehicleSortFields.valueOf(field.toUpperCase());
    Comparator<VehicleStatus> fieldComparator = null;
    switch(sortField) {
        case VEHICLEID:
            fieldComparator = new VehicleIdComparator(order);
            break;
        case LASTUPDATE:
            fieldComparator = new LastUpdateComparator(order);
            break;
        case INFERREDPHASE:
            fieldComparator = new InferredPhaseComparator(order);
            break;
        case OBSERVEDDSC:
            fieldComparator = new ObservedDSCComparator(order);
            break;
        case PULLOUTTIME:
            fieldComparator = new PulloutTimeComparator(order);
            break;
        case PULLINTIME:
            fieldComparator = new PullinTimeComparator(order);
            break;
        default:
            fieldComparator = new VehicleIdComparator(order);
            break;
    }
    Collections.sort(vehiclesPerPage, fieldComparator);
}
Also used : PullinTimeComparator(org.onebusaway.admin.comparator.PullinTimeComparator) InferredPhaseComparator(org.onebusaway.admin.comparator.InferredPhaseComparator) PulloutTimeComparator(org.onebusaway.admin.comparator.PulloutTimeComparator) LastUpdateComparator(org.onebusaway.admin.comparator.LastUpdateComparator) VehicleIdComparator(org.onebusaway.admin.comparator.VehicleIdComparator) VehicleSortFields(org.onebusaway.admin.util.VehicleSortFields) ObservedDSCComparator(org.onebusaway.admin.comparator.ObservedDSCComparator) VehicleStatus(org.onebusaway.admin.model.ui.VehicleStatus)

Aggregations

InferredPhaseComparator (org.onebusaway.admin.comparator.InferredPhaseComparator)1 LastUpdateComparator (org.onebusaway.admin.comparator.LastUpdateComparator)1 ObservedDSCComparator (org.onebusaway.admin.comparator.ObservedDSCComparator)1 PullinTimeComparator (org.onebusaway.admin.comparator.PullinTimeComparator)1 PulloutTimeComparator (org.onebusaway.admin.comparator.PulloutTimeComparator)1 VehicleIdComparator (org.onebusaway.admin.comparator.VehicleIdComparator)1 VehicleStatus (org.onebusaway.admin.model.ui.VehicleStatus)1 VehicleSortFields (org.onebusaway.admin.util.VehicleSortFields)1