Исправление сортировок в 8-й лабораторной.
This commit is contained in:
parent
4327f0f4b6
commit
f1b87ec380
@ -3,3 +3,12 @@ INFO FormMapWithSetPlanesGeneric:191 - Осуществлён переход н
|
||||
INFO FormMapWithSetPlanesGeneric:157 - Добавлена карта 454 02-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:191 - Осуществлён переход на карту под названием 454 02-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:193 - Осуществлён переход на карту под названием 123 03-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:193 - Осуществлён переход на карту под названием 123 04-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:239 - Добавлен объект: DrawningObjectPlane@7d175d9c 04-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:193 - Осуществлён переход на карту под названием 123 04-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:239 - Добавлен объект: DrawningObjectPlane@65494a28 04-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:193 - Осуществлён переход на карту под названием 123 04-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:239 - Добавлен объект: DrawningObjectPlane@4c9c0121 04-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:193 - Осуществлён переход на карту под названием 123 04-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:193 - Осуществлён переход на карту под названием 123 04-12-2022
|
||||
INFO FormMapWithSetPlanesGeneric:193 - Осуществлён переход на карту под названием 123 05-12-2022
|
||||
|
@ -1,2 +1,3 @@
|
||||
WARN FormMapWithSetPlanesGenericAdmin:304 - Ошибка удаления: Не найден объект по позиции 1 02-12-2022
|
||||
WARN FormMapWithSetPlanesGenericAdmin:304 - Ошибка удаления: Не найден объект по позиции 0 02-12-2022
|
||||
ERROR FormMapWithSetPlanesGenericAdmin:493 - Ошибка загрузки: Формат данных в файле неправильный 04-12-2022
|
||||
|
@ -73,4 +73,4 @@ public class DrawingAirbus extends DrawingPlane
|
||||
|
||||
super.repaint();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
import java.awt.*;
|
||||
import javax.swing.*;
|
||||
import java.awt.Color;
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
public class DrawingPlane extends JPanel
|
||||
@ -225,4 +226,19 @@ public class DrawingPlane extends JPanel
|
||||
{
|
||||
return new float[]{_startPosX, _startPosY, _startPosX + _airbusWidth, _startPosY + _airbusHeight};
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
public Iterator<Object> iterator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object next() {
|
||||
return null;
|
||||
}*/
|
||||
}
|
||||
|
@ -239,4 +239,4 @@ public class FormPlane extends JDialog
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@ public class PlaneCompareByColor implements Comparator<IDrawningObject>
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (x != null && y != null)
|
||||
if (x != null && y == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -36,31 +36,45 @@ public class PlaneCompareByColor implements Comparator<IDrawningObject>
|
||||
|
||||
if (xPlane != null && yPlane == null)
|
||||
{
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(xPlane.GetPlane().Plane.GetSpeed() != yPlane.GetPlane().Plane.GetSpeed())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
var xEntityPlane = xPlane.GetPlane().Plane;
|
||||
var yEntityPlane = yPlane.GetPlane().Plane;
|
||||
|
||||
if (xPlane.GetPlane().Plane.GetWeight() != yPlane.GetPlane().Plane.GetWeight())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
Integer colorCompare1 = xEntityPlane.GetColor().getRGB();
|
||||
Integer colorCompare2 = yEntityPlane.GetColor().getRGB();
|
||||
var colorCompare = colorCompare1.compareTo(colorCompare2);
|
||||
|
||||
var xEntity = xPlane.GetPlane().Plane;
|
||||
var yEntity = yPlane.GetPlane().Plane;
|
||||
var colorCompare = xEntity.GetColor().toString().compareTo(yEntity.GetColor().toString());
|
||||
|
||||
if (colorCompare != 0 || xEntity instanceof EntityAirbus || yEntity instanceof EntityAirbus)
|
||||
if (colorCompare != 0)
|
||||
{
|
||||
return colorCompare;
|
||||
}
|
||||
|
||||
EntityAirbus xEntityAirbus = (EntityAirbus)xEntity;
|
||||
EntityAirbus yEntityAirbus = (EntityAirbus)yEntity;
|
||||
if (xEntityPlane instanceof EntityAirbus xAirbus && yEntityPlane instanceof EntityAirbus yAirbus)
|
||||
{
|
||||
Integer dopColorCompare1 = xAirbus.AddColor().getRGB();
|
||||
Integer dopColorCompare2 = yAirbus.AddColor().getRGB();
|
||||
var addColorCompare = dopColorCompare1.compareTo(dopColorCompare2);
|
||||
|
||||
return xEntityAirbus.AddColor().toString().compareTo(yEntityAirbus.AddColor().toString());
|
||||
if(addColorCompare != 0)
|
||||
{
|
||||
return addColorCompare;
|
||||
}
|
||||
}
|
||||
|
||||
Integer speedCompare1 = xPlane.GetPlane().Plane.GetSpeed();
|
||||
Integer speedCompare2 = yPlane.GetPlane().Plane.GetSpeed();
|
||||
var speedCompare = speedCompare1.compareTo(speedCompare2);
|
||||
|
||||
if(speedCompare != 0)
|
||||
{
|
||||
return speedCompare;
|
||||
}
|
||||
|
||||
Float weightCompare1 = xPlane.GetPlane().Plane.GetWeight();
|
||||
Float weightCompare2 = yPlane.GetPlane().Plane.GetWeight();
|
||||
|
||||
return weightCompare1.compareTo(weightCompare2);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class PlaneCompareByType implements Comparator<IDrawningObject>
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (x != null && y != null)
|
||||
if (x != null && y == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -35,31 +35,31 @@ public class PlaneCompareByType implements Comparator<IDrawningObject>
|
||||
|
||||
if (xPlane != null && yPlane == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(xPlane.GetPlane().getClass().getSimpleName() != yPlane.GetPlane().getClass().getSimpleName())
|
||||
{
|
||||
if(xPlane.GetPlane().getClass().getSimpleName() == "DrawingPlane")
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(xPlane.GetPlane().Plane.GetSpeed() != yPlane.GetPlane().Plane.GetSpeed())
|
||||
Integer speedCompare1 = xPlane.GetPlane().Plane.GetSpeed();
|
||||
Integer speedCompare2 = yPlane.GetPlane().Plane.GetSpeed();
|
||||
var speedCompare = speedCompare1.compareTo(speedCompare2);
|
||||
|
||||
if(speedCompare != 0)
|
||||
{
|
||||
return 1;
|
||||
return speedCompare;
|
||||
}
|
||||
|
||||
if (xPlane.GetPlane().Plane.GetWeight() != yPlane.GetPlane().Plane.GetWeight())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
Float weightCompare1 = xPlane.GetPlane().Plane.GetWeight();
|
||||
Float weightCompare2 = yPlane.GetPlane().Plane.GetWeight();
|
||||
|
||||
var xEntity = xPlane.GetPlane().Plane;
|
||||
var yEntity = yPlane.GetPlane().Plane;
|
||||
var colorCompare = xEntity.CorpusColor.toString().compareTo(yEntity.CorpusColor.toString());
|
||||
|
||||
if (colorCompare != 0 || xEntity instanceof EntityAirbus || yEntity instanceof EntityAirbus yEntityAirbus)
|
||||
{
|
||||
return colorCompare;
|
||||
}
|
||||
|
||||
EntityAirbus xEntityAirbus = (EntityAirbus) xEntity;
|
||||
EntityAirbus yEntityAirbus = (EntityAirbus) yEntity;
|
||||
|
||||
return xEntityAirbus.AddColor().toString().compareTo(yEntityAirbus.AddColor().toString());
|
||||
return weightCompare1.compareTo(weightCompare2);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user