void setWrap ( Collection < Unit > exceptUnit , Collection < Unit > plusUnfiltered ) { if ( isImport ( ) ) { si . setOuterWrap ( state . outerMap . wrapImport ( activeGuts , si ) ) ; } else { // Collect Units for be wrapped together. Just this except for overloaded methods List < Unit > units ; if ( snippet ( ) . kind ( ) == Kind . METHOD ) { String name = ( ( MethodSnippet ) snippet ( ) ) . name ( ) ; units = plusUnfiltered . stream ( ) . filter ( u -> u . snippet ( ) . kind ( ) == Kind . METHOD && ( ( MethodSnippet ) u . snippet ( ) ) . name ( ) . equals ( name ) ) . collect ( toList ( ) ) ; } else { units = Collections . singletonList ( this ) ; } // Keys to exclude from imports Set < Key > except = exceptUnit . stream ( ) . map ( u -> u . snippet ( ) . key ( ) ) . collect ( toSet ( ) ) ; // Snippets to add to imports Collection < Snippet > plus = plusUnfiltered . stream ( ) . filter ( u -> ! units . contains ( u ) ) . map ( Unit :: snippet ) . collect ( toList ( ) ) ; // Snippets to wrap in an outer List < Snippet > snippets = units . stream ( ) . map ( Unit :: snippet ) . collect ( toList ( ) ) ; // Snippet wraps to wrap in an outer List < Wrap > wraps = units . stream ( ) . map ( u -> u . activeGuts ) . collect ( toList ( ) ) ; // Set the outer wrap for this snippet si . setOuterWrap ( state . outerMap . wrapInClass ( except , plus , snippets , wraps ) ) ; state . debug ( DBG_WRAP , "++setWrap() %s\n%s\n" , si , si . outerWrap ( ) . wrapped ( ) ) ; } }
Set the outer wrap of our Snippet