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

Class Oncer

src/main/java/fieldbox/boxes/plugins/Pseudo.java:428–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426 }
427
428 static public class Oncer implements AsMap {
429
430 private final Box on;
431
432 public Oncer(Box on) {
433 this.on = on;
434 }
435
436 @Override
437 public boolean asMap_isProperty(String s) {
438 return true;
439 }
440
441 @Override
442 public Object asMap_call(Object o, Object o1) {
443 return asMap_getElement(o1);
444 }
445
446 @Override
447 public Object asMap_getElement(Object element) {
448 return asMap_get(element + "");
449 }
450
451 @Override
452 public Object asMap_setElement(int element, Object o) {
453 return null;
454 }
455
456 @Override
457 public Object asMap_get(String p) {
458 return null;
459 }
460
461 @Override
462 public Object asMap_set(String p, Object val) {
463
464 Dict.Prop cc = new Dict.Prop(p);
465
466 Dict.Prop canon = cc.findCanon();
467 if (canon != null) cc = canon;
468
469 if (cc.getAttributes().isTrue(readOnly, false))
470 throw new IllegalArgumentException("can't write to property '" + p + "', property is read-only");
471
472 Supplier s = (Supplier) Conversions.convert(val, Supplier.class);
473
474 return on.properties.computeIfAbsent(cc, x -> s.get());
475 }
476
477
478 @Override
479 public Object asMap_new(Object a) {
480 return null;
481 }
482
483 @Override
484 public Object asMap_new(Object a, Object b) {
485 return null;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected