Eliseev E.E. LabWork08 #8

Closed
ElEgEv wants to merge 11 commits from LabWork08 into LabWork07
5 changed files with 121 additions and 24 deletions
Showing only changes of commit dbd9d1089a - Show all commits

View File

@ -71,3 +71,75 @@ INFO FormMapWithSetPlanesGeneric:239 - Добавлен объект: DrawningO
INFO FormMapWithSetPlanesGeneric:239 - Добавлен объект: DrawningObjectPlane@354749cd 05-12-2022
INFO FormMapWithSetPlanesGeneric:239 - Добавлен объект: DrawningObjectPlane@25e737a1 05-12-2022
INFO FormMapWithSetPlanesGeneric:239 - Добавлен объект: DrawningObjectPlane@7ac63c8b 05-12-2022
INFO FormMapWithSetPlanesGeneric:158 - Добавлена карта 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@21a0d18b 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@5f7057c6 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@7e084f46 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@37f89bd9 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@5cd396ed 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:158 - Добавлена карта 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:158 - Добавлена карта 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@2e55f328 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@33d68201 06-12-2022
INFO FormMapWithSetPlanesGeneric:158 - Добавлена карта 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@1cb68793 06-12-2022
INFO FormMapWithSetPlanesGeneric:295 - Oбъект удалён: DrawningObjectPlane@1cb68793 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@5e20224b 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@33c58563 06-12-2022
INFO FormMapWithSetPlanesGeneric:158 - Добавлена карта 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@fcbc9e9 06-12-2022
INFO FormMapWithSetPlanesGeneric:242 - Не удалось добавить объект: DrawningObjectPlane@22eabf8b 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@77e7d15d 06-12-2022
INFO FormMapWithSetPlanesGeneric:242 - Не удалось добавить объект: DrawningObjectPlane@104eb471 06-12-2022
INFO FormMapWithSetPlanesGeneric:295 - Oбъект удалён: DrawningObjectPlane@fcbc9e9 06-12-2022
INFO FormMapWithSetPlanesGeneric:295 - Oбъект удалён: DrawningObjectPlane@77e7d15d 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@e57c8e9 06-12-2022
INFO FormMapWithSetPlanesGeneric:242 - Не удалось добавить объект: DrawningObjectPlane@4811e9b0 06-12-2022
INFO FormMapWithSetPlanesGeneric:158 - Добавлена карта 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@77ff5301 06-12-2022
INFO FormMapWithSetPlanesGeneric:242 - Не удалось добавить объект: DrawningObjectPlane@1e83f53b 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@120b338c 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@54cc054b 06-12-2022
INFO FormMapWithSetPlanesGeneric:158 - Добавлена карта 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@1fb9c948 06-12-2022
INFO FormMapWithSetPlanesGeneric:242 - Не удалось добавить объект: DrawningObjectPlane@68d425f5 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@2ed3e394 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@67eb0c19 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@4f7229fd 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@1eaede67 06-12-2022
INFO FormMapWithSetPlanesGeneric:158 - Добавлена карта 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@489057b1 06-12-2022
INFO FormMapWithSetPlanesGeneric:242 - Не удалось добавить объект: DrawningObjectPlane@346c62e6 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@7ab4db74 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@26d6ea4c 06-12-2022
INFO FormMapWithSetPlanesGeneric:158 - Добавлена карта 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@283ebc21 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@6e641bb7 06-12-2022
INFO FormMapWithSetPlanesGeneric:295 - Oбъект удалён: DrawningObjectPlane@6e641bb7 06-12-2022
INFO FormMapWithSetPlanesGeneric:242 - Не удалось добавить объект: DrawningObjectPlane@25085fe6 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@140493d0 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@6ebb6c6b 06-12-2022
INFO FormMapWithSetPlanesGeneric:158 - Добавлена карта 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:192 - Осуществлён переход на карту под названием 123 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@283ebc21 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@4016d2d9 06-12-2022
INFO FormMapWithSetPlanesGeneric:238 - Добавлен объект: DrawningObjectPlane@1301bb04 06-12-2022

