Skip to content

Commit 1879627

Browse files
committed
one more small update of klk1
1 parent 2b8010a commit 1879627

File tree

6 files changed

+72
-3
lines changed

6 files changed

+72
-3
lines changed

matan/sem2/KLK1/O/O18.typ

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
= О18. Площадь
44
\
55
*Понятие площади.*
6-
).
76
Функция множеств (функционал) $S: UU -> RR$, заданная на некотором множестве «квадрируемых» подмножеств плоскости, называется площадью, если:
87
1. $S (A) gt.eq 0, A in UU$\
98
2. Если $A,B in UU, A inter B = emptyset$, то $A union B in UU$ и\

matan/sem2/KLK1/O/O24.typ

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*Понятие гладкого пути.*
66
Пусть $gamma : [a, b] -> RR^n$, причем
77
$
8-
gamma (t) = (x_1(t), dots, x_n(t)), t in [a, b].
8+
gamma (t) = (x_1(t), dots, x_n (t)), t in [a, b].
99
$
1010

1111
Говорят, что $gamma$ — путь гладкости $m in NN union {+infinity}$, если $x_i ∈ C^m [a, b], i in {1, dots, n}$.

matan/sem2/KLK1/test.pdf

-169 Bytes
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package server.storage;
2+
3+
public class StructureManager {
4+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package server.storage.drivers;
2+
3+
import server.storage.objects.City;
4+
import server.storage.objects.enums.StandardOfLiving;
5+
import server.storage.objects.exceptions.ElementNotFound;
6+
7+
import java.time.LocalDateTime;
8+
import java.util.ArrayDeque;
9+
import java.util.stream.Collectors;
10+
11+
public class StructDriver {
12+
private ArrayDeque<City> mainCollection = new ArrayDeque<>();
13+
private final static LocalDateTime createdDateTime = LocalDateTime.now();
14+
15+
/**
16+
* Этот метод реализует добавление новой сущности в коллекцию
17+
* @param entity Новая сущность
18+
*/
19+
public void addEntity(City entity){
20+
mainCollection.addLast(entity);
21+
}
22+
23+
/**
24+
* Этот метод реализует получение копии двусторонней очереди
25+
* @return ArrayDeque<City> Копия структуры
26+
*/
27+
public ArrayDeque<City> getAllEntities(){
28+
return new ArrayDeque<>(this.mainCollection);
29+
}
30+
public void removeById(Long id){
31+
this.mainCollection = mainCollection.stream()
32+
.filter(item -> !item.id.equals(id))
33+
.collect(Collectors.toCollection(ArrayDeque<City>::new));
34+
}
35+
public void removeFirst(){
36+
this.mainCollection.removeFirst();
37+
}
38+
public void clearCollection(){
39+
this.mainCollection.clear();
40+
}
41+
public void removeAllByStandardOfLiving(String standardOfLiving) {
42+
this.mainCollection = mainCollection.stream()
43+
.filter(item -> !item.standardOfLiving.equals(
44+
StandardOfLiving.valueOf(standardOfLiving)
45+
))
46+
.collect(Collectors.toCollection(ArrayDeque<City>::new));
47+
}
48+
public float averageOfMetersAboveSeaLevel(){
49+
return (float) mainCollection.stream()
50+
.mapToDouble(elem -> elem.metersAboveSeaLevel)
51+
.average()
52+
.orElse(Double.NaN);
53+
}
54+
55+
public City getById(Long id) throws ElementNotFound {
56+
boolean ELEMENT_UPDATED_FLAG = false;
57+
for (City element: this.mainCollection){
58+
if (element.id.equals(id)){
59+
return element;
60+
}
61+
}
62+
if (!ELEMENT_UPDATED_FLAG){
63+
throw new ElementNotFound("No such element in collection!");
64+
}
65+
}
66+
}

programming/sem2/lab5_v2/src/server/storage/drivers/StructDriver.java renamed to programming/sem2/lab5_v2/src/server/storage/drivers/IStructDriver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package server.storage.drivers;
22

3-
public class StructDriver {
3+
public interface IStructDriver {
44
}

0 commit comments

Comments
 (0)