major updates, moved to socket client-server connections, added all commands, fs control

This commit is contained in:
Alexander Karpov 2024-02-07 16:51:14 +03:00
parent d9f51a1a21
commit 85615bea25
109 changed files with 2250 additions and 335 deletions

16
.idea/compiler.xml Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="lab5" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="itmo-prog-lab-5" target="1.5" />
</bytecodeTargetLevel>
</component>
</project>

20
.idea/jarRepositories.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

View File

@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/itmo-prog-lab-5.iml" filepath="$PROJECT_DIR$/itmo-prog-lab-5.iml" />
</modules>
</component>
</project>

View File

@ -5,13 +5,37 @@
</component>
<component name="ChangeListManager">
<list default="true" id="4f3a5547-ba17-42ad-9cfe-ccdc381c7dc5" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/itmo-prog-lab-5.iml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/Main.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/jarRepositories.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/Main.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/client/ClientApp.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/common/models/Coordinates.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/common/models/Event.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/server/CollectionManager.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/server/FileManager.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/server/ServerApp.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/server/commands/Command.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/server/commands/HelpCommand.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/src/main/java/server/commands/ShowCommand.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/itmo-prog-lab-5.iml" beforeDir="false" afterPath="$PROJECT_DIR$/itmo-prog-lab-5.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Main.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/client/ClientApp.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/client/ConsoleManager.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/client/ConsoleManager.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/common/enums/TicketType.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/common/enums/TicketType.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/common/models/Coordinates.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/common/models/Event.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/common/models/Ticket.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/common/models/Ticket.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/common/utils/TicketComparator.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/common/utils/TicketComparator.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/server/CollectionManager.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/server/CommandProcessor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/server/CommandProcessor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/server/FileManager.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/server/ServerApp.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/server/commands/Command.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/server/commands/HelpCommand.java" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/src/server/commands/ShowCommand.java" beforeDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -32,9 +56,9 @@
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 2
}]]></component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 2
}</component>
<component name="ProjectId" id="2c0VemoZcpyCQjJpTj6tw8sHgOH" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
@ -46,8 +70,11 @@
"Application.Main.executor": "Run",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"WebServerToolWindowFactoryState": "false",
"git-widget-placeholder": "master",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "/home/sanspie/Projects/itmo-prog-lab-5",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
@ -56,10 +83,15 @@
"project.structure.last.edited": "Project",
"project.structure.proportion": "0.0",
"project.structure.side.proportion": "0.0",
"settings.editor.selected.configurable": "preferences.lookFeel",
"settings.editor.selected.configurable": "preferences.pluginManager",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/src/main/java" />
</key>
</component>
<component name="RunManager">
<configuration name="Main" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="Main" />
@ -91,6 +123,9 @@
<option name="presentableId" value="Default" />
<updated>1707248583469</updated>
<workItem from="1707248584490" duration="9894000" />
<workItem from="1707302524450" duration="5396000" />
<workItem from="1707309325271" duration="459000" />
<workItem from="1707309800749" duration="3973000" />
</task>
<servers />
</component>

View File

@ -1,11 +1,8 @@
<?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$">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

59
pom.xml Normal file
View File

@ -0,0 +1,59 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.akarpov.lab5</groupId>
<artifactId>lab5</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>15</source>
<target>15</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>exec-java-server</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>Main</mainClass>
<arguments>
<argument>server</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>exec-java-client</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>Main</mainClass>
<arguments>
<argument>client</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,10 +0,0 @@
import client.ClientApp;
import server.ServerApp;
public class Main {
public static void main(String[] args) {
ServerApp serverApp = new ServerApp();
ClientApp clientApp = new ClientApp(serverApp);
clientApp.start();
}
}

View File

@ -1,46 +0,0 @@
package client;
import server.ServerApp;
import java.util.Scanner;
public class ClientApp {
private ServerApp serverApp;
private Scanner scanner;
public ClientApp(ServerApp serverApp) {
this.serverApp = serverApp;
this.scanner = new Scanner(System.in);
}
public void start() {
System.out.println("Клиент запущен. Введите 'exit' для выхода.");
while (true) {
System.out.print("Введите команду: ");
if (!scanner.hasNextLine()) { // Проверка на EOF
System.out.println("Клиент завершает работу из-за отсутствия входных данных.");
break;
}
String input = scanner.nextLine();
if ("exit".equalsIgnoreCase(input)) {
System.out.println("Клиент завершает работу.");
break;
}
String[] parts = input.split(" ", 2);
String commandName = parts[0];
String[] args = parts.length > 1 ? new String[]{parts[1]} : new String[]{};
String response = sendCommand(commandName, args);
System.out.println(response);
}
}
public String sendCommand(String commandName, String[] args) {
return serverApp.executeCommand(commandName, args);
}
public static void main(String[] args) {
ServerApp serverApp = new ServerApp();
ClientApp clientApp = new ClientApp(serverApp);
clientApp.start();
}
}

View File

@ -1,26 +0,0 @@
package client;
import java.util.Scanner;
public class ConsoleManager {
private final ClientApp clientApp;
private final Scanner scanner;
public ConsoleManager(ClientApp clientApp) {
this.clientApp = clientApp;
this.scanner = new Scanner(System.in);
}
public void run() {
while (true) {
System.out.print("Введите команду: ");
String input = scanner.nextLine();
if ("exit".equalsIgnoreCase(input)) break;
String[] parts = input.split(" ", 2);
String commandName = parts[0];
String[] args = parts.length > 1 ? new String[]{parts[1]} : new String[]{};
String response = clientApp.sendCommand(commandName, args);
System.out.println(response);
}
}
}

View File

@ -1,29 +0,0 @@
package common.models;
public class Coordinates {
private double x;
private float y;
// Конструктор
public Coordinates(double x, float y) {
this.x = x;
this.y = y;
}
// Геттеры и сеттеры
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public float getY() {
return y;
}
public void setY(float y) {
this.y = y;
}
}

View File

@ -1,37 +0,0 @@
package common.models;
public class Event {
private long id;
private String name;
private int ticketCount;
public Event(long id, String name, int ticketCount) {
this.id = id;
this.name = name;
this.ticketCount = ticketCount;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getTicketCount() {
return ticketCount;
}
public void setTicketCount(int ticketCount) {
this.ticketCount = ticketCount;
}
}

31
src/main/java/Main.java Normal file
View File

@ -0,0 +1,31 @@
import client.ClientApp;
import server.ServerApp;
public class Main {
public static void main(String[] args) {
if (args.length > 0) {
switch (args[0]) {
case "server" -> startServer();
case "client" -> {
if (args.length >= 3) {
startClient(args[1], Integer.parseInt(args[2]));
} else {
System.out.println("Необходимо указать адрес сервера и порт для клиента. Например: client localhost 4444");
}
}
default -> System.out.println("Неизвестный режим: " + args[0]);
}
} else {
System.out.println("Необходимо указать режим работы: server или client");
}
}
private static void startServer() {
ServerApp server = new ServerApp(4444);
server.start();
}
private static void startClient(String host, int port) {
ClientApp client = new ClientApp(host, port);
client.main(new String[]{});
}
}

View File

@ -0,0 +1,35 @@
package client;
import java.io.*;
import java.net.Socket;
public class ClientApp {
private String host;
private int port;
public ClientApp(String host, int port) {
this.host = host;
this.port = port;
}
public void main(String[] args) {
try (Socket socket = new Socket(host, port);
PrintWriter out = new PrintWriter(socket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in))) {
System.out.println("Подключен к серверу " + host + " на порту " + port);
String userInput;
System.out.println("Введите 'exit' для выхода.");
while ((userInput = stdIn.readLine()) != null) {
out.println(userInput);
System.out.println("Ответ сервера: " + in.readLine());
if ("exit".equalsIgnoreCase(userInput)) {
break;
}
}
} catch (IOException e) {
System.out.println("Не удалось подключиться к серверу " + host + " на порту " + port + ": " + e.getMessage());
}
}
}

View File

@ -0,0 +1,63 @@
package client;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
public class ConsoleManager {
private final Socket socket;
private final PrintWriter out;
private final BufferedReader in;
private final BufferedReader consoleReader;
public ConsoleManager(String host, int port) throws IOException {
this.socket = new Socket(host, port);
this.out = new PrintWriter(socket.getOutputStream(), true);
this.in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
this.consoleReader = new BufferedReader(new InputStreamReader(System.in));
}
public void run() {
System.out.println("Клиент запущен. Введите команду (введите 'exit' для выхода):");
try {
while (true) {
String userInput = consoleReader.readLine();
if (userInput != null && !userInput.isEmpty()) {
out.println(userInput); // Отправляем команду на сервер
if ("exit".equalsIgnoreCase(userInput)) {
// Клиент закрыл соединение, но сервер должен продолжать работать
break;
}
String response = in.readLine(); // Читаем ответ от сервера
System.out.println("Ответ сервера: " + response);
}
}
} catch (IOException e) {
System.out.println("Ошибка при общении с сервером: " + e.getMessage());
} finally {
try {
socket.close();
out.close();
in.close();
consoleReader.close();
} catch (IOException e) {
System.out.println("Ошибка при закрытии ресурсов: " + e.getMessage());
}
}
}
public static void main(String[] args) {
try {
ConsoleManager consoleManager = new ConsoleManager("localhost", 4444);
consoleManager.run();
} catch (IOException e) {
System.out.println("Не удалось подключиться к серверу: " + e.getMessage());
}
}
}

View File

@ -0,0 +1,39 @@
package common;
import common.enums.TicketType;
import common.models.Coordinates;
import common.models.Ticket;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.PrintWriter;
public class Protocol {
public String processInput(String input) {
return "Processed input: " + input;
}
public String createTicket(String input, PrintWriter out, BufferedReader in) throws IOException {
// Псевдокод для демонстрации запроса данных у клиента
String name = askClient("Введите название билета:", out, in);
String xStr = askClient("Введите координату X:", out, in);
int x = Integer.parseInt(xStr);
// Дополнительные поля аналогично
// Создаем объект Ticket после получения всех необходимых данных
Ticket ticket = new Ticket(
name,
new Coordinates(x, 0), // TODO: handle y
new Long(10000),
new Long(100),
TicketType.CHEAP,
null
);
return "Билет создан успешно.";
}
private String askClient(String question, PrintWriter out, BufferedReader in) throws IOException {
out.println(question); // Отправляем запрос клиенту
return in.readLine(); // Ждем ответ от клиента
}
}

View File

@ -0,0 +1,8 @@
package common.enums;
public enum EventType {
E_SPORTS,
FOOTBALL,
BASEBALL,
EXPOSITION;
}

View File

@ -0,0 +1,29 @@
package common.models;
public class Coordinates {
private int x; // Максимальное значение поля: 794
private int y;
public Coordinates(int x, int y) {
this.x = Math.min(x, 794); // Обеспечиваем, что x не превышает 794
this.y = y;
}
// Геттеры
public int getX() {
return x;
}
public int getY() {
return y;
}
// Сеттеры
public void setX(int x) {
this.x = Math.min(x, 794);
}
public void setY(int y) {
this.y = y;
}
}

View File

@ -0,0 +1,60 @@
package common.models;
import common.enums.EventType;
public class Event {
private int id; // Уникальное значение, генерируется автоматически
private String name;
private long ticketsCount;
private String description;
private EventType eventType;
public Event(int id, String name, long ticketsCount, String description, EventType eventType) {
this.id = id;
this.name = name;
this.ticketsCount = ticketsCount;
this.description = description;
this.eventType = eventType;
}
// Геттеры и сеттеры
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public long getTicketsCount() {
return ticketsCount;
}
public void setTicketsCount(long ticketsCount) {
this.ticketsCount = ticketsCount;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public EventType getEventType() {
return eventType;
}
public void setEventType(EventType eventType) {
this.eventType = eventType;
}
}

View File

@ -5,21 +5,21 @@ import common.enums.TicketType;
import java.time.LocalDate;
public class Ticket implements Comparable<Ticket> {
private static long nextId = 1;
private final long id;
private long id;
private String name;
private Coordinates coordinates;
private final LocalDate creationDate;
private LocalDate creationDate;
private Long price;
private Long discount;
private TicketType type;
private Event event;
private Event event; // Предположим, что класс Event также определен
// Конструктор
public Ticket(String name, Coordinates coordinates, Long price, Long discount, TicketType type, Event event) {
this.id = nextId++;
this.id = 1; // TODO: generate automatically
this.name = name;
this.coordinates = coordinates;
this.creationDate = LocalDate.now();
this.creationDate = LocalDate.now(); // Дата создания
this.price = price;
this.discount = discount;
this.type = type;

View File

@ -0,0 +1,44 @@
// ClientHandler.java
package server;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
public class ClientHandler implements Runnable {
private Socket clientSocket;
public ClientHandler(Socket clientSocket) {
this.clientSocket = clientSocket;
}
@Override
public void run() {
try (
PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()))
) {
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println("Получено от клиента: " + inputLine);
out.println("Сервер получил: " + inputLine);
// Если клиент отключился, выходим из цикла
if (inputLine.equalsIgnoreCase("exit")) {
break;
}
}
} catch (IOException e) {
System.out.println("Ошибка при обработке клиента: " + e.getMessage());
} finally {
try {
clientSocket.close();
System.out.println("Клиент отключен");
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@ -0,0 +1,173 @@
package server;
import common.enums.EventType;
import common.models.Coordinates;
import common.models.Event;
import common.models.Ticket;
import common.enums.TicketType;
import java.util.ArrayDeque;
import java.util.Comparator;
import java.util.Scanner;
import java.util.stream.Collectors;
public class CollectionManager {
private ArrayDeque<Ticket> tickets;
private FileManager fileManager;
private Scanner scanner = new Scanner(System.in);
public CollectionManager(FileManager fileManager) {
this.fileManager = fileManager;
this.tickets = fileManager.loadCollection();
}
public String addTicket(Ticket ticket) {
tickets.add(ticket);
return "Ticket added successfully.";
}
public String updateTicketById(long id, Ticket newTicket) {
for (Ticket ticket : tickets) {
if (ticket.getId() == id) {
tickets.remove(ticket);
tickets.add(newTicket);
return "Ticket updated successfully.";
}
}
return "Ticket with ID " + id + " not found.";
}
public String removeTicketById(long id) {
if (tickets.removeIf(ticket -> ticket.getId() == id)) {
return "Ticket removed successfully.";
}
return "Ticket with ID " + id + " not found.";
}
public String clear() {
tickets.clear();
return "Collection cleared.";
}
public String show() {
return tickets.stream()
.map(Ticket::toString)
.collect(Collectors.joining("\n"));
}
public String getInfo() {
return "Collection type: " + tickets.getClass() + "\n" +
"Initialization date: " + /* initialization date here */ "\n" +
"Number of elements: " + tickets.size();
}
public String saveCollection() {
fileManager.saveCollection(tickets);
return "Collection saved.";
}
public String removeHead() {
if (tickets.isEmpty()) return "Collection is empty.";
Ticket first = tickets.poll();
return (first != null) ? first.toString() : "Collection is empty.";
}
public String addIfMin(Ticket newTicket) {
Ticket min = tickets.stream().min(Comparator.naturalOrder()).orElse(null);
if (min == null || newTicket.compareTo(min) < 0) {
tickets.add(newTicket);
return "Ticket added successfully.";
}
return "New ticket is not less than the smallest ticket in the collection.";
}
public String removeGreater(Ticket ticket) {
int initialSize = tickets.size();
tickets.removeIf(t -> t.compareTo(ticket) > 0);
return "Removed " + (initialSize - tickets.size()) + " tickets.";
}
public String groupCountingByType() {
return tickets.stream()
.collect(Collectors.groupingBy(Ticket::getType, Collectors.counting()))
.entrySet().stream()
.map(entry -> entry.getKey() + ": " + entry.getValue())
.collect(Collectors.joining("\n"));
}
public String filterByEvent(String eventName) {
return tickets.stream()
.filter(ticket -> ticket.getEvent() != null && ticket.getEvent().getName().equals(eventName))
.map(Ticket::toString)
.collect(Collectors.joining("\n"));
}
public String filterLessThanType(String typeStr) {
TicketType type;
try {
type = TicketType.valueOf(typeStr.toUpperCase());
} catch (IllegalArgumentException e) {
return "Invalid ticket type: " + typeStr;
}
return tickets.stream()
.filter(ticket -> ticket.getType() != null && ticket.getType().compareTo(type) < 0)
.map(Ticket::toString)
.collect(Collectors.joining("\n"));
}
public Ticket createTicket() {
System.out.println("Введите название билета:");
String name = scanner.nextLine().trim();
while (name.isEmpty()) {
System.out.println("Название не может быть пустым. Пожалуйста, введите название билета:");
name = scanner.nextLine().trim();
}
System.out.println("Введите координату x (целое число <= 794):");
int x = scanner.nextInt();
while (x > 794) {
System.out.println("Координата x должна быть <= 794. Пожалуйста, введите координату x:");
x = scanner.nextInt();
}
System.out.println("Введите координату y (целое число):");
int y = scanner.nextInt();
scanner.nextLine(); // очистка буфера
System.out.println("Введите цену билета (положительное число или оставьте пустым):");
String priceInput = scanner.nextLine().trim();
Long price = priceInput.isEmpty() ? null : Long.parseLong(priceInput);
System.out.println("Введите скидку на билет (от 0 до 100 или оставьте пустым):");
String discountInput = scanner.nextLine().trim();
Long discount = discountInput.isEmpty() ? null : Long.parseLong(discountInput);
System.out.println("Выберите тип билета (VIP, USUAL, BUDGETARY, CHEAP или оставьте пустым):");
TicketType type = null;
String typeStr = scanner.nextLine().trim().toUpperCase();
if (!typeStr.isEmpty()) {
type = TicketType.valueOf(typeStr);
}
// Для Event и EventType можно добавить аналогичный процесс ввода
// Предполагаем, что для Event нужно ввести дополнительные данные, например, название события
System.out.println("Введите название события (или оставьте пустым):");
String eventName = scanner.nextLine().trim();
Event event = null;
if (!eventName.isEmpty()) {
// Здесь должна быть логика создания объекта Event на основе введенных данных
event = new Event(
1, // TODO: сгенерировать ID автоматически
eventName,
1000,
"Some event",
EventType.BASEBALL
);
}
// Предполагается, что ID генерируется автоматически
// Дата создания устанавливается текущей датой
return new Ticket(name, new Coordinates(x, y), price, discount, type, event);
}
}

View File

@ -0,0 +1,66 @@
package server;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayDeque;
import common.models.Ticket;
public class FileManager {
private String fileName;
public FileManager(String fileName) {
this.fileName = fileName;
}
public ArrayDeque<Ticket> loadCollection() {
ArrayDeque<Ticket> tickets = new ArrayDeque<>();
try {
File file = new File(fileName);
if (file.exists()) {
JAXBContext jaxbContext = JAXBContext.newInstance(TicketsCollectionWrapper.class);
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
TicketsCollectionWrapper wrapper = (TicketsCollectionWrapper) unmarshaller.unmarshal(new FileReader(fileName));
tickets.addAll(wrapper.getTickets());
}
} catch (JAXBException | IOException e) {
System.err.println("Ошибка при загрузке коллекции из файла: " + e.getMessage());
}
return tickets;
}
public void saveCollection(ArrayDeque<Ticket> tickets) {
try {
JAXBContext jaxbContext = JAXBContext.newInstance(TicketsCollectionWrapper.class);
Marshaller marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
TicketsCollectionWrapper wrapper = new TicketsCollectionWrapper();
wrapper.setTickets(new ArrayDeque<>(tickets));
marshaller.marshal(wrapper, new FileWriter(fileName));
} catch (JAXBException | IOException e) {
System.err.println("Ошибка при сохранении коллекции в файл: " + e.getMessage());
}
}
// Вспомогательный класс для обертки коллекции Ticket для JAXB
@XmlRootElement(name = "tickets")
public static class TicketsCollectionWrapper {
private ArrayDeque<Ticket> tickets;
@XmlElement(name = "ticket")
public ArrayDeque<Ticket> getTickets() {
return tickets;
}
public void setTickets(ArrayDeque<Ticket> tickets) {
this.tickets = tickets;
}
}
}

View File

@ -0,0 +1,32 @@
package server;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
public class ServerApp {
private int port;
public ServerApp(int port) {
this.port = port;
}
public void start() {
try (ServerSocket serverSocket = new ServerSocket(port)) {
System.out.println("Сервер запущен на порту " + port);
while (true) {
Socket clientSocket = serverSocket.accept();
System.out.println("Подключился клиент: " + clientSocket);
// Создаем новый поток для обработки подключения клиента
ClientHandler clientHandler = new ClientHandler(clientSocket);
Thread thread = new Thread(clientHandler);
thread.start();
}
} catch (IOException e) {
System.out.println("Ошибка при запуске сервера: " + e.getMessage());
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,18 @@
package server.commands;
import common.models.Ticket;
import server.CollectionManager;
public class AddCommand extends Command {
public AddCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
// Допустим, что аргументы уже предварительно обработаны и переданы в нужном формате
Ticket ticket = collectionManager.createTicket(); // предполагается метод createTicket, который создает и возвращает объект Ticket
collectionManager.addTicket(ticket);
return "Элемент добавлен в коллекцию.";
}
}

View File

@ -0,0 +1,16 @@
package server.commands;
import common.models.Ticket;
import server.CollectionManager;
public class AddIfMinCommand extends Command {
public AddIfMinCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
Ticket ticket = collectionManager.createTicket(); // TODO: handle args
return collectionManager.addIfMin(ticket);
}
}

View File

@ -0,0 +1,15 @@
package server.commands;
import server.CollectionManager;
public class ClearCommand extends Command {
public ClearCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
collectionManager.clear();
return "Коллекция очищена.";
}
}

View File

@ -0,0 +1,31 @@
package server.commands;
import server.CollectionManager;
public abstract class Command {
protected String[] args;
protected CollectionManager collectionManager;
public Command(String[] args, CollectionManager collectionManager) {
this.args = args;
this.collectionManager = collectionManager;
}
public abstract String execute();
public boolean validate() {
return true;
}
public boolean requiresArguments() {
return false;
}
public String getResult() {
return "Команда выполнена.";
}
public void call() {
execute();
}
}

View File

@ -0,0 +1,15 @@
package server.commands;
import server.CollectionManager;
public class ExecuteScriptCommand extends Command {
public ExecuteScriptCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
// Логика выполнения скрипта из файла
return "Скрипт выполнен.";
}
}

View File

@ -0,0 +1,15 @@
package server.commands;
import server.CollectionManager;
public class ExitCommand extends Command {
public ExitCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
// Логика завершения работы программы
return "Программа завершена.";
}
}

View File

@ -0,0 +1,15 @@
package server.commands;
import server.CollectionManager;
public class FilterByEventCommand extends Command {
public FilterByEventCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
String event = args[0];
return collectionManager.filterByEvent(event);
}
}

View File

@ -0,0 +1,15 @@
package server.commands;
import server.CollectionManager;
public class FilterLessThanTypeCommand extends Command {
public FilterLessThanTypeCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
String type = args[0];
return collectionManager.filterLessThanType(type);
}
}