View File

@ -1,3 +1,4 @@
WARN FormMapWithSetPlanesGenericAdmin:304 - Ошибка удаления: Не найден объект по позиции 1 02-12-2022
WARN FormMapWithSetPlanesGenericAdmin:304 - Ошибка удаления: Не найден объект по позиции 0 02-12-2022
ERROR FormMapWithSetPlanesGenericAdmin:493 - Ошибка загрузки: Формат данных в файле неправильный 04-12-2022
ERROR FormMapWithSetPlanesGeneric:143 - При добавлении карты 0не была названа карта 06-12-2022

View File

@ -48,8 +48,7 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
private static Logger _logger;
//дополнительные логгеры
Logger logwarn = Logger.getLogger("FormMapWithSetPlanesGenericAdmin");
Logger loginfo = Logger.getLogger("FormMapWithSetPlanesGeneric");
Logger logger = Logger.getLogger("FormMapWithSetPlanesGeneric");
//Для выпадающего списка
HashMap<String, AbstractMap> _mapsHashMap = new HashMap<>()
@ -137,11 +136,11 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
if(ComboBoxSelectorMap.getSelectedIndex() == -1)
{
logwarn.log(Level.ERROR, "При добавлении карты " + ComboBoxSelectorMap.getSelectedIndex() + "не была выбрана карта");
logger.log(Level.ERROR, "При добавлении карты " + ComboBoxSelectorMap.getSelectedIndex() + "не была выбрана карта");
}
else
{
logwarn.log(Level.ERROR, "При добавлении карты " + ComboBoxSelectorMap.getSelectedIndex() + "не была названа карта");
logger.log(Level.ERROR, "При добавлении карты " + ComboBoxSelectorMap.getSelectedIndex() + "не была названа карта");
}
return;
@ -150,13 +149,13 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
if(!_mapsHashMap.containsKey(ComboBoxSelectorMap.getSelectedItem()))
{
JOptionPane.showMessageDialog(null, "Данная карта отсутсвует", "Ошибка", JOptionPane.ERROR_MESSAGE);
logwarn.log(Level.ERROR, "Отсутствует карта с названием " + TextBoxNewMapName.getText());
logger.log(Level.ERROR, "Отсутствует карта с названием " + TextBoxNewMapName.getText());
return;
}
_mapsCollection.AddMap(TextBoxNewMapName.getText(), _mapsHashMap.get(ComboBoxSelectorMap.getSelectedItem().toString()));
loginfo.log(Level.INFO, "Добавлена карта " + TextBoxNewMapName.getText());
logger.log(Level.INFO, "Добавлена карта " + TextBoxNewMapName.getText());
ReloadMaps();
}
});
@ -174,7 +173,7 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
"Удаление", JOptionPane.YES_NO_OPTION) == 0)
{
_mapsCollection.DelMap(ListBoxMaps.getSelectedValue().toString());
loginfo.log(Level.INFO, "Удалена карта " + ListBoxMaps.getSelectedValue().toString());
logger.log(Level.INFO, "Удалена карта " + ListBoxMaps.getSelectedValue().toString());
ReloadMaps();
}
}
@ -190,7 +189,7 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
}
UpdateWindow(_mapsCollection.get(ListBoxMaps.getSelectedValue().toString()).ShowSet());
loginfo.log(Level.INFO, "Осуществлён переход на карту под названием " + ListBoxMaps.getSelectedValue().toString());
logger.log(Level.INFO, "Осуществлён переход на карту под названием " + ListBoxMaps.getSelectedValue().toString());
}
});
@ -236,11 +235,11 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
if (_mapsCollection.get(ListBoxMaps.getSelectedValue().toString()).Add(plane) != -1) {
JOptionPane.showMessageDialog(null, "Объект добавлен");
loginfo.log(Level.INFO, "Добавлен объект: " + plane);
logger.log(Level.INFO, "Добавлен объект: " + plane);
UpdateWindow(_mapsCollection.get(ListBoxMaps.getSelectedValue().toString()).ShowSet());
} else {
JOptionPane.showMessageDialog(null, "Не удалось добавить объект", "Ошибка", JOptionPane.ERROR_MESSAGE);
loginfo.log(Level.INFO, "Не удалось добавить объект: " + plane);
logger.log(Level.INFO, "Не удалось добавить объект: " + plane);
}
}
}
@ -248,19 +247,19 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
{
JOptionPane.showConfirmDialog(null, "Ошибка, хранилище переполнено: " + ex.getMessage(), "Результат",
JOptionPane.ERROR_MESSAGE);
logwarn.log(Level.WARN, "Ошибка, переполнение хранилища: " + ex.getMessage());
logger.log(Level.WARN, "Ошибка, переполнение хранилища: " + ex.getMessage());
}
catch(IllegalArgumentException ex)
{
JOptionPane.showConfirmDialog(null, ex.getMessage(), "Результат",
JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
logwarn.log(Level.ERROR, "Ошибка добавления: " + ex.getMessage());
logger.log(Level.ERROR, "Ошибка добавления: " + ex.getMessage());
}
catch(Exception ex)
{
JOptionPane.showConfirmDialog(null, "Неизвестная ошибка: " + ex.getMessage(), "Результат",
JOptionPane.ERROR_MESSAGE);
logwarn.log(Level.FATAL, "Неизвестная ошибка: " + ex.getMessage());
logger.log(Level.FATAL, "Неизвестная ошибка: " + ex.getMessage());
}
});
@ -293,22 +292,22 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
if (deletePlane != null) {
JOptionPane.showMessageDialog(null, "Объект удалён " + deletePlane);
loginfo.log(Level.INFO, "Oбъект удалён: " + deletePlane);
logger.log(Level.INFO, "Oбъект удалён: " + deletePlane);
UpdateWindow(_mapsCollection.get(ListBoxMaps.getSelectedValue().toString()).ShowSet());
} else {
JOptionPane.showMessageDialog(null, "Не удалось удалить объект", "Ошибка", JOptionPane.ERROR_MESSAGE);
logwarn.log(Level.ERROR, "Не удалось удалить объект " + deletePlane);
logger.log(Level.ERROR, "Не удалось удалить объект " + deletePlane);
}
}
catch (PlaneNotFoundException ex)
{
JOptionPane.showMessageDialog(null, "Ошибка удаления: " + ex.getMessage(), "Ошибка", JOptionPane.ERROR_MESSAGE);
logwarn.log(Level.WARN, "Ошибка удаления: " + ex.getMessage());
logger.log(Level.WARN, "Ошибка удаления: " + ex.getMessage());
}
catch (Exception ex)
{
JOptionPane.showMessageDialog(null, "Неизвестная ошибка: " + ex.getMessage(), "Ошибка", JOptionPane.ERROR_MESSAGE);
logwarn.log(Level.FATAL, "Ошибка удаления: " + ex.getMessage());
logger.log(Level.FATAL, "Ошибка удаления: " + ex.getMessage());
}
}
});
@ -484,13 +483,13 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
ReloadMaps();
JOptionPane.showMessageDialog(null,"Загрузка данных прошла успешно",
"Результат", JOptionPane.INFORMATION_MESSAGE);
loginfo.log(Level.INFO, "Загрузка карт прошла успешно");
logger.log(Level.INFO, "Загрузка карт прошла успешно");
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(null, "Ошибка загрузки данных" + ex.getMessage(),
"Результат", JOptionPane.ERROR_MESSAGE);
logwarn.log(Level.ERROR, "Ошибка загрузки: " + ex.getMessage());
logger.log(Level.ERROR, "Ошибка загрузки: " + ex.getMessage());
}
}
}
@ -510,13 +509,13 @@ public class FormMapWithSetPlanesGeneric extends JFrame{
_mapsCollection.SaveData(jfc.getSelectedFile().getPath());
JOptionPane.showMessageDialog(null,"Сохранение прошло успешно",
"Результат", JOptionPane.INFORMATION_MESSAGE);
logwarn.log(Level.ERROR,"Сохранение прошло успешно");
logger.log(Level.ERROR,"Сохранение прошло успешно");
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(null, "Не сохранилось" + ex.getMessage(),
"Результат", JOptionPane.ERROR_MESSAGE);
logwarn.log(Level.ERROR,"Ошибка сохранения: " + ex.getMessage());
logger.log(Level.ERROR,"Ошибка сохранения: " + ex.getMessage());
}
}
}

