aboutsummaryrefslogtreecommitdiff
path: root/comp2511/blackout/ShrinkingSatellite.java
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-13 18:00:17 +1100
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-13 18:00:17 +1100
commit98cef5e9a772602d42acfcf233838c760424db9a (patch)
tree5277fa1d7cc0a69a0f166fcbf10fd320f345f049 /comp2511/blackout/ShrinkingSatellite.java
initial commit
Diffstat (limited to 'comp2511/blackout/ShrinkingSatellite.java')
-rw-r--r--comp2511/blackout/ShrinkingSatellite.java56
1 files changed, 56 insertions, 0 deletions
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<Integer> getFileStoreLimit() {
+ return Optional.empty(); // No limit.
+ }
+ @ Override
+ final protected Optional<Integer> getByteStoreLimit() {
+ return Optional.of(150); // 150 bytes.
+ }
+ @ Override
+ final protected Optional<Integer> getByteDownloadSpeed() {
+ return Optional.of(15); // 15 bytes per minute.
+ }
+ @ Override
+ final protected Optional<Integer> 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;
+ }
+}