View File

@ -0,0 +1,14 @@
package server.commands;
import server.CollectionManager;
public class GroupCountingByTypeCommand extends Command {
public GroupCountingByTypeCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
return collectionManager.groupCountingByType();
}
}

View File

@ -0,0 +1,32 @@
package server.commands;
import server.CollectionManager;
public class HelpCommand extends Command {
public HelpCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
return """
Доступные команды:
help : вывести справку по доступным командам
info : вывести информацию о коллекции
show : вывести все элементы коллекции
add {element} : добавить новый элемент в коллекцию
update id {element} : обновить значение элемента коллекции
remove_by_id id : удалить элемент из коллекции по его id
clear : очистить коллекцию
save : сохранить коллекцию в файл
execute_script file_name : выполнить скрипт из файла
exit : завершить программу
remove_head : вывести и удалить первый элемент коллекции
add_if_min {element} : добавить элемент, если он меньше наименьшего
remove_greater {element} : удалить элементы, превышающие заданный
group_counting_by_type : группировать элементы по типу
filter_by_event event : фильтровать элементы по событию
filter_less_than_type type : фильтровать элементы, тип которых меньше заданного""";
}
}

View File

@ -0,0 +1,14 @@
package server.commands;
import server.CollectionManager;
public class InfoCommand extends Command {
public InfoCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
return collectionManager.getInfo();
}
}

View File

@ -0,0 +1,15 @@
package server.commands;
import server.CollectionManager;
public class RemoveByIdCommand extends Command {
public RemoveByIdCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
long id = Long.parseLong(args[0]);
return collectionManager.removeTicketById(id);
}
}

View File

@ -0,0 +1,16 @@
package server.commands;
import common.models.Ticket;
import server.CollectionManager;
public class RemoveGreaterCommand extends Command {
public RemoveGreaterCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
Ticket ticket = collectionManager.createTicket();
return collectionManager.removeGreater(ticket);
}
}

View File

@ -0,0 +1,14 @@
package server.commands;
import server.CollectionManager;
public class RemoveHeadCommand extends Command {
public RemoveHeadCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
return collectionManager.removeHead();
}
}

