public void calculate ( ) { resetResults ( ) ; SimultaneousExecutor executor = new SimultaneousExecutor ( getClass ( ) , "calculate" ) ; final int numThreads = executor . getCorePoolSize ( ) ; for ( int i = 0 ; i < numThreads ; i ++ ) { final int threadNumber = i ; executor . execute ( new Runnable ( ) { public void run ( ) { HollowIndexerValueTraverser fromTraverser = new HollowIndexerValueTraverser ( from , type , elementPaths ) ; HollowIndexerValueTraverser toTraverser = new HollowIndexerValueTraverser ( to , type , elementPaths ) ; int hashedResults [ ] = new int [ 16 ] ; for ( int i = threadNumber ; i < matcher . getMatchedOrdinals ( ) . size ( ) ; i += numThreads ) { long ordinalPair = matcher . getMatchedOrdinals ( ) . get ( i ) ; int fromOrdinal = ( int ) ( ordinalPair >>> 32 ) ; int toOrdinal = ( int ) ordinalPair ; fromTraverser . traverse ( fromOrdinal ) ; toTraverser . traverse ( toOrdinal ) ; if ( fromTraverser . getNumMatches ( ) * 2 > hashedResults . length ) hashedResults = new int [ hashTableSize ( fromTraverser . getNumMatches ( ) ) ] ; populateHashTable ( fromTraverser , hashedResults ) ; countMatches ( fromTraverser , toTraverser , hashedResults ) ; } for ( int i = threadNumber ; i < matcher . getExtraInFrom ( ) . size ( ) ; i += numThreads ) { fromTraverser . traverse ( matcher . getExtraInFrom ( ) . get ( i ) ) ; totalUnmatchedFromElements . addAndGet ( fromTraverser . getNumMatches ( ) ) ; } for ( int i = threadNumber ; i < matcher . getExtraInTo ( ) . size ( ) ; i += numThreads ) { toTraverser . traverse ( matcher . getExtraInTo ( ) . get ( i ) ) ; totalUnmatchedToElements . addAndGet ( toTraverser . getNumMatches ( ) ) ; } } } ) ; } try { executor . awaitSuccessfulCompletion ( ) ; } catch ( Exception ex ) { throw new RuntimeException ( ex ) ; } }
Calculate the differences