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

Method Pseudo

src/main/java/fieldbox/boxes/plugins/Pseudo.java:147–193  ·  view source on GitHub ↗
(Box r)

Source from the content-addressed store, hash-verified

145 .doc("`_.or.banana = 10` returns 10 if banana isn't defined anywhere, or `_.banana` if it is. Unlike once it doesn't then set `_.banana`");
146
147 public Pseudo(Box r) {
148 this.properties.put(where, First::new);
149 this.properties.put(allUp, All::new);
150 this.properties.put(up, Up::new);
151 this.properties.put(down, Down::new);
152 this.properties.put(allDown, AllDown::new);
153 this.properties.put(has, Has::new);
154 this.properties.put(signal, Signal::new);
155 this.properties.put(queue, Queue::new);
156 this.properties.put(peek, Peek::new);
157 this.properties.put(yieldUntil, Until::new);
158 this.properties.put(replace, Replacer::new);
159// this.properties.put(query, XPath::new);
160 this.properties.put(ref, Refer::new);
161 this.properties.put(named, Namer::new);
162 this.properties.put(withID, WithID::new);
163 this.properties.put(once, Oncer::new);
164 this.properties.put(here, Herer::new);
165 this.properties.put(inMainThread, MainThreader::new);
166 this.properties.put(delete, Deleter::new);
167 this.properties.put(or, Orer::new);
168
169 this.properties.putToMap(Boxes.insideRunLoop, "main.__next__", () -> {
170 r.breadthFirst(r.downwards())
171 .map(x -> x.properties.get(next))
172 .filter(x -> x != null)
173 .forEach(x -> {
174 ArrayList<Runnable> q = new ArrayList<>(x.values());
175 x.clear();
176 q.forEach(z -> z.run());
177 });
178 return true;
179 });
180 this.properties.putToMap(Boxes.insideRunLoop, "main.__next10__", () -> {
181 r.breadthFirst(r.downwards())
182 .map(x -> x.properties.get(next10))
183 .filter(x -> x != null)
184 .forEach(x -> {
185 ArrayList<Runnable> q = new ArrayList<>(x.values());
186 x.clear();
187 q.forEach(z -> RunLoop.main.delayTicks(z, 10));
188 });
189 return true;
190 });
191
192 this.properties.put(sync, Sync::new);
193 }
194
195 static public class Namer implements AsMap, HandlesCompletion {
196

Callers

nothing calls this directly

Calls 10

putToMapMethod · 0.80
breadthFirstMethod · 0.80
downwardsMethod · 0.80
delayTicksMethod · 0.80
getMethod · 0.65
putMethod · 0.45
forEachMethod · 0.45
mapMethod · 0.45
clearMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected