mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-03 11:12:23 +00:00
Code improvements.
This commit is contained in:
1 parent
8b8b81f26d
commit
8cc843465b
4 files changed
+7
-7
No files matched your search
@@ -7,7 +7,7 @@ package com.iluwatar;
|
||||
*/
|
||||
public class CoffeeMakingTask extends Task {
|
||||
|
||||
private static int TIME_PER_CUP = 300;
|
||||
private static final int TIME_PER_CUP = 300;
|
||||
|
||||
public CoffeeMakingTask(int numCups) {
|
||||
super(numCups * TIME_PER_CUP);
|
||||
|
||||
@@ -7,7 +7,7 @@ package com.iluwatar;
|
||||
*/
|
||||
public class PotatoPeelingTask extends Task {
|
||||
|
||||
private static int TIME_PER_POTATO = 500;
|
||||
private static final int TIME_PER_POTATO = 500;
|
||||
|
||||
public PotatoPeelingTask(int numPotatoes) {
|
||||
super(numPotatoes * TIME_PER_POTATO);
|
||||
|
||||
@@ -9,10 +9,10 @@ public abstract class Task {
|
||||
|
||||
private static int nextId = 1;
|
||||
|
||||
private int id;
|
||||
private int timeMs;
|
||||
private final int id;
|
||||
private final int timeMs;
|
||||
|
||||
public Task(int timeMs) {
|
||||
public Task(final int timeMs) {
|
||||
this.id = nextId++;
|
||||
this.timeMs = timeMs;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,9 @@ package com.iluwatar;
|
||||
*/
|
||||
public class Worker implements Runnable {
|
||||
|
||||
private Task task;
|
||||
private final Task task;
|
||||
|
||||
public Worker(Task task) {
|
||||
public Worker(final Task task) {
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user