From 98cef5e9a772602d42acfcf233838c760424db9a Mon Sep 17 00:00:00 2001 From: Nicolas James Date: Thu, 13 Feb 2025 18:00:17 +1100 Subject: initial commit --- comp2511/blackout/ShrinkingSatellite.java | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 comp2511/blackout/ShrinkingSatellite.java (limited to 'comp2511/blackout/ShrinkingSatellite.java') diff --git a/comp2511/blackout/ShrinkingSatellite.java b/comp2511/blackout/ShrinkingSatellite.java new file mode 100644 index 0000000..93dde50 --- /dev/null +++ b/comp2511/blackout/ShrinkingSatellite.java @@ -0,0 +1,56 @@ +package unsw.blackout; + +import java.util.Optional; + +import unsw.utils.Angle; + +public class ShrinkingSatellite extends SatelliteBase { + public ShrinkingSatellite(String satelliteID, double height, Angle position) { + super(satelliteID, height, position); + } + + @ Override + final public double getVelocity() { + return 1_000.0; + } + @ Override + final public double getRange() { + return 200_000.0; + } + @ Override + final protected boolean isSupportedDeviceType(String type) { + return true; + } + @ Override + final protected boolean canShrink() { + return true; + } + @ Override + final protected Optional getFileStoreLimit() { + return Optional.empty(); // No limit. + } + @ Override + final protected Optional getByteStoreLimit() { + return Optional.of(150); // 150 bytes. + } + @ Override + final protected Optional getByteDownloadSpeed() { + return Optional.of(15); // 15 bytes per minute. + } + @ Override + final protected Optional getByteUploadSpeed() { + return Optional.of(10); // 10 bytes per minute. + } + @ Override + final protected int getNumBytesInFiles() { + int count = 0; + for (File file : getReceivedFiles()) { + if (file.isQuantum()) { + count += (int)((double)file.getContentsSize() * (2.0 / 3.0) + 0.5); // quantum satellites perform 2/3 compression on their files + continue; + } + count += file.getContentsSize(); + } + return count; + } +} -- cgit v1.2.3