public void runPostProcessing ( boolean multiRoot ) { // make identical vertices have the same set of properties // two vertices are identical if they have the same address value. // Id for every vertex is unique, so this is not a flag here for ( Set < ExecutionGraphVertex > vs : this . addressToVertices . values ( ) ) { // the logic below is very fragile and based on some empirical model // and may not work for other type of graphs if ( vs != null && vs . size ( ) > 1 ) { for ( ExecutionGraphVertex vertex : vs ) { if ( CELL_WITH_FORMULA == vertex . properties ( ) . getType ( ) || null != vertex . properties ( ) . getAlias ( ) ) { copyProperties ( vertex , vs ) ; break ; } } } } // copy or link subgraphs to identical vertices and modify Formula field with additional values Map < String , AtomicInteger > adressToCount = new HashMap <> ( ) ; for ( ExecutionGraphVertex vertex : this . graph . getVertices ( ) ) { // restore/add subgraphs to identical vertices Type type = vertex . properties ( ) . getType ( ) ; if ( isCell ( type ) ) { String address = vertex . properties ( ) . getName ( ) ; adressToCount . putIfAbsent ( address , new AtomicInteger ( 0 ) ) ; if ( adressToCount . get ( address ) . incrementAndGet ( ) > 1 ) { // count > 1 // need to link Set < ExecutionGraphVertex > subgraphTops = new HashSet <> ( ) ; this . graph . getVertices ( ) . stream ( ) . filter ( v -> address . equals ( v . properties . getName ( ) ) ) // check for subgraph . forEach ( v -> this . graph . getIncomingEdgesOf ( v ) . forEach ( e -> subgraphTops . add ( this . graph . getEdgeSource ( e ) ) ) ) ; for ( ExecutionGraphVertex subVertex : subgraphTops ) { if ( ! this . addressToVertices . containsKey ( address ) ) { continue ; } this . addressToVertices . get ( address ) . forEach ( v -> this . graph . addEdge ( subVertex , v ) ) ; } } } if ( RANGE == type ) { connectValuesToRange ( vertex , this ) ; } /* Adding IF Value */ if ( IF == type ) { Collection < ExecutionGraphEdge > two = this . graph . getIncomingEdgesOf ( vertex ) ; if ( two . size ( ) != 2 ) { throw new CalculationEngineException ( "IF must have only two incoming edges." ) ; } Object ifBranchValue = null ; for ( ExecutionGraphEdge e : two ) { ExecutionGraphVertex oneOfTwo = this . graph . getEdgeSource ( e ) ; if ( ! isCompareOperand ( oneOfTwo . getName ( ) ) ) { ifBranchValue = oneOfTwo . properties ( ) . getValue ( ) ; break ; } } vertex . properties ( ) . setValue ( ifBranchValue ) ; } } if ( this . config . getDuplicatesNumberThreshold ( ) != - 1 ) { removeAllDuplicates ( this ) ; } }
Do anything you want here . After graph is completed and we are out of POI context you can add \ remove \ etc any information you want .