Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #1027775 - metaTransformer_transformableAndList

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2635L/17K).

// MetaTransformer that understands Transformable and List
static MetaTransformer metaTransformer_transformableAndList() {
  ret new MetaTransformer(new MetaTransformer.StructureHandler() {
    public O transform(O o, IF1 recurse) {
      if (o cast Transformable)
        ret o.transformUsing(recurse);
      if (o cast L)
        ret map_ping(recurse, o);
      null;
    }
    
    public void visit(O o, IVF1 recurse) {
      if (o cast Visitable)
        o.visitUsing(recurse);
      else if (o cast L)
        for ping (O x : o)
          recurse.get(x);
    }
  });
}

Author comment

Began life as a copy of #1027751

download  show line numbers  debug dex   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027775
Snippet name: metaTransformer_transformableAndList
Eternal ID of this version: #1027775/13
Text MD5: 79a51adc4e5b9b1257a0c0b2cebcb227
Transpilation MD5: 8d36b60364efe72af7c6ba92521a9ff2
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-17 00:32:21
Source code size: 593 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 87 / 190
Version history: 12 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1027775 & http://1027775.tinybrain.de