Skip to content

Commit 767fb14

Browse files
committed
Java sprint 8 v1.01
Подкорректировал код
1 parent aebd1f1 commit 767fb14

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

src/ru/yandex/javacource/golotin/schedule/model/Epic.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public Epic(String name, Status status, String description, Instant startTime, i
1414
}
1515

1616
public Epic(int id, String name, String description, Status status, Instant startTime, int duration) {
17-
super(name, status, description,startTime, duration);
17+
super(name, status, description, startTime, duration);
1818
setId(id);
1919
}
2020

src/ru/yandex/javacource/golotin/schedule/model/Task.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public Task(String name, Status status, String description, Instant startTime, i
2424
this.endTime = startTime.plus(duration, ChronoUnit.MINUTES);
2525
}
2626

27-
public Task(int id, String name, String description, Status status,Instant startTime, int duration) {
27+
public Task(int id, String name, String description, Status status, Instant startTime, int duration) {
2828
setId(id);
2929
this.name = name;
3030
this.status = status;
@@ -74,17 +74,29 @@ public void setStatus(Status status) {
7474
this.status = status;
7575
}
7676

77-
public Instant getStartTime() {return startTime;}
77+
public Instant getStartTime() {
78+
return startTime;
79+
}
7880

79-
public void setStartTime(Instant startTime) {this.startTime = startTime;}
81+
public void setStartTime(Instant startTime) {
82+
this.startTime = startTime;
83+
}
8084

81-
public Duration getDuration() {return duration;}
85+
public Duration getDuration() {
86+
return duration;
87+
}
8288

83-
public void setDuration(int duration) {this.duration = Duration.ofMinutes(duration);}
89+
public void setDuration(int duration) {
90+
this.duration = Duration.ofMinutes(duration);
91+
}
8492

85-
public Instant getEndTime() {return endTime;}
93+
public Instant getEndTime() {
94+
return endTime;
95+
}
8696

87-
public void setEndTime(Instant endTime) {this.endTime = endTime;}
97+
public void setEndTime(Instant endTime) {
98+
this.endTime = endTime;
99+
}
88100

89101
@Override
90102
public boolean equals(Object o) {

src/ru/yandex/javacource/golotin/schedule/service/FileBackedTaskManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public static FileBackedTaskManager loadFromFile(File file) {
4343
taskManager.createTask(task);
4444
} else if (task.getType() == TaskType.SUBTASK) {
4545
taskManager.createSubtask(new Subtask(task.getId(), task.getName(), task.getDescription(),
46-
task.getStatus(),task.getStartTime(),task.getDuration().toMinutesPart(), task.getEpicId()));
46+
task.getStatus(), task.getStartTime(), task.getDuration().toMinutesPart(), task.getEpicId()));
4747
} else if (task.getType() == TaskType.EPIC) {
4848
taskManager.createEpic(new Epic(task.getId(), task.getName(), task.getDescription(),
49-
task.getStatus(),task.getStartTime(),task.getDuration().toMinutesPart()));
49+
task.getStatus(), task.getStartTime(), task.getDuration().toMinutesPart()));
5050
for (Subtask subtask : taskManager.subtasks.values()) {// Поиск подзадач эпика
5151
if (subtask.getEpicId() == task.getId()) {
5252
Epic epic = taskManager.epics.get(task.getId());

src/ru/yandex/javacource/golotin/schedule/service/InMemoryTaskManager.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void updateTask(Task task) {// обновление Task
7474

7575
@Override
7676
public void updateEpic(Epic epic) {// обновление Epic
77-
final Epic savedEpic = epics.get(epic.getId());
77+
final Epic savedEpic = epics.get(epic.getId());
7878
if (savedEpic == null) {
7979
return;
8080
}
@@ -241,14 +241,15 @@ private void updateEpicStatus(int epicId) {// обновление статус
241241
}
242242

243243
private void addPriorityTask(Task task) {
244-
for(Task t : prioritizedTasks){
245-
if(t.getStartTime()==task.getStartTime()){
246-
throw new ManagerSaveException("Пересечение с задачей "+ task.toString());
244+
for (Task t : prioritizedTasks) {
245+
if (t.getStartTime() == task.getStartTime()) {
246+
throw new ManagerSaveException("Пересечение с задачей " + task.toString());
247247
}
248248
}
249249
prioritizedTasks.add(task);
250250
}
251-
public List<Task> getPrioritizedTasks(){
252-
return new ArrayList<>(prioritizedTasks);
251+
252+
public List<Task> getPrioritizedTasks() {
253+
return new ArrayList<>(prioritizedTasks);
253254
}
254255
}

0 commit comments

Comments
 (0)