Skip to content

Commit 41748f2

Browse files
committed
empty template with TODOs and hints (w/o solutions)
1 parent 237a080 commit 41748f2

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

server/src/main/java/swim/tutorial/UnitAgent.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,27 @@
1212
import java.util.Iterator;
1313

1414
public class UnitAgent extends AbstractAgent {
15+
16+
// TODO: complete the stats Value Lane
17+
// @SwimLane("stats")
18+
19+
// HINT: Use the valueLane() method to instantiate the lane
20+
// HINT: Use the .didSet() lifecycle callback to log a message showing updates to stats
21+
22+
@SwimLane("histogram")
23+
private final MapLane<Long, Value> histogram = this.<Long, Value>mapLane()
24+
.didUpdate((k, n, o) -> {
25+
logMessage("histogram: replaced " + k + "'s value to " + Recon.toString(n) + " from " + Recon.toString(o));
26+
// TODO: update stats with update logic
27+
28+
dropOldData();
1529

16-
@SwimLane("histogram")
17-
private final MapLane<Long, Value> histogram = this.<Long, Value>mapLane()
18-
.didUpdate((k, n, o) -> {
19-
logMessage("histogram: replaced " + k + "'s value to " + Recon.toString(n) + " from " + Recon.toString(o));
20-
dropOldData();
21-
});
30+
})
31+
.didRemove((k,o) -> {
32+
// TODO: update stats with remove logic
2233

34+
});
35+
2336
@SwimLane("history")
2437
private final ListLane<Value> history = this.<Value>listLane()
2538
.didUpdate((idx, newValue, oldValue) -> {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy