public int compare(Viewer viewer, Object o1, Object o2) {

    Order order1 = (Order) o1;
    Order order2 = (Order) o2;
  
    int result = 0;
    switch (criteria) {
    case OrderTableLabelProvider.ORDER_NUMBER_COLUMN_IND:
      result = AssemblyMonitoring.sortString(order1.getOrderNumber(),
          order2.getOrderNumber());
      break;
    case OrderTableLabelProvider.ITEM_NUMBER_COLUMN_IND:
      result = AssemblyMonitoring.sortString(order1.getItemNumber(),
          order2.getItemNumber());
      break;
    case OrderTableLabelProvider.MACHINE_ID_COLUMN_IND:
      result = AssemblyMonitoring.sortString(order1.getMachineId(),
          order2.getMachineId());
      break;
    case OrderTableLabelProvider.DATE_COLUMN_IND:
      result = AssemblyMonitoring.sortDate(order1.getDate(), order2
          .getDate());
      break;
    case OrderTableLabelProvider.NUM_PLANED_ITEMS_COLUMN_IND:
      result = AssemblyMonitoring.sortInt(order1.getNumItemsPlanned(),
          order2.getNumItemsPlanned());
      break;
    case OrderTableLabelProvider.CYCLE_COLUMN_IND:
      result = AssemblyMonitoring.sortDouble(order1.getCycle(),
          order2.getCycle());
      break;
    case OrderTableLabelProvider.NUM_ACTIVE_CAVITIES_COLUMN_IND:
      result = AssemblyMonitoring.sortInt(order1.getNumActiveCavities(),
          order2.getNumActiveCavities());
      break;
    case OrderTableLabelProvider.SHIFT_COLUMN_IND:
      result = AssemblyMonitoring.sortInt(order1.getShift(),
          order2.getShift());
      break;
    default:
      break;
    }

    result = this.order * result;
    
    return result;
  }