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

Class Subscope

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

todo: if 'prop' is persistent, so should prefix+'prop'

Source from the content-addressed store, hash-verified

770
771 /**
772 * todo: if 'prop' is persistent, so should prefix+'prop'
773 */
774 static public class Subscope implements fieldlinker.AsMap {
775 protected String prefix;
776 protected fieldlinker.AsMap delegateTo;
777
778 public Subscope(fieldlinker.AsMap from) {
779
780 this.prefix = Execution.context.get()
781 .peek().properties.getOrConstruct(IO.id);
782 this.delegateTo = from;
783 }
784
785 public Subscope(Box prefixFrom, Box from) {
786 this.prefix = prefixFrom.properties.getOrConstruct(IO.id);
787 this.delegateTo = from;
788 }
789
790 public Subscope(String prefixFrom, Box from) {
791 this.prefix = prefixFrom;
792 this.delegateTo = from;
793 }
794
795
796 @Override
797 public boolean asMap_isProperty(String p) {
798 return delegateTo.asMap_isProperty(prefix + p);
799 }
800
801 @Override
802 public Object asMap_call(Object a, Object b) {
803 return delegateTo.asMap_call(a, b);
804 }
805
806 @Override
807 public Object asMap_get(String p) {
808 return delegateTo.asMap_get(prefix + p);
809 }
810
811
812 @Override
813 public boolean asMap_delete(Object o) {
814 return delegateTo.asMap_delete(prefix + o);
815 }
816
817 @Override
818 public Object asMap_set(String p, Object o) {
819 return delegateTo.asMap_set(prefix + p, o);
820 }
821
822 @Override
823 public Object asMap_new(Object a) {
824 return delegateTo.asMap_new(a);
825 }
826
827 @Override
828 public Object asMap_new(Object a, Object b) {
829 return delegateTo.asMap_new(a, b);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected