blob: 93dde5065ffb30f54db4f22cdf1da4780dd9a5dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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;
}
}
|