71 lines
2.1 KiB
Java
71 lines
2.1 KiB
Java
/**
|
|
* Represents the configuration parameters for the simulated download manager.
|
|
* This class is immutable to ensure thread-safety when shared among worker threads.
|
|
*/
|
|
public class DownloadConfig {
|
|
private final String fileName;
|
|
private final int totalSizeMB;
|
|
private final int chunkCount;
|
|
private final int minStepDelayMs;
|
|
private final int maxStepDelayMs;
|
|
private final double minStepDownloadMB;
|
|
private final double maxStepDownloadMB;
|
|
|
|
/**
|
|
* Constructs a new DownloadConfig with specified simulation parameters.
|
|
*/
|
|
public DownloadConfig(String fileName, int totalSizeMB, int chunkCount,
|
|
int minStepDelayMs, int maxStepDelayMs,
|
|
double minStepDownloadMB, double maxStepDownloadMB) {
|
|
this.fileName = fileName;
|
|
this.totalSizeMB = totalSizeMB;
|
|
this.chunkCount = chunkCount;
|
|
this.minStepDelayMs = minStepDelayMs;
|
|
this.maxStepDelayMs = maxStepDelayMs;
|
|
this.minStepDownloadMB = minStepDownloadMB;
|
|
this.maxStepDownloadMB = maxStepDownloadMB;
|
|
}
|
|
|
|
// Getters
|
|
public String getFileName() {
|
|
return fileName;
|
|
}
|
|
|
|
public int getTotalSizeMB() {
|
|
return totalSizeMB;
|
|
}
|
|
|
|
public int getChunkCount() {
|
|
return chunkCount;
|
|
}
|
|
|
|
public int getMinStepDelayMs() {
|
|
return minStepDelayMs;
|
|
}
|
|
|
|
public int getMaxStepDelayMs() {
|
|
return maxStepDelayMs;
|
|
}
|
|
|
|
public double getMinStepDownloadMB() {
|
|
return minStepDownloadMB;
|
|
}
|
|
|
|
public double getMaxStepDownloadMB() {
|
|
return maxStepDownloadMB;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "DownloadConfig{" +
|
|
"fileName='" + fileName + '\'' +
|
|
", totalSizeMB=" + totalSizeMB +
|
|
", chunkCount=" + chunkCount +
|
|
", minStepDelayMs=" + minStepDelayMs +
|
|
", maxStepDelayMs=" + maxStepDelayMs +
|
|
", minStepDownloadMB=" + minStepDownloadMB +
|
|
", maxStepDownloadMB=" + maxStepDownloadMB +
|
|
'}';
|
|
}
|
|
}
|