Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7ecd1c4
feat: implement Cube interface for RubicsCube
mirotvoretts Feb 6, 2026
c2ee820
atm: solved
mirotvoretts Feb 7, 2026
c0ce423
feat: implement Cube interface for RubicsCube
mirotvoretts Feb 6, 2026
5d4af8c
atm: solved
mirotvoretts Feb 7, 2026
ab64a83
cube: rerun tests
mirotvoretts Feb 7, 2026
9fb4e35
cube: rerun tests
mirotvoretts Feb 7, 2026
52f83c1
cube: try one more time
mirotvoretts Feb 7, 2026
01f4cce
cube: fix atm tests
mirotvoretts Feb 7, 2026
84c0ef5
cube: fix reverse direction for permutation matrixes
mirotvoretts Feb 7, 2026
534303a
cube: fix right clockwise
mirotvoretts Feb 7, 2026
0250036
randomset: first working version
mirotvoretts Feb 13, 2026
be13706
randomset: throw exception on empty set access
mirotvoretts Feb 13, 2026
7c40a94
randomset: remove throwing exception on first insert
mirotvoretts Feb 13, 2026
c5d1b7d
randomset: remove throwing exception on contains
mirotvoretts Feb 13, 2026
cdd2f79
randomset: fix infinite recursion
mirotvoretts Feb 13, 2026
7d513d8
randomset: T must be comparable
mirotvoretts Feb 13, 2026
02cc65f
randomset: fix nulling tree if insert duplicate
mirotvoretts Feb 13, 2026
b485960
randomset: trying to fix
mirotvoretts Feb 13, 2026
de59e56
randomset: rewrite to treap
mirotvoretts Feb 13, 2026
ffaf577
randomset: refactor - split treap and randomset
mirotvoretts Feb 13, 2026
af30199
Merge branch 'Panov_I_A_task_2' of github.com:mirotvoretts/hse-java
mirotvoretts Feb 27, 2026
eac9376
commander: implement far manager clone
mirotvoretts Feb 27, 2026
ee75d36
docs: add README
mirotvoretts Mar 8, 2026
72330a8
chore: sync repositories
mirotvoretts Mar 19, 2026
bc2d1b9
Merge branch 'main' of github.com:mirotvoretts/hse-java into Panov_I_…
mirotvoretts Mar 19, 2026
238a40f
queue: write one more blocking queue in my life
mirotvoretts Mar 19, 2026
e00d084
queue: fix pom.xml after merge
mirotvoretts Mar 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Java Course HSE AMI '28
88 changes: 88 additions & 0 deletions commander/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>hse.java</groupId>
<artifactId>commander</artifactId>
<name>commander</name>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>25</source>
<target>25</target>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.8</version>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<mainClass>hse.java.commander/hse.java.commander.CommanderApplication</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
<noManPages>true</noManPages>
<stripDebug>true</stripDebug>
<noHeaderFiles>true</noHeaderFiles>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx</artifactId>
<version>21.0.6</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.12.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>opentest4j</artifactId>
<groupId>org.opentest4j</groupId>
</exclusion>
<exclusion>
<artifactId>junit-platform-commons</artifactId>
<groupId>org.junit.platform</groupId>
</exclusion>
<exclusion>
<artifactId>apiguardian-api</artifactId>
<groupId>org.apiguardian</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.12.1</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>junit-platform-engine</artifactId>
<groupId>org.junit.platform</groupId>
</exclusion>
<exclusion>
<artifactId>apiguardian-api</artifactId>
<groupId>org.apiguardian</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.12.1</junit.version>
</properties>
</project>
110 changes: 109 additions & 1 deletion commander/src/main/java/hse/java/commander/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,125 @@

import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ListView;

<<<<<<< HEAD
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
=======
import java.nio.file.Path;

public class MainController {
>>>>>>> 1c195628027c24a0d2a677be0bd75b5381ae77e5

public class MainController {
@FXML
<<<<<<< HEAD
public Button move;
@FXML
=======
>>>>>>> 1c195628027c24a0d2a677be0bd75b5381ae77e5
public ListView<String> left;

@FXML
public ListView<String> right;
@FXML
public Label leftPathLabel;
@FXML
public Label rightPathLabel;

<<<<<<< HEAD
private File leftDirectory = new File(System.getProperty("user.home"));
private File rightDirectory = new File(System.getProperty("user.home"));

public void initialize() {
refresh(left, leftDirectory);
refresh(right, rightDirectory);

left.setOnMouseClicked(event -> {
if (event.getClickCount() == 2) {
handleNavigation(left, true);
}
});

right.setOnMouseClicked(event -> {
if (event.getClickCount() == 2) {
handleNavigation(right, false);
}
});

move.setOnAction(event -> moveFile());
}

private void refresh(ListView<String> list, File directory) {
list.getItems().clear();
list.getItems().add("..");
File[] files = directory.listFiles();
if (files != null) {
for (File file : files) {
list.getItems().add(file.isDirectory() ? "[" + file.getName() + "]" : file.getName());
}
}
if (list == left) {
leftPathLabel.setText(directory.getAbsolutePath());
} else {
rightPathLabel.setText(directory.getAbsolutePath());
}
}

private void handleNavigation(ListView<String> list, boolean isLeft) {
String selected = list.getSelectionModel().getSelectedItem();
if (selected == null) return;

File currentDir = isLeft ? leftDirectory : rightDirectory;
File nextDirectory;

if (selected.equals("..")) {
nextDirectory = currentDir.getParentFile();
} else {
String name = selected.replace("[", "").replace("]", "");
nextDirectory = new File(currentDir, name);
}

if (nextDirectory != null && nextDirectory.isDirectory()) {
if (isLeft) {
leftDirectory = nextDirectory;
} else {
rightDirectory = nextDirectory;
}
refresh(list, nextDirectory);
}
}

private void moveFile() {
boolean moveFromLeft = left.getSelectionModel().getSelectedItem() != null;
ListView<String> fromList = moveFromLeft ? left : right;
File fromDirectory = moveFromLeft ? leftDirectory : rightDirectory;
File toDirectory = moveFromLeft ? rightDirectory : leftDirectory;

String selected = fromList.getSelectionModel().getSelectedItem();

if (selected == null || selected.equals("..")) {
return;
}

String name = selected.replace("[", "").replace("]", "");
Path source = new File(fromDirectory, name).toPath();
Path destination = new File(toDirectory, name).toPath();

try {
Files.move(source, destination, StandardCopyOption.REPLACE_EXISTING);
refresh(left, leftDirectory);
refresh(right, rightDirectory);
} catch (IOException e) {
System.err.println("Анлак, не удалось перенести: " + e.getMessage());
}
}
}
=======
@FXML
public Button move;

Expand Down Expand Up @@ -43,3 +150,4 @@ public void initialize() {
});
}
}
>>>>>>> 1c195628027c24a0d2a677be0bd75b5381ae77e5
25 changes: 25 additions & 0 deletions commander/src/main/resources/hse/java/commander/commander-ui.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,31 @@

<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>

<<<<<<< HEAD
<VBox prefHeight="500.0" prefWidth="700.0" spacing="10" xmlns="http://javafx.com/javafx/17.0.12" xmlns:fx="http://javafx.com/fxml/1" fx:controller="hse.java.commander.MainController">
<padding>
<Insets top="10" right="10" bottom="10" left="10"/>
</padding>

<HBox spacing="10" VBox.vgrow="ALWAYS">
<VBox HBox.hgrow="ALWAYS" spacing="5">
<Label fx:id="leftPathLabel" style="-fx-font-weight: bold;"/>
<ListView fx:id="left" VBox.vgrow="ALWAYS" />
</VBox>

<VBox HBox.hgrow="ALWAYS" spacing="5">
<Label fx:id="rightPathLabel" style="-fx-font-weight: bold;"/>
<ListView fx:id="right" VBox.vgrow="ALWAYS" />
</VBox>
</HBox>

<HBox spacing="10" alignment="CENTER_LEFT">
<Button fx:id="move" text="Move" prefWidth="120" />
</HBox>
</VBox>
=======
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="421.0" prefWidth="627.0" xmlns="http://javafx.com/javafx/17.0.12" xmlns:fx="http://javafx.com/fxml/1" fx:controller="hse.java.commander.MainController">
<HBox prefHeight="370.0" prefWidth="627.0">
<ListView fx:id="left" id="left" prefHeight="318.0" prefWidth="311.0" />
Expand All @@ -14,3 +38,4 @@
<Button fx:id="delete" mnemonicParsing="false" text="Delete" />
</HBox>
</VBox>
>>>>>>> 1c195628027c24a0d2a677be0bd75b5381ae77e5
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.10.0</junit.version>
<maven.surefire.version>3.1.2</maven.surefire.version>
<!-- Lombok version property to keep versions consistent -->
<lombok.version>1.18.38</lombok.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -61,6 +63,11 @@
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package hse.java.lectures.lecture3.practice.randomSet;

import lombok.Getter;
import lombok.Setter;

@Getter
public class Node<T> {
@Setter
private T value;
@Setter
private Node<T> left;
@Setter
private Node<T> right;
private int size;

public Node(T value) {
size = 1;
this.value = value;
this.left = null;
this.right = null;
}

public void recalculateSize() {
size = 1;
if (left != null) {
size += left.getSize();
}
if (right != null) {
size += right.getSize();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package hse.java.lectures.lecture3.practice.randomSet;

public record Pair<L, R>(L left, R right) {
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
package hse.java.lectures.lecture3.practice.randomSet;

public class RandomSet<T> {
import java.util.Random;

public class RandomSet<T extends Comparable<T>> {
private final Treap<T> treap;
private final Random random = new Random();

public RandomSet() {
treap = new Treap<>();
}

public boolean insert(T value) {
throw new UnsupportedOperationException("Not implemented");
return treap.tryInsert(value);
}

public boolean remove(T value) {
throw new UnsupportedOperationException("Not implemented");
return treap.tryRemove(value);
}

public boolean contains(T value) {
throw new UnsupportedOperationException("Not implemented");
return treap.contains(value);
}

public T getRandom() {
throw new UnsupportedOperationException("Not implemented");
if (treap.getSize() == 0) {
throw new EmptySetException("Set is empty");
}
int randomIndex = random.nextInt(treap.getSize());
return treap.get(randomIndex);
}

}
Loading
Loading