@Override
 public int compare(StudentModel o1, StudentModel o2) {
   if (o1.getGroupId() == o2.getGroupId()) {
     return o1.compareTo(o2);
   } else {
     return Integer.compare(o1.getGroupId(), o2.getGroupId());
   }
 }
 @Override
 public Object getValueAt(int rowIndex, int columnIndex) {
   StudentModel student = students.get(rowIndex);
   int val;
   switch (Columns.values()[columnIndex]) {
     case SURNAME:
       return student.getSurname();
     case GROUP:
       val = student.getGroupId();
       return val >= 0 ? val : "";
     case MATAN:
       val = student.getMarks().get(0);
       return val >= 0 ? val : "";
     case GA:
       val = student.getMarks().get(1);
       return val >= 0 ? val : "";
     case PROGRAMMING:
       val = student.getMarks().get(2);
       return val >= 0 ? val : "";
     case AVERAGE:
       double average = student.getAverage();
       return average >= 0 ? average : "";
     default:
       return null;
   }
 }
 @Override
 public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
   super.setValueAt(aValue, rowIndex, columnIndex);
   StudentModel student = students.get(rowIndex);
   String val = (String) aValue;
   try {
     switch (Columns.values()[columnIndex]) {
       case SURNAME:
         student.setSurname(val);
         break;
       case GROUP:
         student.setGroup(Integer.parseInt(val));
         break;
       case MATAN:
         student.getMarks().set(0, Integer.parseInt(val));
         break;
       case GA:
         student.getMarks().set(1, Integer.parseInt(val));
         break;
       case PROGRAMMING:
         student.getMarks().set(2, Integer.parseInt(val));
         break;
     }
     changeRows();
   } catch (NumberFormatException e) {
   }
 }