updated ChunkStatus, ConfigReader, DownloadConfig.

This commit is contained in:
2026-06-12 12:02:47 +03:30
parent b2bf918030
commit fd4b232408
3 changed files with 19 additions and 3 deletions
+1 -1
View File
@@ -107,6 +107,6 @@ public class ChunkStatus {
}
public void setStartTime(long startTime) {
this.startTimeMs = startTime;
}
}
+11 -1
View File
@@ -20,6 +20,8 @@ public class ConfigReader {
int maxStepDelayMs = 0;
double minStepDownloadMB = 0;
double maxStepDownloadMB = 0;
int minDelayMs = 0;
int maxDelayMs = 0;
try (BufferedReader reader = new BufferedReader(
new InputStreamReader(inputStream, StandardCharsets.UTF_8))) {
@@ -62,6 +64,12 @@ public class ConfigReader {
case "maxStepDownloadMB":
maxStepDownloadMB = Double.parseDouble(value);
break;
case "minDelayMs":
minDelayMs = Integer.parseInt(value);
break;
case "maxDelayMs":
maxDelayMs = Integer.parseInt(value);
break;
default:
// Ignore unknown keys to keep parsing simple
break;
@@ -79,7 +87,9 @@ public class ConfigReader {
minStepDelayMs,
maxStepDelayMs,
minStepDownloadMB,
maxStepDownloadMB
maxStepDownloadMB,
minDelayMs,
maxDelayMs
);
}
}
+7 -1
View File
@@ -10,13 +10,15 @@ public class DownloadConfig {
private final int maxStepDelayMs;
private final double minStepDownloadMB;
private final double maxStepDownloadMB;
private final int maxDelayMs;
private final int minDelayMs;
/**
* Constructs a new DownloadConfig with specified simulation parameters.
*/
public DownloadConfig(String fileName, int totalSizeMB, int chunkCount,
int minStepDelayMs, int maxStepDelayMs,
double minStepDownloadMB, double maxStepDownloadMB) {
double minStepDownloadMB, double maxStepDownloadMB, int maxDelayMs, int minDelayMs) {
this.fileName = fileName;
this.totalSizeMB = totalSizeMB;
this.chunkCount = chunkCount;
@@ -24,6 +26,8 @@ public class DownloadConfig {
this.maxStepDelayMs = maxStepDelayMs;
this.minStepDownloadMB = minStepDownloadMB;
this.maxStepDownloadMB = maxStepDownloadMB;
this.maxDelayMs = maxDelayMs;
this.minDelayMs = minDelayMs;
}
// Getters
@@ -69,8 +73,10 @@ public class DownloadConfig {
}
public int getMinDelayMs() {
return minDelayMs;
}
public int getMaxDelayMs() {
return maxDelayMs;
}
}