View File

@ -1,4 +1,5 @@
import java.util.Comparator;
import java.util.Objects;
public class PlaneCompareByType implements Comparator<IDrawningObject>
{
@ -38,7 +39,8 @@ public class PlaneCompareByType implements Comparator<IDrawningObject>
return -1;
}
if(xPlane.GetPlane().getClass().getSimpleName() != yPlane.GetPlane().getClass().getSimpleName())
if(!Objects.equals(xPlane.GetPlane().getClass(), yPlane.GetPlane().getClass()))
{
if(xPlane.GetPlane().getClass().getSimpleName() == "DrawingPlane")
{
@ -48,6 +50,22 @@ public class PlaneCompareByType implements Comparator<IDrawningObject>
return 1;
}
String xStyleWindows = xPlane.GetPlane()._airplaneWindow.getClass().getSimpleName();
String yStyleWindows = yPlane.GetPlane()._airplaneWindow.getClass().getSimpleName();
int styleCompare = xStyleWindows.compareTo(yStyleWindows);
if(styleCompare != 0){
return styleCompare;
}
Integer xCountWindows = xPlane.GetPlane()._countWindows;
Integer yCountWindows = yPlane.GetPlane()._countWindows;
int countWindowsCompare = xCountWindows.compareTo(yCountWindows);
if(countWindowsCompare != 0){
return countWindowsCompare;
}
Integer speedCompare1 = xPlane.GetPlane().Plane.GetSpeed();
Integer speedCompare2 = yPlane.GetPlane().Plane.GetSpeed();
var speedCompare = speedCompare1.compareTo(speedCompare2);

View File

@ -1,5 +1,4 @@
log4j.logger.FormMapWithSetPlanesGeneric=INFO, fileAppender
log4j.logger.FormMapWithSetPlanesGenericAdmin=WARN, adminAppender
log4j.logger.FormMapWithSetPlanesGeneric=INFO, fileAppender, adminAppender
log4j.additivity.file=false
log4j.additivity.admin=false
@ -8,6 +7,10 @@ log4j.appender.fileAppender=org.apache.log4j.RollingFileAppender
log4j.appender.fileAppender.File=loginfo.log
log4j.appender.fileAppender.MaxFileSize=5MB
log4j.appender.fileAppender.MaxBackupIndex=1
log4j.appender.fileAppender.filter.a=org.apache.log4j.varia.LevelRangeFilter
log4j.appender.fileAppender.filter.a.LevelMin=INFO
log4j.appender.fileAppender.filter.a.LevelMax=INFO
log4j.appender.fileAppender.filter.a.AcceptOnMatch=TRUE
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.fileAppender.layout.ConversionPattern=%-5p %c{1}:%L - %m %d{dd-MM-yyyy}%n
@ -15,5 +18,9 @@ log4j.appender.adminAppender=org.apache.log4j.RollingFileAppender
log4j.appender.adminAppender.File=logwarn.log
log4j.appender.adminAppender.MaxFileSize=5MB
log4j.appender.adminAppender.MaxBackupIndex=1
log4j.appender.adminAppender.filter.a=org.apache.log4j.varia.LevelRangeFilter
log4j.appender.adminAppender.filter.a.LevelMin=WARN
log4j.appender.adminAppender.filter.a.LevelMax=FATAL
log4j.appender.adminAppender.filter.a.AcceptOnMatch=TRUE
log4j.appender.adminAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.adminAppender.layout.ConversionPattern=%-5p %c{1}:%L - %m %d{dd-MM-yyyy}%n