private ProtoNetwork stage1 ( final File [ ] networks ) { beginStage ( PHASE2_STAGE1_HDR , "1" , NUM_PHASES ) ; final int netct = networks . length ; final StringBuilder bldr = new StringBuilder ( ) ; bldr . append ( "Merging " ) ; bldr . append ( netct ) ; bldr . append ( " network" ) ; if ( netct > 1 ) { bldr . append ( "s" ) ; } stageOutput ( bldr . toString ( ) ) ; long t1 = currentTimeMillis ( ) ; Collection < ProtoNetworkDescriptor > nds = sizedArrayList ( netct ) ; for ( final File network : networks ) { final String root = network . getAbsolutePath ( ) ; final String netPath = asPath ( root , PROTO_NETWORK_FILENAME ) ; final File networkBin = new File ( netPath ) ; nds . add ( new BinaryProtoNetworkDescriptor ( networkBin ) ) ; } ProtoNetwork ret = p2 . stage1Merger ( nds ) ; new File ( artifactPath . getAbsolutePath ( ) + "/merged" ) . mkdirs ( ) ; p2 . stage4WriteEquivalentProtoNetwork ( ret , artifactPath . getAbsolutePath ( ) + "/merged" ) ; if ( withDebug ( ) ) { try { TextProtoNetworkExternalizer textExternalizer = new TextProtoNetworkExternalizer ( ) ; textExternalizer . writeProtoNetwork ( ret , artifactPath . getAbsolutePath ( ) + "/merged" ) ; } catch ( ProtoNetworkError e ) { error ( "Could not write out equivalenced proto network." ) ; } } long t2 = currentTimeMillis ( ) ; bldr . setLength ( 0 ) ; markTime ( bldr , t1 , t2 ) ; markEndStage ( bldr ) ; stageOutput ( bldr . toString ( ) ) ; return ret ; }
Stage one merger of networks returning the merged proto - network .