Code improvements.
This commit is contained in:
parent
8b8b81f26d
commit
8cc843465b
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user