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

Class Box

src/main/java/fieldbox/boxes/Box.java:35–1018  ·  view source on GitHub ↗

The fundamental unit in Field --- the box. A Box has properties and it's in a graph structure. Specifically this is a directed, ordered, cyclic graph structure. It's not a multi-graph --- Boxes can only be connected 0 or 1 times. Parent / Child relationships are ordered and the order is main

Source from the content-addressed store, hash-verified

33 * maintained. And the graph can have cycles (it's typically visited in breadth-first without cycles).
34 * <p>
35 * Much of the time properties are looked up in the graph in breadth first fashion either "upwards" (towards parents) or less-often downwards (collecting over all children).
36 */
37public class Box implements fieldlinker.AsMap, HandlesCompletion {
38
39 static public final Dict.Prop<String> name = new Dict.Prop<>("name").type()
40 .toCanon()
41 .doc("the name of this box");
42 static public final Dict.Prop<Rect> frame = new Dict.Prop<>("frame").type()
43 .toCanon()
44 .doc("the rectangle that this box occupies").set(IO.persistent, true).set(IO.perDocument, true);
45 static public final Dict.Prop<Number> depth = new Dict.Prop<>("depth").type()
46 .toCanon()
47 .doc("provides a completely cosmetic 'z' coordinate for this box. Visible in VR and on stereo displays.").set(IO.persistent, true).set(IO.perDocument, true);
48 static public final Dict.Prop<Boolean> hidden = new Dict.Prop<>("hidden").type()
49 .toCanon()
50 .doc("set this to true to hide this box (but be careful, for if it's hidden, how will you get it back again?)");
51
52 static public final Dict.Prop<Boolean> decorative = new Dict.Prop<>("decorative").type()
53 .toCanon()
54 .doc("boxes like arrows and text have this set");
55
56 static public final Dict.Prop<Boolean> undeletable = new Dict.Prop<>("undeletable").type()
57 .toCanon()
58 .doc("set this to true to make this box not deletable by conventional means");
59
60 static public final Dict.Prop<Predicate<Box>> availableForCompletion = new Dict.Prop<>("availableForCompletion").type()
61 .toCanon()
62 .doc("provides a `Predicate<Box>` to help decide if a Property should be shown as available for completion").set(Dict.domain, "attributes");
63
64
65 @HiddenInAutocomplete
66 public final Dict properties = new Dict();
67
68 @HiddenInAutocomplete
69 public Set<Box> parents = new LinkedHashSet<>();
70 @HiddenInAutocomplete
71 public Set<Box> children = new LinkedHashSet<>();
72
73 @HiddenInAutocomplete
74 public Deque<Box> all = new ArrayDeque<>();
75
76 protected Set<String> knownNonProperties;
77 private String __cachedSimpleName = null;
78 private long tick = 0;
79
80 @HiddenInAutocomplete
81 public boolean disconnected = false;
82
83
84 public Box() {
85 properties.put(IO.id, newID());
86 BoxDefaultCode.configure(this);
87 }
88
89 @HiddenInAutocomplete
90 static public String newID() {
91 // ensure CallLogic is loaded
92 Dict.Prop<IdempotencyMap<Supplier<Object>>> ignored = Callbacks.main;

Callers

nothing calls this directly

Calls 4

docMethod · 0.80
toCanonMethod · 0.80
typeMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected