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

Method asMap_set

src/main/java/field/graphics/Scene.java:456–487  ·  view source on GitHub ↗
(String p, Object o)

Source from the content-addressed store, hash-verified

454 }
455
456 @Override
457 @HiddenInAutocomplete
458 public Object asMap_set(String p, Object o) {
459 Object fo = Conversions.convert(o, Supplier.class);
460 if (fo instanceof Supplier) return getDefaultBundle().set(p, (Supplier) fo);
461 if (fo instanceof InvocationHandler) {
462 return getDefaultBundle().set(p, () -> {
463 try {
464 return ((InvocationHandler) fo).invoke(fo, supplier_get, nothing);
465 } catch (Throwable throwable) {
466 throwable.printStackTrace();
467 }
468 return null;
469 });
470 }
471
472 if (Uniform.isAccepableInstance(fo))
473 return getDefaultBundle().set(p, () -> fo).setIntOnly(fo instanceof Integer);
474
475 if (o instanceof ContainsPerform) {
476 o = ((ContainsPerform) o).getPerform();
477 }
478 if (fo instanceof OffersUniform) {
479 getDefaultBundle().set(p, () -> ((OffersUniform) fo).getUniform());
480 // fall through -- connect things as well as set them as uniforms
481 }
482
483 o = Conversions.convert(o, Perform.class);
484 if (o instanceof Perform) {
485 return attach(p, (Perform) o);
486 } else return super.asMap_set(p, o);
487 }
488
489 @Override
490 @HiddenInAutocomplete

Callers 1

asMap_setMethod · 0.95

Calls 10

convertMethod · 0.95
getDefaultBundleMethod · 0.95
isAccepableInstanceMethod · 0.95
attachMethod · 0.95
setIntOnlyMethod · 0.80
setMethod · 0.65
getPerformMethod · 0.65
getUniformMethod · 0.65
asMap_setMethod · 0.65
invokeMethod · 0.45

Tested by

no test coverage detected