Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
19b337df7a | |||
ea035676cd | |||
92c6fd868b | |||
84dfe83ea8 | |||
1ba1e154a3 | |||
953ec4b8ce |
6
ProjectContainerShip/.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
ProjectContainerShip/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/ProjectContainerShip.iml" filepath="$PROJECT_DIR$/ProjectContainerShip.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
ProjectContainerShip/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
BIN
ProjectContainerShip/Resources/30px_arrow_down.png
Normal file
After Width: | Height: | Size: 244 B |
BIN
ProjectContainerShip/Resources/30px_arrow_left.png
Normal file
After Width: | Height: | Size: 249 B |
BIN
ProjectContainerShip/Resources/30px_arrow_right.png
Normal file
After Width: | Height: | Size: 254 B |
BIN
ProjectContainerShip/Resources/30px_arrow_up.png
Normal file
After Width: | Height: | Size: 257 B |
15
ProjectContainerShip/src/Drawings/DeckCount.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package ProjectContainerShip.src.Drawings;
|
||||||
|
|
||||||
|
public enum DeckCount {
|
||||||
|
One(1),
|
||||||
|
Two(2),
|
||||||
|
Three(3);
|
||||||
|
|
||||||
|
final private int EnumNumber;
|
||||||
|
DeckCount(int enumNumber) {
|
||||||
|
EnumNumber = enumNumber;
|
||||||
|
}
|
||||||
|
public int getEnumNumber() {
|
||||||
|
return EnumNumber;
|
||||||
|
}
|
||||||
|
}
|
8
ProjectContainerShip/src/Drawings/DirectionType.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package ProjectContainerShip.src.Drawings;
|
||||||
|
|
||||||
|
public enum DirectionType {
|
||||||
|
Up,
|
||||||
|
Down,
|
||||||
|
Left,
|
||||||
|
Right
|
||||||
|
}
|
88
ProjectContainerShip/src/Drawings/DrawningContainerShip.java
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
package ProjectContainerShip.src.Drawings;
|
||||||
|
|
||||||
|
import ProjectContainerShip.src.Entities.EntityContainerShip;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class DrawningContainerShip extends DrawningShip {
|
||||||
|
EntityContainerShip entityContainerShip;
|
||||||
|
|
||||||
|
public DrawningContainerShip(int speed, double weight, Color bodyColor, int deckType, Color additionalColor, boolean crane, boolean container) {
|
||||||
|
super(speed, weight, bodyColor, deckType, 130, 60);
|
||||||
|
entityContainerShip = new EntityContainerShip(speed, weight, bodyColor, additionalColor, crane, container);
|
||||||
|
}
|
||||||
|
|
||||||
|
// тут рисовашки
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void DrawShip(Graphics g) {
|
||||||
|
if (entityContainerShip == null || _startPosX == null || _startPosY == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.DrawShip(g);
|
||||||
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
|
|
||||||
|
if (entityContainerShip.getCrane()) {
|
||||||
|
drawCrane( entityContainerShip.getAdditionalColor(), g2d);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (entityContainerShip.getContainer()) {
|
||||||
|
drawContainer( entityContainerShip.getAdditionalColor(), g2d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawCrane(Color additionalColor, Graphics g2d)
|
||||||
|
{
|
||||||
|
g2d.setColor(additionalColor);
|
||||||
|
Point[] crane = new Point[]
|
||||||
|
{
|
||||||
|
new Point(_startPosX + 75, _startPosY + 50),
|
||||||
|
new Point(_startPosX + 85, _startPosY+ 50),
|
||||||
|
new Point(_startPosX + 85, _startPosY + 20),
|
||||||
|
new Point(_startPosX + 105, _startPosY + 20),
|
||||||
|
new Point(_startPosX + 105, _startPosY + 15),
|
||||||
|
new Point(_startPosX + 75, _startPosY + 15),
|
||||||
|
|
||||||
|
};
|
||||||
|
Polygon cranePolygon = new Polygon();
|
||||||
|
for (Point point: crane) {
|
||||||
|
cranePolygon.addPoint(point.x, point.y);
|
||||||
|
}
|
||||||
|
g2d.fillPolygon(cranePolygon);
|
||||||
|
g2d.drawPolygon(cranePolygon);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawContainer(Color additionalColor, Graphics g2d)
|
||||||
|
{
|
||||||
|
g2d.setColor(Color.BLACK);
|
||||||
|
|
||||||
|
Point[] container1 = new Point[] {
|
||||||
|
new Point(_startPosX + 90, _startPosY + 50),
|
||||||
|
new Point(_startPosX + 120, _startPosY + 50),
|
||||||
|
new Point(_startPosX + 120, _startPosY + 40),
|
||||||
|
new Point(_startPosX + 90, _startPosY + 40)
|
||||||
|
};
|
||||||
|
Polygon container1Polygon = new Polygon();
|
||||||
|
for(Point point: container1) {
|
||||||
|
container1Polygon.addPoint(point.x, point.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
Point[] container2 = new Point[] {
|
||||||
|
new Point(_startPosX + 90, _startPosY + 40),
|
||||||
|
new Point(_startPosX + 90, _startPosY + 30),
|
||||||
|
new Point(_startPosX + 120, _startPosY + 30),
|
||||||
|
new Point(_startPosX + 120, _startPosY + 40)
|
||||||
|
};
|
||||||
|
Polygon container2Polygon = new Polygon();
|
||||||
|
for(Point point: container1) {
|
||||||
|
container2Polygon.addPoint(point.x, point.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
g2d.drawPolygon(container1Polygon);
|
||||||
|
g2d.drawPolygon(container2Polygon);
|
||||||
|
g2d.setColor(entityContainerShip.getAdditionalColor());
|
||||||
|
g2d.fillPolygon(container1Polygon);
|
||||||
|
g2d.fillPolygon(container2Polygon);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package ProjectContainerShip.src.Drawings;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
public class DrawningContainerShipDeck implements IDrawningDeck {
|
||||||
|
private DeckCount _deckCount;
|
||||||
|
|
||||||
|
public void setEnumNumber(int deckCount) {
|
||||||
|
for (DeckCount value : DeckCount.values()) {
|
||||||
|
if (value.getEnumNumber() == deckCount) {
|
||||||
|
_deckCount = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawContainerShipDeck(Graphics g, Color color, int startPosX, int startPosY)
|
||||||
|
{
|
||||||
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
|
g2d.setColor(color);
|
||||||
|
g2d.setStroke(new BasicStroke(4));
|
||||||
|
for (int i = 0; i < _deckCount.getEnumNumber(); i++) {
|
||||||
|
drawDeck(g2d, (int) startPosX, (int)startPosY);
|
||||||
|
startPosY-=10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void drawDeck(Graphics2D g2d, int posX, int posY) {
|
||||||
|
g2d.drawLine(posX + 10, posY + 50, posX + 60, posY + 50);
|
||||||
|
g2d.drawLine(posX + 60, posY + 50, posX + 60, posY + 40);
|
||||||
|
g2d.drawLine(posX + 60, posY + 40, posX + 10, posY + 40);
|
||||||
|
g2d.drawLine(posX + 10, posY + 40, posX + 10, posY + 50);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package ProjectContainerShip.src.Drawings;
|
||||||
|
import java.awt.*;
|
||||||
|
public class DrawningContainerShipDeckFull implements IDrawningDeck {
|
||||||
|
private DeckCount _deckCount;
|
||||||
|
public void setEnumNumber(int wheelsCount){
|
||||||
|
for (DeckCount value : DeckCount.values()){
|
||||||
|
if (value.getEnumNumber() == wheelsCount){
|
||||||
|
_deckCount = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void drawContainerShipDeck(Graphics g, Color color, int startPosX, int startPosY)
|
||||||
|
{
|
||||||
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
|
g2d.setColor(color);
|
||||||
|
g2d.setStroke(new BasicStroke(4));
|
||||||
|
for (int i = 0; i < _deckCount.getEnumNumber(); i++) {
|
||||||
|
drawDeck(g2d, (int) startPosX, (int)startPosY);
|
||||||
|
startPosY-=10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void drawDeck(Graphics2D g2d, int posX, int posY) {
|
||||||
|
g2d.drawLine(posX + 20, posY + 50, posX + 50, posY + 50);
|
||||||
|
g2d.drawLine(posX + 50, posY + 50, posX + 55, posY + 45);
|
||||||
|
g2d.drawLine(posX + 55, posY + 45, posX + 50, posY + 40);
|
||||||
|
g2d.drawLine(posX + 50, posY + 40, posX + 20, posY + 40);
|
||||||
|
g2d.drawLine(posX + 20, posY + 40, posX + 15, posY + 45);
|
||||||
|
g2d.drawLine(posX + 15, posY + 45, posX + 20, posY + 50);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package ProjectContainerShip.src.Drawings;
|
||||||
|
import java.awt.*;
|
||||||
|
public class DrawningContainerShipDeckTrapez implements IDrawningDeck {
|
||||||
|
private DeckCount _deckCount;
|
||||||
|
public void setEnumNumber(int wheelsCount){
|
||||||
|
for (DeckCount value : DeckCount.values()){
|
||||||
|
if (value.getEnumNumber() == wheelsCount){
|
||||||
|
_deckCount = value;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// поправить
|
||||||
|
private void drawDeck(Graphics2D g2d, int posX, int posY) {
|
||||||
|
g2d.drawLine(posX + 20, posY + 50, posX + 50, posY + 50);
|
||||||
|
g2d.drawLine(posX + 50, posY + 50, posX + 60, posY + 40);
|
||||||
|
g2d.drawLine(posX + 60, posY + 40, posX + 10, posY + 40);
|
||||||
|
g2d.drawLine(posX + 10, posY + 40, posX + 20, posY + 50);
|
||||||
|
}
|
||||||
|
public void drawContainerShipDeck(Graphics g, Color color, int startPosX, int startPosY)
|
||||||
|
{
|
||||||
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
|
g2d.setColor(color);
|
||||||
|
g2d.setStroke(new BasicStroke(4));
|
||||||
|
for (int i = 0; i < _deckCount.getEnumNumber(); i++) {
|
||||||
|
drawDeck(g2d, (int) startPosX, (int)startPosY);
|
||||||
|
startPosY-=10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
144
ProjectContainerShip/src/Drawings/DrawningShip.java
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
package ProjectContainerShip.src.Drawings;
|
||||||
|
|
||||||
|
import ProjectContainerShip.src.Entities.EntityShip;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class DrawningShip {
|
||||||
|
private EntityShip entityShip;
|
||||||
|
public EntityShip getEntityShip() {
|
||||||
|
return entityShip;
|
||||||
|
}
|
||||||
|
private IDrawningDeck drawningDeck;
|
||||||
|
private Integer _pictureWidth;
|
||||||
|
private Integer _pictureHeight;
|
||||||
|
protected Integer _startPosX;
|
||||||
|
protected Integer _startPosY;
|
||||||
|
private int _drawningShipWidth = 130;
|
||||||
|
private int _drawningShipHeight = 60;
|
||||||
|
public int getPosX() {
|
||||||
|
return _startPosX;
|
||||||
|
}
|
||||||
|
public int getPosY() {
|
||||||
|
return _startPosY;
|
||||||
|
}
|
||||||
|
public int getTrainWidth() {
|
||||||
|
return _drawningShipWidth;
|
||||||
|
}
|
||||||
|
public int getTrainHeight() {
|
||||||
|
return _drawningShipHeight;
|
||||||
|
}
|
||||||
|
public DrawningShip(int speed, double weight, Color bodyColor, int deckType){
|
||||||
|
entityShip = new EntityShip(speed, weight, bodyColor);
|
||||||
|
_pictureWidth = null;
|
||||||
|
_pictureHeight = null;
|
||||||
|
_startPosX = null;
|
||||||
|
_startPosY = null;
|
||||||
|
switch(deckType){
|
||||||
|
case 0:
|
||||||
|
drawningDeck = new DrawningContainerShipDeck();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
drawningDeck = new DrawningContainerShipDeckFull();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
drawningDeck = new DrawningContainerShipDeckTrapez();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Random rand = new Random();
|
||||||
|
int deckCount = rand.nextInt(1, 4);
|
||||||
|
drawningDeck.setEnumNumber(deckCount);
|
||||||
|
}
|
||||||
|
public DrawningShip(int speed, double weight, Color bodyColor, int deckType, int drawningShipWidth, int drawningShipHeight){
|
||||||
|
this(speed, weight, bodyColor, deckType);
|
||||||
|
_drawningShipWidth = drawningShipWidth;
|
||||||
|
_drawningShipHeight = drawningShipHeight;
|
||||||
|
}
|
||||||
|
public boolean SetPictureSize(int width, int height){
|
||||||
|
if (_drawningShipWidth <= width && _drawningShipHeight <= height){
|
||||||
|
_pictureWidth = width;
|
||||||
|
_pictureHeight = height;
|
||||||
|
if (_startPosX != null && _startPosY != null){
|
||||||
|
if (_startPosX + _drawningShipWidth > _pictureWidth) {
|
||||||
|
_startPosX = _pictureWidth - _drawningShipWidth;
|
||||||
|
}
|
||||||
|
if (_startPosY + _drawningShipHeight > _pictureHeight) {
|
||||||
|
_startPosY = _pictureHeight - _drawningShipHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPosition(int x, int y)
|
||||||
|
{
|
||||||
|
if (_pictureHeight == null || _pictureWidth == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (x + _drawningShipWidth > _pictureWidth || x < 0)
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
}
|
||||||
|
if (y + _drawningShipHeight > _pictureHeight || y < 0)
|
||||||
|
{
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
|
_startPosX = x;
|
||||||
|
_startPosY = y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean MoveTransport(DirectionType direction){
|
||||||
|
if (entityShip == null || _startPosX == null || _startPosY == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
switch (direction){
|
||||||
|
case DirectionType.Up:
|
||||||
|
if (_startPosY - entityShip.Step() > 0){
|
||||||
|
_startPosY -= (int) entityShip.Step();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case DirectionType.Down:
|
||||||
|
if (_startPosY + entityShip.Step() + _drawningShipHeight < _pictureHeight){
|
||||||
|
_startPosY += (int) entityShip.Step();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case DirectionType.Left:
|
||||||
|
if (_startPosX - entityShip.Step() > 0){
|
||||||
|
_startPosX -= (int) entityShip.Step();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case DirectionType.Right:
|
||||||
|
if (_startPosX + entityShip.Step() + _drawningShipWidth < _pictureWidth){
|
||||||
|
_startPosX += (int) entityShip.Step();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void DrawShip(Graphics g) {
|
||||||
|
if (entityShip == null || _startPosX == null || _startPosY == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
|
Point[] containerShipBorders = new Point[] {
|
||||||
|
new Point(_startPosX, _startPosY + 50),
|
||||||
|
new Point(_startPosX + 20, _startPosY + 70),
|
||||||
|
new Point(_startPosX + 110, _startPosY + 70),
|
||||||
|
new Point(_startPosX + 130, _startPosY + 50)
|
||||||
|
};
|
||||||
|
Polygon containerShipPolygon = new Polygon();
|
||||||
|
for(Point point : containerShipBorders)
|
||||||
|
containerShipPolygon.addPoint(point.x, point.y);
|
||||||
|
g2d.setColor(Color.BLACK);
|
||||||
|
g2d.draw(containerShipPolygon);
|
||||||
|
g2d.setColor(entityShip.getBodyColor());
|
||||||
|
g2d.fill(containerShipPolygon);
|
||||||
|
drawningDeck.drawContainerShipDeck(g, entityShip.getBodyColor(), _startPosX, _startPosY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
8
ProjectContainerShip/src/Drawings/IDrawningDeck.java
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
package ProjectContainerShip.src.Drawings;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public interface IDrawningDeck {
|
||||||
|
void setEnumNumber(int x);
|
||||||
|
void drawContainerShipDeck(Graphics g, Color color, int startX, int startY);
|
||||||
|
}
|
32
ProjectContainerShip/src/Entities/EntityContainerShip.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package ProjectContainerShip.src.Entities;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
public class EntityContainerShip extends EntityShip {
|
||||||
|
|
||||||
|
// доп цвет
|
||||||
|
private Color AdditionalColor;
|
||||||
|
|
||||||
|
public Color getAdditionalColor() {
|
||||||
|
return AdditionalColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
// доп опция кран
|
||||||
|
private boolean Crane;
|
||||||
|
public boolean getCrane() {
|
||||||
|
return Crane;
|
||||||
|
}
|
||||||
|
|
||||||
|
// доп опция контейнер
|
||||||
|
private boolean Container;
|
||||||
|
public boolean getContainer() {
|
||||||
|
return Container;
|
||||||
|
}
|
||||||
|
|
||||||
|
// инициализация полей обьекта
|
||||||
|
public EntityContainerShip(int speed, double weight, Color bodyColor, Color additionalColor, boolean crane, boolean container) {
|
||||||
|
super(speed, weight, bodyColor);
|
||||||
|
AdditionalColor = additionalColor;
|
||||||
|
Crane = crane;
|
||||||
|
Container = container;
|
||||||
|
}
|
||||||
|
}
|
29
ProjectContainerShip/src/Entities/EntityShip.java
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package ProjectContainerShip.src.Entities;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
public class EntityShip {
|
||||||
|
private int Speed;
|
||||||
|
public int getSpeed() {
|
||||||
|
return Speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private double Weight;
|
||||||
|
public double getWeight() {
|
||||||
|
return Weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color BodyColor;
|
||||||
|
public Color getBodyColor() {
|
||||||
|
return BodyColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Step() {
|
||||||
|
return Speed*100/Weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityShip(int speed, double weight, Color bodyColor) {
|
||||||
|
Speed = speed;
|
||||||
|
Weight = weight;
|
||||||
|
BodyColor = bodyColor;
|
||||||
|
}
|
||||||
|
}
|
118
ProjectContainerShip/src/FormContainerShip.form
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ProjectContainerShip.src.FormContainerShip">
|
||||||
|
<grid id="27dc6" binding="PanelWrapper" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<xy x="20" y="20" width="960" height="545"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<grid id="34630" binding="PictureBox" layout-manager="GridLayoutManager" row-count="5" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||||
|
<margin top="0" left="0" bottom="0" right="0"/>
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
<border type="none"/>
|
||||||
|
<children>
|
||||||
|
<component id="31c3f" class="javax.swing.JButton" binding="buttonDown">
|
||||||
|
<constraints>
|
||||||
|
<grid row="4" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<minimum-size width="30" height="30"/>
|
||||||
|
<preferred-size width="30" height="30"/>
|
||||||
|
<maximum-size width="30" height="30"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<icon value="ProjectContainerShip/Resources/30px_arrow_down.png"/>
|
||||||
|
<text value=""/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<hspacer id="b5bb2">
|
||||||
|
<constraints>
|
||||||
|
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</hspacer>
|
||||||
|
<component id="6deee" class="javax.swing.JButton" binding="buttonRight">
|
||||||
|
<constraints>
|
||||||
|
<grid row="4" column="5" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<minimum-size width="30" height="30"/>
|
||||||
|
<preferred-size width="30" height="30"/>
|
||||||
|
<maximum-size width="30" height="30"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<icon value="ProjectContainerShip/Resources/30px_arrow_right.png"/>
|
||||||
|
<text value=""/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="f5ad2" class="javax.swing.JButton" binding="buttonLeft">
|
||||||
|
<constraints>
|
||||||
|
<grid row="4" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<minimum-size width="30" height="30"/>
|
||||||
|
<preferred-size width="30" height="30"/>
|
||||||
|
<maximum-size width="30" height="30"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<icon value="ProjectContainerShip/Resources/30px_arrow_left.png"/>
|
||||||
|
<text value=""/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="e26e8" class="javax.swing.JButton" binding="buttonUp">
|
||||||
|
<constraints>
|
||||||
|
<grid row="3" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||||
|
<minimum-size width="30" height="30"/>
|
||||||
|
<preferred-size width="30" height="30"/>
|
||||||
|
<maximum-size width="30" height="30"/>
|
||||||
|
</grid>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<icon value="ProjectContainerShip/Resources/30px_arrow_up.png"/>
|
||||||
|
<text value=""/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="b4b3c" class="javax.swing.JButton" binding="buttonStrategyStep">
|
||||||
|
<constraints>
|
||||||
|
<grid row="1" column="4" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<label value="Шаг"/>
|
||||||
|
<text value="Шаг"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="aeb6b" class="javax.swing.JComboBox" binding="comboBoxStrategy">
|
||||||
|
<constraints>
|
||||||
|
<grid row="0" column="3" row-span="1" col-span="3" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties/>
|
||||||
|
</component>
|
||||||
|
<vspacer id="396ed">
|
||||||
|
<constraints>
|
||||||
|
<grid row="2" column="4" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
</vspacer>
|
||||||
|
<component id="c737e" class="javax.swing.JButton" binding="buttonCreateShip">
|
||||||
|
<constraints>
|
||||||
|
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<doubleBuffered value="false"/>
|
||||||
|
<text value="Создать Корабль"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
<component id="b8ca7" class="javax.swing.JButton" binding="buttonCreateContainerShip">
|
||||||
|
<constraints>
|
||||||
|
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||||
|
</constraints>
|
||||||
|
<properties>
|
||||||
|
<doubleBuffered value="false"/>
|
||||||
|
<text value="Создать Контейнеровоз"/>
|
||||||
|
</properties>
|
||||||
|
</component>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</children>
|
||||||
|
</grid>
|
||||||
|
</form>
|
160
ProjectContainerShip/src/FormContainerShip.java
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
package ProjectContainerShip.src;
|
||||||
|
|
||||||
|
import ProjectContainerShip.src.Drawings.*;
|
||||||
|
import ProjectContainerShip.src.MovementStrategy.*;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class FormContainerShip extends JFrame {
|
||||||
|
protected DrawningShip _drawningShip;
|
||||||
|
private AbstractStrategy _strategy;
|
||||||
|
JPanel PanelWrapper;
|
||||||
|
private JPanel PictureBox;
|
||||||
|
private JButton buttonCreateContainerShip;
|
||||||
|
private JButton buttonCreateShip;
|
||||||
|
private JButton buttonRight;
|
||||||
|
private JButton buttonDown;
|
||||||
|
private JButton buttonLeft;
|
||||||
|
private JButton buttonUp;
|
||||||
|
private JButton buttonStrategyStep;
|
||||||
|
private JComboBox comboBoxStrategy;
|
||||||
|
|
||||||
|
private List<JComponent> controls;
|
||||||
|
|
||||||
|
public void createObject(String obj){
|
||||||
|
Random rand = new Random();
|
||||||
|
switch(obj){
|
||||||
|
case "Ship":
|
||||||
|
_drawningShip = new DrawningShip(rand.nextInt(100, 300), rand.nextDouble(1000, 3000),
|
||||||
|
new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255)), rand.nextInt(0, 3));
|
||||||
|
break;
|
||||||
|
case "ContainerShip":
|
||||||
|
_drawningShip = new DrawningContainerShip(rand.nextInt(100, 300), rand.nextDouble(1000, 3000),
|
||||||
|
new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255)), rand.nextInt(0, 3),
|
||||||
|
new Color(rand.nextInt(255), rand.nextInt(255), rand.nextInt(255)),
|
||||||
|
rand.nextBoolean(), rand.nextBoolean());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_drawningShip.SetPictureSize(PictureBox.getWidth(), PictureBox.getHeight());
|
||||||
|
_drawningShip.SetPosition(rand.nextInt(50), rand.nextInt(50));
|
||||||
|
_strategy = null;
|
||||||
|
comboBoxStrategy.setEnabled(true);
|
||||||
|
Draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FormContainerShip() {
|
||||||
|
buttonUp.setName("buttonUp");
|
||||||
|
buttonDown.setName("buttonDown");
|
||||||
|
buttonLeft.setName("buttonLeft");
|
||||||
|
buttonRight.setName("buttonRight");
|
||||||
|
|
||||||
|
InitializeControlsRepaintList();
|
||||||
|
|
||||||
|
buttonCreateContainerShip.addActionListener(e -> createObject("ContainerShip"));
|
||||||
|
|
||||||
|
buttonCreateShip.addActionListener(e -> createObject("Ship"));
|
||||||
|
ActionListener buttonMoveClickedListener = e -> {
|
||||||
|
String buttonName = ((JButton) e.getSource()).getName();
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
|
switch (buttonName) {
|
||||||
|
case "buttonUp": {
|
||||||
|
result = _drawningShip.MoveTransport(DirectionType.Up);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "buttonDown": {
|
||||||
|
result = _drawningShip.MoveTransport(DirectionType.Down);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "buttonLeft": {
|
||||||
|
result = _drawningShip.MoveTransport(DirectionType.Left);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "buttonRight": {
|
||||||
|
result = _drawningShip.MoveTransport(DirectionType.Right);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (result)
|
||||||
|
Draw();
|
||||||
|
|
||||||
|
};
|
||||||
|
buttonRight.addActionListener(buttonMoveClickedListener);
|
||||||
|
buttonDown.addActionListener(buttonMoveClickedListener);
|
||||||
|
buttonLeft.addActionListener(buttonMoveClickedListener);
|
||||||
|
buttonUp.addActionListener(buttonMoveClickedListener);
|
||||||
|
|
||||||
|
|
||||||
|
comboBoxStrategy.addItem("К Центру");
|
||||||
|
comboBoxStrategy.addItem("К Краю");
|
||||||
|
buttonStrategyStep.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
if (_drawningShip == null){return;}
|
||||||
|
if (comboBoxStrategy.isEnabled()){
|
||||||
|
switch (comboBoxStrategy.getSelectedIndex()){
|
||||||
|
case 0:
|
||||||
|
_strategy = new MoveToCenter();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
_strategy = new MoveToBorder();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
_strategy = null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (_strategy == null) {return;}
|
||||||
|
_strategy.SetData(new MovableShip(_drawningShip), PictureBox.getWidth(), PictureBox.getHeight());
|
||||||
|
}
|
||||||
|
if (_strategy == null) {return;}
|
||||||
|
_strategy.MakeStep();
|
||||||
|
Draw();
|
||||||
|
comboBoxStrategy.setEnabled(false);
|
||||||
|
if (_strategy.GetStatus() == StrategyStatus.Finish) {
|
||||||
|
comboBoxStrategy.setEnabled(true);
|
||||||
|
_strategy = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
private void Draw() {
|
||||||
|
if (_drawningShip.getEntityShip() == null)
|
||||||
|
return;
|
||||||
|
if (PictureBox.getWidth() == 0 || PictureBox.getHeight() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Graphics g = PictureBox.getGraphics();
|
||||||
|
g.setColor(PictureBox.getBackground());
|
||||||
|
g.fillRect(0, 0, PictureBox.getWidth(), PictureBox.getHeight());
|
||||||
|
_drawningShip.DrawShip(g);
|
||||||
|
|
||||||
|
RepaintControls();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RepaintControls() {
|
||||||
|
for (JComponent control : controls) {
|
||||||
|
control.repaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void InitializeControlsRepaintList() {
|
||||||
|
controls = new LinkedList<>();
|
||||||
|
controls.add(buttonCreateContainerShip);
|
||||||
|
controls.add(buttonCreateShip);
|
||||||
|
controls.add(buttonUp);
|
||||||
|
controls.add(buttonDown);
|
||||||
|
controls.add(buttonLeft);
|
||||||
|
controls.add(buttonRight);
|
||||||
|
}
|
||||||
|
}
|
@ -11,5 +11,6 @@ public class Main {
|
|||||||
frame.pack();
|
frame.pack();
|
||||||
frame.setSize(700, 500);
|
frame.setSize(700, 500);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,60 @@
|
|||||||
|
package ProjectContainerShip.src.MovementStrategy;
|
||||||
|
|
||||||
|
import ProjectContainerShip.src.Drawings.DirectionType;
|
||||||
|
public abstract class AbstractStrategy {
|
||||||
|
private IMoveableObject _movableObject;
|
||||||
|
private StrategyStatus _state = StrategyStatus.NotInit;
|
||||||
|
protected int FieldWidth;
|
||||||
|
protected int FieldHeight;
|
||||||
|
public StrategyStatus GetStatus() { return _state; }
|
||||||
|
|
||||||
|
public void SetData(IMoveableObject movableObject, int width, int height) {
|
||||||
|
if (movableObject == null)
|
||||||
|
{
|
||||||
|
_state = StrategyStatus.NotInit;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_state = StrategyStatus.InProgress;
|
||||||
|
_movableObject = movableObject;
|
||||||
|
FieldHeight = height;
|
||||||
|
FieldWidth = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MakeStep() {
|
||||||
|
if (_state != StrategyStatus.InProgress) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (IsTargetDestination()) {
|
||||||
|
_state = StrategyStatus.Finish;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
MoveToTarget();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean MoveLeft() { return MoveTo(DirectionType.Left); }
|
||||||
|
protected boolean MoveRight() { return MoveTo(DirectionType.Right); }
|
||||||
|
protected boolean MoveUp() { return MoveTo(DirectionType.Up); }
|
||||||
|
protected boolean MoveDown() { return MoveTo(DirectionType.Down); }
|
||||||
|
|
||||||
|
protected ObjectParameters GetObjectParameters() { return _movableObject.GetObjectPosition(); }
|
||||||
|
|
||||||
|
protected int GetStep() {
|
||||||
|
if(_state != StrategyStatus.InProgress) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return _movableObject.GetStep();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void MoveToTarget();
|
||||||
|
protected abstract boolean IsTargetDestination();
|
||||||
|
private boolean MoveTo(DirectionType directionType) {
|
||||||
|
if (_state != StrategyStatus.InProgress) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_movableObject.TryMoveObject(directionType)) {
|
||||||
|
_movableObject.MoveObject(directionType);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package ProjectContainerShip.src.MovementStrategy;
|
||||||
|
|
||||||
|
import ProjectContainerShip.src.Drawings.DirectionType;
|
||||||
|
public interface IMoveableObject {
|
||||||
|
ObjectParameters GetObjectPosition();
|
||||||
|
int GetStep();
|
||||||
|
boolean TryMoveObject(DirectionType direction);
|
||||||
|
void MoveObject(DirectionType direction);
|
||||||
|
}
|
30
ProjectContainerShip/src/MovementStrategy/MovableShip.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package ProjectContainerShip.src.MovementStrategy;
|
||||||
|
|
||||||
|
import ProjectContainerShip.src.Drawings.DirectionType;
|
||||||
|
import ProjectContainerShip.src.Drawings.DrawningShip;
|
||||||
|
|
||||||
|
public class MovableShip implements IMoveableObject {
|
||||||
|
private DrawningShip _ship = null;
|
||||||
|
public MovableShip(DrawningShip train){
|
||||||
|
_ship = train;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ObjectParameters GetObjectPosition() {
|
||||||
|
if (_ship == null || _ship.getEntityShip() == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return new ObjectParameters(_ship.getPosX(), _ship.getPosY(), _ship.getTrainWidth(), _ship.getTrainHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
public int GetStep() {
|
||||||
|
return (int) _ship.getEntityShip().Step();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean TryMoveObject(DirectionType direction) {
|
||||||
|
return _ship.MoveTransport(direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void MoveObject(DirectionType direction) {
|
||||||
|
_ship.MoveTransport(direction);
|
||||||
|
}
|
||||||
|
}
|
27
ProjectContainerShip/src/MovementStrategy/MoveToBorder.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package ProjectContainerShip.src.MovementStrategy;
|
||||||
|
|
||||||
|
public class MoveToBorder extends AbstractStrategy {
|
||||||
|
protected boolean IsTargetDestination() {
|
||||||
|
var objParams = GetObjectParameters();
|
||||||
|
if (objParams == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return objParams.RightBorder() <= FieldWidth && objParams.RightBorder() + GetStep() >= FieldWidth &&
|
||||||
|
objParams.DownBorder() <= FieldHeight && objParams.DownBorder() + GetStep() >= FieldHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void MoveToTarget(){
|
||||||
|
var objParams = GetObjectParameters();
|
||||||
|
if (objParams == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int diffX = objParams.RightBorder() - FieldWidth;
|
||||||
|
if (Math.abs(diffX) > GetStep()){
|
||||||
|
MoveRight();
|
||||||
|
}
|
||||||
|
int diffY = objParams.DownBorder() - FieldHeight;
|
||||||
|
if (Math.abs(diffY) > GetStep()){
|
||||||
|
MoveDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
ProjectContainerShip/src/MovementStrategy/MoveToCenter.java
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package ProjectContainerShip.src.MovementStrategy;
|
||||||
|
|
||||||
|
public class MoveToCenter extends AbstractStrategy {
|
||||||
|
protected boolean IsTargetDestination(){
|
||||||
|
var objParams = GetObjectParameters();
|
||||||
|
if (objParams == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return objParams.ObjectMidHorizontal() - GetStep() <= FieldWidth / 2 &&
|
||||||
|
objParams.ObjectMidHorizontal() + GetStep() >= FieldWidth / 2 &&
|
||||||
|
objParams.ObjectMidVertical() - GetStep() <= FieldHeight / 2 &&
|
||||||
|
objParams.ObjectMidVertical() + GetStep() >= FieldHeight / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void MoveToTarget(){
|
||||||
|
var objParams = GetObjectParameters();
|
||||||
|
if (objParams == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int diffX = objParams.ObjectMidHorizontal() - FieldWidth / 2;
|
||||||
|
if (Math.abs(diffX) > GetStep()){
|
||||||
|
if (diffX > 0){
|
||||||
|
MoveLeft();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
MoveRight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int diffY = objParams.ObjectMidVertical() - FieldHeight / 2;
|
||||||
|
if (Math.abs(diffY) > GetStep()){
|
||||||
|
if (diffY > 0){
|
||||||
|
MoveUp();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
MoveDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
package ProjectContainerShip.src.MovementStrategy;
|
||||||
|
|
||||||
|
public enum MovementDirection {
|
||||||
|
Up,
|
||||||
|
Down,
|
||||||
|
Left,
|
||||||
|
Right
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package ProjectContainerShip.src.MovementStrategy;
|
||||||
|
|
||||||
|
public class ObjectParameters {
|
||||||
|
private int _x;
|
||||||
|
private int _y;
|
||||||
|
private int _width;
|
||||||
|
private int _height;
|
||||||
|
|
||||||
|
public int LeftBorder(){return _x;};
|
||||||
|
public int TopBorder(){return _y;};
|
||||||
|
public int RightBorder(){return _x + _width;};
|
||||||
|
public int DownBorder(){return _y + _height;};
|
||||||
|
|
||||||
|
public int ObjectMidHorizontal(){return _x + _width / 2;};
|
||||||
|
public int ObjectMidVertical(){return _y + _height / 2;};
|
||||||
|
|
||||||
|
public ObjectParameters(int x, int y, int width, int height){
|
||||||
|
_x = x;
|
||||||
|
_y = y;
|
||||||
|
_width = width;
|
||||||
|
_height = height;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package ProjectContainerShip.src.MovementStrategy;
|
||||||
|
|
||||||
|
public enum StrategyStatus {
|
||||||
|
NotInit,
|
||||||
|
InProgress,
|
||||||
|
Finish
|
||||||
|
}
|
26
out/production/Lab(HARD)/.gitignore
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# ---> Java
|
||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
replay_pid*
|
||||||
|
|
3
out/production/Lab(HARD)/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
11
out/production/Lab(HARD)/.idea/Lab(HARD).iml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="21" jdkType="JavaSDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
6
out/production/Lab(HARD)/.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
out/production/Lab(HARD)/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/Lab(HARD).iml" filepath="$PROJECT_DIR$/.idea/Lab(HARD).iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
124
out/production/Lab(HARD)/.idea/uiDesigner.xml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Palette2">
|
||||||
|
<group name="Swing">
|
||||||
|
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Button" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="RadioButton" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="CheckBox" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||||
|
<initial-values>
|
||||||
|
<property name="text" value="Label" />
|
||||||
|
</initial-values>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||||
|
<preferred-size width="150" height="-1" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||||
|
<preferred-size width="150" height="50" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||||
|
<preferred-size width="200" height="200" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||||
|
<preferred-size width="-1" height="20" />
|
||||||
|
</default-constraints>
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||||
|
</item>
|
||||||
|
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||||
|
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||||
|
</item>
|
||||||
|
</group>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
out/production/Lab(HARD)/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
29
out/production/Lab(HARD)/ProjectContainerShip/.gitignore
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
### IntelliJ IDEA ###
|
||||||
|
out/
|
||||||
|
!**/src/main/**/out/
|
||||||
|
!**/src/test/**/out/
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
bin/
|
||||||
|
!**/src/main/**/bin/
|
||||||
|
!**/src/test/**/bin/
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
3
out/production/Lab(HARD)/ProjectContainerShip/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/ProjectContainerShip.iml" filepath="$PROJECT_DIR$/ProjectContainerShip.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
After Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 249 B |
After Width: | Height: | Size: 254 B |
After Width: | Height: | Size: 257 B |
2
out/production/Lab(HARD)/README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# PIBD-12_Morozov_D.V._Hard
|
||||||
|
|