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

Method checkPairs

src/main/java/fieldbox/boxes/plugins/BoxPair.java:130–190  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

128 }
129
130 private void checkPairs() {
131
132 Set<Box> mainBoxes = new LinkedHashSet<>();
133 Set<Box> frameBoxes = new LinkedHashSet<>();
134
135 this.breadthFirst(this.both()).filter(x -> x.properties.has(isPaired) && x.properties.isTrue(isPaired, false)).forEach(x -> {
136 if (x.properties.get(Box.name).length()>0)
137 {
138 mainBoxes.add(x);
139 }
140 else
141 {
142 frameBoxes.add(x);
143 }
144 });
145
146
147 for(Box b : mainBoxes)
148 {
149 for(Box bb : b.children())
150 {
151 if (bb.properties.get(Box.name).trim().length()==0)
152 {
153 b.properties.put(f, bb);
154 bb.properties.put(m, b);
155 b.properties.put(isPaired, true);
156 bb.properties.put(isPaired, true);
157 }
158 }
159 }
160
161 for(Box bb : frameBoxes)
162 {
163 bb.properties.put(name, "");
164 // install decoration if there isn't any
165 bb.properties.put(isPaired, true);
166 }
167
168 // callbacks for frame changed!
169 for(Box bb : frameBoxes)
170 {
171 IdempotencyMap<Supplier<Collection<? extends Supplier<FLine>>>> q = bb.properties.getOrConstruct(FLineDrawing.bulkLines);
172 Supplier<Collection<? extends Supplier<FLine>>> fr = q.get("__framemarking__");
173 if (fr==null)
174 {
175 installFrameDecor(bb);
176 }
177 }
178 for(Box bb : mainBoxes)
179 {
180 IdempotencyMap<Supplier<Collection<? extends Supplier<FLine>>>> q = bb.properties.getOrConstruct(FLineDrawing.bulkLines);
181 Supplier<Collection<? extends Supplier<FLine>>> fr = q.get("__framemarking__");
182 if (fr==null)
183 {
184 installMainDecor(bb);
185 }
186 }
187

Callers 1

BoxPairMethod · 0.95

Calls 13

installFrameDecorMethod · 0.95
installMainDecorMethod · 0.95
breadthFirstMethod · 0.80
isTrueMethod · 0.80
childrenMethod · 0.80
getMethod · 0.65
forEachMethod · 0.45
bothMethod · 0.45
hasMethod · 0.45
lengthMethod · 0.45
addMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected