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

Method findFrom

src/main/java/fieldbox/boxes/plugins/Missing.java:41–59  ·  view source on GitHub ↗
(Box b, Dict.Prop<T> what)

Source from the content-addressed store, hash-verified

39 }
40
41 static public <T> T findFrom(Box b, Dict.Prop<T> what) {
42 Optional<Box> o = b.breadthFirst(b.upwards())
43 .filter(x -> x.properties.has(what) && x.properties.get(what) != null)
44 .findFirst();
45
46
47 if (!o.isPresent()) {
48 // record missing, and do something about it?
49 return null;
50 }
51
52
53 T r = o.get().properties.get(what);
54
55
56 recordGet(b, what, o.get(), r);
57
58 return r;
59 }
60
61 static public <T> T findFrom(Box b, Dict.Prop<T> what, Set<Box> ignore) {
62 Optional<Box> o = b.breadthFirst(x -> {

Callers 2

asMap_get_findMethod · 0.95
asMap_getMethod · 0.95

Calls 7

recordGetMethod · 0.95
breadthFirstMethod · 0.80
upwardsMethod · 0.80
isPresentMethod · 0.80
removeAllMethod · 0.80
getMethod · 0.65
hasMethod · 0.45

Tested by

no test coverage detected