View File

@ -0,0 +1,16 @@
package server.commands;
import server.CollectionManager;
public class SaveCommand extends Command {
public SaveCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
collectionManager.saveCollection();
return "Коллекция сохранена в файл.";
}
}

View File

@ -0,0 +1,14 @@
package server.commands;
import server.CollectionManager;
public class ShowCommand extends Command {
public ShowCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
return collectionManager.show();
}
}

View File

@ -0,0 +1,17 @@
package server.commands;
import common.models.Ticket;
import server.CollectionManager;
public class UpdateCommand extends Command {
public UpdateCommand(String[] args, CollectionManager collectionManager) {
super(args, collectionManager);
}
@Override
public String execute() {
long id = Long.parseLong(args[0]);
Ticket newTicket = collectionManager.createTicket(); // TODO: handle args
return collectionManager.updateTicketById(id, newTicket);
}
}

View File

@ -1,37 +0,0 @@
package server;
import server.commands.Command;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
public class CollectionManager {
private static final String CLASS_PATH = "server.commands.%sCommand";
private static final String VALIDATION_ERROR_MESSAGE = "Ошибка валидации аргументов команды.";
private static final String EXECUTION_ERROR_MESSAGE = "Ошибка выполнения команды: ";
public String executeCommand(String commandName, String[] args) {
try {
Command command = createCommand(commandName, args);
if (command.validate()) {
command.call();
return command.getResult();
} else {
return VALIDATION_ERROR_MESSAGE;
}
} catch (Exception e) {
return EXECUTION_ERROR_MESSAGE + e.getMessage();
}
}
private Command createCommand(String commandName, String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
Class<?> commandClass = Class.forName(String.format(CLASS_PATH, commandName));
Constructor<?> constructor = commandClass.getConstructor(String[].class, CollectionManager.class);
return (Command) constructor.newInstance((Object) args, this);
}
public String show() {
// Your logic to display the collection
return "Элементы коллекции: ...";
}
}

View File

@ -1,36 +0,0 @@
package server;
import common.models.Ticket;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.Scanner;
public class FileManager {
private final String fileName;
public FileManager(String fileName) {
this.fileName = fileName;
}
public ArrayDeque<Ticket> loadCollection() {
ArrayDeque<Ticket> tickets = new ArrayDeque<>();
try (Scanner scanner = new Scanner(new File(fileName))) {
// Чтение и парсинг XML файла для заполнения коллекции tickets
// Примерный код, требуется реализация парсинга XML
} catch (FileNotFoundException e) {
System.err.println("Файл не найден: " + e.getMessage());
}
return tickets;
}
public void saveCollection(ArrayDeque<Ticket> tickets) {
try (OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(fileName), StandardCharsets.UTF_8)) {
// Запись коллекции tickets в файл в формате XML
// Примерный код, требуется реализация форматирования и записи XML
} catch (IOException e) {
System.err.println("Ошибка при записи файла: " + e.getMessage());
}
}
}

View File

@ -1,10 +0,0 @@
package server;
public class ServerApp {
private final CollectionManager collectionManager = new CollectionManager();
public String executeCommand(String command, String[] args) {
// Обработка команды и возвращение результата выполнения
return CommandProcessor.process(command, collectionManager);
}
}

View File

@ -1,21 +0,0 @@
package server.commands;
public abstract class Command {
protected String[] args;
protected String result;
public Command(String[] args) {
this.args = args;
}
public abstract boolean validate();
public abstract void call();
public abstract boolean requiresArguments();
public String getResult() {
return result;
}
public void setArgs(String[] args) {
}
}

View File

@ -1,27 +0,0 @@
package server.commands;
import server.CollectionManager;
public class HelpCommand extends Command {
private CollectionManager collectionManager;
public HelpCommand(CollectionManager collectionManager, String[] args) {
super(args);
this.collectionManager = collectionManager;
}
@Override
public boolean validate() {
return args.length == 0;
}
@Override
public void call() {
result = "Список доступных команд: ...";
}
@Override
public boolean requiresArguments() {
return false;
}
}

View File

@ -1,26 +0,0 @@
package server.commands;
import server.CollectionManager;
public class ShowCommand extends Command {
private CollectionManager collectionManager;
public ShowCommand(CollectionManager collectionManager, String[] args) {
super(args);
this.collectionManager = collectionManager;
}
@Override
public boolean validate() {
return args.length == 0;
}
@Override
public void call() {
result = collectionManager.show();
}
public boolean requiresArguments() {
return false;
}
}

BIN
target/classes/Main.class Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
artifactId=lab5
groupId=ru.akarpov.lab5
version=1.0-SNAPSHOT

View File

@ -0,0 +1,32 @@
server/commands/Command.class
common/utils/TicketComparator.class
server/commands/RemoveHeadCommand.class
server/commands/ClearCommand.class
server/commands/FilterByEventCommand.class
server/commands/RemoveByIdCommand.class
server/commands/AddIfMinCommand.class
Main.class
server/commands/AddCommand.class
server/commands/ShowCommand.class
server/FileManager$TicketsCollectionWrapper.class
server/commands/FilterLessThanTypeCommand.class
client/ClientApp.class
server/commands/UpdateCommand.class
common/models/Ticket.class
common/models/Event.class
common/enums/TicketType.class
client/ConsoleManager.class
server/CollectionManager.class
server/CommandProcessor.class
server/commands/SaveCommand.class
server/FileManager.class
server/ServerApp.class
server/commands/HelpCommand.class
server/commands/ExecuteScriptCommand.class
server/commands/GroupCountingByTypeCommand.class
common/models/Coordinates.class
common/enums/EventType.class
common/Protocol.class
server/commands/InfoCommand.class
server/commands/RemoveGreaterCommand.class
server/commands/ExitCommand.class

View File

@ -0,0 +1,31 @@
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/AddIfMinCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/FilterLessThanTypeCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/GroupCountingByTypeCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/UpdateCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/common/models/Event.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/ShowCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/common/enums/TicketType.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/client/ConsoleManager.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/ClearCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/common/Protocol.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/SaveCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/RemoveHeadCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/common/models/Coordinates.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/common/models/Ticket.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/FileManager.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/ServerApp.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/ExitCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/FilterByEventCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/ExecuteScriptCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/Command.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/CollectionManager.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/common/enums/EventType.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/InfoCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/HelpCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/RemoveByIdCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/Main.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/client/ClientApp.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/RemoveGreaterCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/commands/AddCommand.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/server/CommandProcessor.java
/home/sanspie/Projects/itmo-prog-lab-5/src/main/java/common/utils/TicketComparator.java

View File

@ -0,0 +1,168 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
body {
margin: 0px;
padding: 0px;
}
table {
padding:0px;
width: 100%;
margin-left: -2px;
margin-right: -2px;
}
acronym {
cursor: help;
border-bottom: 1px dotted #feb;
}
table.bodyTable th, table.bodyTable td {
padding: 2px 4px 2px 4px;
vertical-align: top;
}
div.clear {
clear:both;
visibility: hidden;
}
div.clear hr {
display: none;
}
#bannerLeft, #bannerRight {
font-size: xx-large;
font-weight: bold;
}
#bannerLeft img, #bannerRight img {
margin: 0px;
}
.xleft, #bannerLeft img {
float:left;
}
.xright, #bannerRight {
float:right;
}
#banner {
padding: 0px;
}
#breadcrumbs {
padding: 3px 10px 3px 10px;
}
#leftColumn {
width: 170px;
float:left;
overflow: auto;
}
#bodyColumn {
margin-right: 1.5em;
margin-left: 197px;
}
#legend {
padding: 8px 0 8px 0;
}
#navcolumn {
padding: 8px 4px 0 8px;
}
#navcolumn h5 {
margin: 0;
padding: 0;
font-size: small;
}
#navcolumn ul {
margin: 0;
padding: 0;
font-size: small;
}
#navcolumn li {
list-style-type: none;
background-image: none;
background-repeat: no-repeat;
background-position: 0 0.4em;
padding-left: 16px;
list-style-position: outside;
line-height: 1.2em;
font-size: smaller;
}
#navcolumn li.expanded {
background-image: url(../images/expanded.gif);
}
#navcolumn li.collapsed {
background-image: url(../images/collapsed.gif);
}
#navcolumn li.none {
text-indent: -1em;
margin-left: 1em;
}
#poweredBy {
text-align: center;
}
#navcolumn img {
margin-top: 10px;
margin-bottom: 3px;
}
#poweredBy img {
display:block;
margin: 20px 0 20px 17px;
}
#search img {
margin: 0px;
display: block;
}
#search #q, #search #btnG {
border: 1px solid #999;
margin-bottom:10px;
}
#search form {
margin: 0px;
}
#lastPublished {
font-size: x-small;
}
.navSection {
margin-bottom: 2px;
padding: 8px;
}
.navSectionHead {
font-weight: bold;
font-size: x-small;
}
.section {
padding: 4px;
}
#footer {
padding: 3px 10px 3px 10px;
font-size: x-small;
}
#breadcrumbs {
font-size: x-small;
margin: 0pt;
}
.source {
padding: 12px;
margin: 1em 7px 1em 7px;
}
.source pre {
margin: 0px;
padding: 0px;
}
#navcolumn img.imageLink, .imageLink {
padding-left: 0px;
padding-bottom: 0px;
padding-top: 0px;
padding-right: 2px;
border: 0px;
margin: 0px;
}

View File

@ -0,0 +1,161 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
body {
padding: 0px 0px 10px 0px;
}
body, td, select, input, li{
font-family: Verdana, Helvetica, Arial, sans-serif;
font-size: 13px;
}
code{
font-family: Courier, monospace;
font-size: 13px;
}
a {
text-decoration: none;
}
a:link {
color:#36a;
}
a:visited {
color:#47a;
}
a:active, a:hover {
color:#69c;
}
#legend li.externalLink {
background: url(../images/external.png) left top no-repeat;
padding-left: 18px;
}
a.externalLink, a.externalLink:link, a.externalLink:visited, a.externalLink:active, a.externalLink:hover {
background: url(../images/external.png) right center no-repeat;
padding-right: 18px;
}
#legend li.newWindow {
background: url(../images/newwindow.png) left top no-repeat;
padding-left: 18px;
}
a.newWindow, a.newWindow:link, a.newWindow:visited, a.newWindow:active, a.newWindow:hover {
background: url(../images/newwindow.png) right center no-repeat;
padding-right: 18px;
}
h2 {
padding: 4px 4px 4px 6px;
border: 1px solid #999;
color: #900;
background-color: #ddd;
font-weight:900;
font-size: x-large;
}
h3 {
padding: 4px 4px 4px 6px;
border: 1px solid #aaa;
color: #900;
background-color: #eee;
font-weight: normal;
font-size: large;
}
h4 {
padding: 4px 4px 4px 6px;
border: 1px solid #bbb;
color: #900;
background-color: #fff;
font-weight: normal;
font-size: large;
}
h5 {
padding: 4px 4px 4px 6px;
color: #900;
font-size: medium;
}
p {
line-height: 1.3em;
font-size: small;
}
#breadcrumbs {
border-top: 1px solid #aaa;
border-bottom: 1px solid #aaa;
background-color: #ccc;
}
#leftColumn {
margin: 10px 0 0 5px;
border: 1px solid #999;
background-color: #eee;
padding-bottom: 3px; /* IE-9 scrollbar-fix */
}
#navcolumn h5 {
font-size: smaller;
border-bottom: 1px solid #aaaaaa;
padding-top: 2px;
color: #000;
}
table.bodyTable th {
color: white;
background-color: #bbb;
text-align: left;
font-weight: bold;
}
table.bodyTable th, table.bodyTable td {
font-size: 1em;
}
table.bodyTable tr.a {
background-color: #ddd;
}
table.bodyTable tr.b {
background-color: #eee;
}
.source {
border: 1px solid #999;
}
dl {
padding: 4px 4px 4px 6px;
border: 1px solid #aaa;
background-color: #ffc;
}
dt {
color: #900;
}
#organizationLogo img, #projectLogo img, #projectLogo span{
margin: 8px;
}
#banner {
border-bottom: 1px solid #fff;
}
.errormark, .warningmark, .donemark, .infomark {
background: url(../images/icon_error_sml.gif) no-repeat;
}
.warningmark {
background-image: url(../images/icon_warning_sml.gif);
}
.donemark {
background-image: url(../images/icon_success_sml.gif);
}
.infomark {
background-image: url(../images/icon_info_sml.gif);
}

26
target/site/css/print.css Normal file
View File

@ -0,0 +1,26 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#banner, #footer, #leftcol, #breadcrumbs, .docs #toc, .docs .courtesylinks, #leftColumn, #navColumn {
display: none !important;
}
#bodyColumn, body.docs div.docs {
margin: 0 !important;
border: none !important
}

1
target/site/css/site.css Normal file
View File

@ -0,0 +1 @@
/* You can override this file with your own styles */

View File

@ -0,0 +1,208 @@
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.11.1 from org.apache.maven.plugins:maven-project-info-reports-plugin:3.5.0:dependencies at 2024-02-07
| Rendered using Apache Maven Default Skin
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="generator" content="Apache Maven Doxia Site Renderer 1.11.1" />
<title>lab5 &#x2013; Project Dependencies</title>
<link rel="stylesheet" href="./css/maven-base.css" />
<link rel="stylesheet" href="./css/maven-theme.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
</head>
<body class="composite">
<div id="banner">
<div id="bannerLeft">lab5
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<span id="publishDate">Last Published: 2024-02-07</span>
| <span id="projectVersion">Version: 1.0-SNAPSHOT</span>
</div>
<div class="xright"><a href="${project.url}" title="lab5">lab5</a> </div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>Project Documentation</h5>
<ul>
<li class="expanded"><a href="project-info.html" title="Project Information">Project Information</a>
<ul>
<li class="none"><strong>Dependencies</strong></li>
<li class="none"><a href="dependency-info.html" title="Dependency Information">Dependency Information</a></li>
<li class="none"><a href="index.html" title="About">About</a></li>
<li class="none"><a href="plugin-management.html" title="Plugin Management">Plugin Management</a></li>
<li class="none"><a href="plugins.html" title="Plugins">Plugins</a></li>
<li class="none"><a href="summary.html" title="Summary">Summary</a></li>
</ul></li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="poweredBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<a name="Project_Dependencies"></a><section>
<h2><a name="Project_Dependencies"></a>Project Dependencies</h2><a name="Project_Dependencies_compile"></a><section>
<h3><a name="compile"></a>compile</h3>
<p>The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:</p>
<table border="0" class="bodyTable">
<tr class="a">
<th>GroupId</th>
<th>ArtifactId</th>
<th>Version</th>
<th>Type</th>
<th>Licenses</th></tr>
<tr class="b">
<td align="left">javax.xml.bind</td>
<td><a class="externalLink" href="https://github.com/javaee/jaxb-spec/jaxb-api">jaxb-api</a></td>
<td>2.3.1</td>
<td>jar</td>
<td><a class="externalLink" href="https://oss.oracle.com/licenses/CDDL+GPL-1.1">CDDL 1.1</a><a class="externalLink" href="https://oss.oracle.com/licenses/CDDL+GPL-1.1">GPL2 w/ CPE</a></td></tr></table></section></section><a name="Project_Transitive_Dependencies"></a><section>
<h2><a name="Project_Transitive_Dependencies"></a>Project Transitive Dependencies</h2>
<p>The following is a list of transitive dependencies for this project. Transitive dependencies are the dependencies of the project dependencies.</p><a name="Project_Transitive_Dependencies_compile"></a><section>
<h3><a name="compile"></a>compile</h3>
<p>The following is a list of compile dependencies for this project. These dependencies are required to compile and run the application:</p>
<table border="0" class="bodyTable">
<tr class="a">
<th>GroupId</th>
<th>ArtifactId</th>
<th>Version</th>
<th>Type</th>
<th>Licenses</th></tr>
<tr class="b">
<td align="left">javax.activation</td>
<td><a class="externalLink" href="http://java.net/all/javax.activation-api/">javax.activation-api</a></td>
<td>1.2.0</td>
<td>jar</td>
<td><a class="externalLink" href="https://github.com/javaee/activation/blob/master/LICENSE.txt">CDDL/GPLv2+CE</a></td></tr></table></section></section><a name="Project_Dependency_Graph"></a><section>
<h2><a name="Project_Dependency_Graph"></a>Project Dependency Graph</h2><script type="text/javascript">
function toggleDependencyDetails( divId, imgId )
{
var div = document.getElementById( divId );
var img = document.getElementById( imgId );
if( div.style.display == '' )
{
div.style.display = 'none';
img.src='./images/icon_info_sml.gif';
img.alt='[Information]';
}
else
{
div.style.display = '';
img.src='./images/close.gif';
img.alt='[Close]';
}
}
</script><a name="Dependency_Tree"></a><section>
<h3><a name="Dependency_Tree"></a>Dependency Tree</h3>
<ul>
<li>ru.akarpov.lab5:lab5:jar:1.0-SNAPSHOT <img id="_img1" src="./images/icon_info_sml.gif" alt="[Information]" onclick="toggleDependencyDetails( '_dep0', '_img1' );" style="cursor: pointer; vertical-align: text-bottom;" /><div id="_dep0" style="display:none">
<table border="0" class="bodyTable">
<tr class="a">
<th>lab5</th></tr>
<tr class="b">
<td align="left">
<p><b>Description: </b>There is currently no description associated with this project.</p>
<p><b>Project Licenses: </b>No licenses are defined for this project.</p></td></tr></table></div>
<ul>
<li>javax.xml.bind:jaxb-api:jar:2.3.1 (compile) <img id="_img3" src="./images/icon_info_sml.gif" alt="[Information]" onclick="toggleDependencyDetails( '_dep2', '_img3' );" style="cursor: pointer; vertical-align: text-bottom;" /><div id="_dep2" style="display:none">
<table border="0" class="bodyTable">
<tr class="a">
<th>jaxb-api</th></tr>
<tr class="b">
<td align="left">
<p><b>Description: </b>JAXB (JSR 222) API</p>
<p><b>URL: </b><a class="externalLink" href="https://github.com/javaee/jaxb-spec/jaxb-api">https://github.com/javaee/jaxb-spec/jaxb-api</a></p>
<p><b>Project Licenses: </b><a class="externalLink" href="https://oss.oracle.com/licenses/CDDL+GPL-1.1">CDDL 1.1</a>, <a class="externalLink" href="https://oss.oracle.com/licenses/CDDL+GPL-1.1">GPL2 w/ CPE</a></p></td></tr></table></div>
<ul>
<li>javax.activation:javax.activation-api:jar:1.2.0 (compile) <img id="_img5" src="./images/icon_info_sml.gif" alt="[Information]" onclick="toggleDependencyDetails( '_dep4', '_img5' );" style="cursor: pointer; vertical-align: text-bottom;" /><div id="_dep4" style="display:none">
<table border="0" class="bodyTable">
<tr class="a">
<th>JavaBeans Activation Framework API jar</th></tr>
<tr class="b">
<td align="left">
<p><b>Description: </b>JavaBeans Activation Framework API jar</p>
<p><b>URL: </b><a class="externalLink" href="http://java.net/all/javax.activation-api/">http://java.net/all/javax.activation-api/</a></p>
<p><b>Project Licenses: </b><a class="externalLink" href="https://github.com/javaee/activation/blob/master/LICENSE.txt">CDDL/GPLv2+CE</a></p></td></tr></table></div></li></ul></li></ul></li></ul></section></section><a name="Licenses"></a><section>
<h2><a name="Licenses"></a>Licenses</h2>
<p><b>CDDL/GPLv2+CE: </b>JavaBeans Activation Framework API jar</p>
<p><b>CDDL 1.1: </b>jaxb-api</p>
<p><b>Unknown: </b>lab5</p>
<p><b>GPL2 w/ CPE: </b>jaxb-api</p></section><a name="Dependency_File_Details"></a><section>
<h2><a name="Dependency_File_Details"></a>Dependency File Details</h2>
<table border="0" class="bodyTable">
<tr class="a">
<th>Filename</th>
<th>Size</th>
<th>Entries</th>
<th>Classes</th>
<th>Packages</th>
<th>Java Version</th>
<th title="Indicates whether these dependencies have been compiled with debug information.">Debug Information</th></tr>
<tr class="b">
<td align="left">javax.activation-api-1.2.0.jar</td>
<td align="right">56.7 kB</td>
<td align="right">41</td>
<td align="right">31</td>
<td align="right">1</td>
<td align="center">1.5</td>
<td align="center">Yes</td></tr>
<tr class="a">
<td align="left">jaxb-api-2.3.1.jar</td>
<td align="right">128.1 kB</td>
<td align="right">136</td>
<td align="right">111</td>
<td align="right">7</td>
<td align="center">9</td>
<td align="center">Yes</td></tr>
<tr class="b">
<th>Total</th>
<th>Size</th>
<th>Entries</th>
<th>Classes</th>
<th>Packages</th>
<th>Java Version</th>
<th>Debug Information</th></tr>
<tr class="a">
<td align="right">2</td>
<td align="right">184.8 kB</td>
<td align="right">177</td>
<td align="right">142</td>
<td align="right">8</td>
<td align="center">9</td>
<td align="right">2</td></tr>
<tr class="b">
<td align="right">compile: 2</td>
<td align="right">compile: 184.8 kB</td>
<td align="right">compile: 177</td>
<td align="right">compile: 142</td>
<td align="right">compile: 8</td>
<td align="center">9</td>
<td align="right">compile: 2</td></tr></table></section>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">
Copyright &#169; 2024.. </div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,98 @@
<!DOCTYPE html>
<!--
| Generated by Apache Maven Doxia Site Renderer 1.11.1 from org.apache.maven.plugins:maven-project-info-reports-plugin:3.5.0:dependency-info at 2024-02-07
| Rendered using Apache Maven Default Skin
-->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="generator" content="Apache Maven Doxia Site Renderer 1.11.1" />
<title>lab5 &#x2013; Dependency Information</title>
<link rel="stylesheet" href="./css/maven-base.css" />
<link rel="stylesheet" href="./css/maven-theme.css" />
<link rel="stylesheet" href="./css/site.css" />
<link rel="stylesheet" href="./css/print.css" media="print" />
</head>
<body class="composite">
<div id="banner">
<div id="bannerLeft">lab5
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<span id="publishDate">Last Published: 2024-02-07</span>
| <span id="projectVersion">Version: 1.0-SNAPSHOT</span>
</div>
<div class="xright"><a href="${project.url}" title="lab5">lab5</a> </div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>Project Documentation</h5>
<ul>
<li class="expanded"><a href="project-info.html" title="Project Information">Project Information</a>
<ul>
<li class="none"><a href="dependencies.html" title="Dependencies">Dependencies</a></li>
<li class="none"><strong>Dependency Information</strong></li>
<li class="none"><a href="index.html" title="About">About</a></li>
<li class="none"><a href="plugin-management.html" title="Plugin Management">Plugin Management</a></li>
<li class="none"><a href="plugins.html" title="Plugins">Plugins</a></li>
<li class="none"><a href="summary.html" title="Summary">Summary</a></li>
</ul></li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="poweredBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<section>
<h2><a name="Dependency_Information"></a>Dependency Information</h2><a name="Dependency_Information"></a><section>
<h3><a name="Apache_Maven"></a>Apache Maven</h3><a name="Apache_Maven"></a>
<div>
<pre>&lt;dependency&gt;
&lt;groupId&gt;ru.akarpov.lab5&lt;/groupId&gt;
&lt;artifactId&gt;lab5&lt;/artifactId&gt;
&lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;</pre></div></section><section>
<h3><a name="Apache_Ivy"></a>Apache Ivy</h3><a name="Apache_Ivy"></a>
<div>
<pre>&lt;dependency org=&quot;ru.akarpov.lab5&quot; name=&quot;lab5&quot; rev=&quot;1.0-SNAPSHOT&quot;&gt;
&lt;artifact name=&quot;lab5&quot; type=&quot;jar&quot; /&gt;
&lt;/dependency&gt;</pre></div></section><section>
<h3><a name="Groovy_Grape"></a>Groovy Grape</h3><a name="Groovy_Grape"></a>
<div>
<pre>@Grapes(
@Grab(group='ru.akarpov.lab5', module='lab5', version='1.0-SNAPSHOT')
)</pre></div></section><section>
<h3><a name="Gradle.2FGrails"></a>Gradle/Grails</h3><a name="Gradle.2FGrails"></a>
<div>
<pre>implementation 'ru.akarpov.lab5:lab5:1.0-SNAPSHOT'</pre></div></section><section>
<h3><a name="Scala_SBT"></a>Scala SBT</h3><a name="Scala_SBT"></a>
<div>
<pre>libraryDependencies += &quot;ru.akarpov.lab5&quot; % &quot;lab5&quot; % &quot;1.0-SNAPSHOT&quot;</pre></div></section><section>
<h3><a name="Leiningen"></a>Leiningen</h3><a name="Leiningen"></a>
<div>
<pre>[ru.akarpov.lab5/lab5 &quot;1.0-SNAPSHOT&quot;]</pre></div></section></section>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">
Copyright &#169; 2024.. </div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1010 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Some files were not shown because too many files have changed in this diff Show More