MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / update

Method update

src/main/java/fieldbox/boxes/Watches.java:64–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 SetMultimap<Dict.Prop, String> allWatches = MultimapBuilder.linkedHashKeys().linkedHashSetValues().build();
63
64 protected boolean update() {
65
66 breadthFirst(both()).forEach((x) -> {
67 LinkedHashMap<Dict.Prop, Object> previous = x.properties.computeIfAbsent(watchedPrevious, (k) -> new LinkedHashMap<>());
68 for (Dict.Prop p : allWatches .keySet()) {
69 Object was = previous.get(p);
70 Object now = x.properties.get(p);
71
72 if (!Util.safeEq(was, now))
73 {
74 fire(p, x, was, now, allWatches .get(p));
75 // fetch it again, fire can change the value of the property
76 now = x.properties.get(p);
77 previous.put(p, now instanceof Mutable ? ((Mutable)now).duplicate() : now);
78 }
79 }
80 });
81 return true;
82 }
83
84 public String addWatch(Dict.Prop property, String address)
85 {

Callers

nothing calls this directly

Calls 9

safeEqMethod · 0.95
fireMethod · 0.95
breadthFirstMethod · 0.80
computeIfAbsentMethod · 0.80
getMethod · 0.65
duplicateMethod · 0.65
forEachMethod · 0.45
bothMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected