public List < Change > calculateDiffs ( List < CdoSnapshot > snapshots , Map < SnapshotIdentifier , CdoSnapshot > previousSnapshots ) { Validate . argumentsAreNotNull ( snapshots ) ; Validate . argumentsAreNotNull ( previousSnapshots ) ; List < Change > changes = new ArrayList <> ( ) ; for ( CdoSnapshot snapshot : snapshots ) { if ( snapshot . isInitial ( ) ) { addInitialChanges ( changes , snapshot ) ; } else if ( snapshot . isTerminal ( ) ) { addTerminalChanges ( changes , snapshot ) ; } else { CdoSnapshot previousSnapshot = previousSnapshots . get ( SnapshotIdentifier . from ( snapshot ) . previous ( ) ) ; addChanges ( changes , previousSnapshot , snapshot ) ; } } return changes ; }
Calculates changes introduced by a collection of snapshots . This method expects that the previousSnapshots map contains predecessors of all non - initial and non - terminal snapshots .