Map<FileName, Topology> newTopologies ) {
ArrayList<TopologyEvent> events = new ArrayList<TopologyEvent>();
// Go through the old topologies and find anything that was deleted.
for( FileName fileName : oldTopologies.keySet() ) {
if( !newTopologies.containsKey( fileName ) ) {
events.add( new TopologyEvent( TopologyEvent.Type.DELETED, oldTopologies.get( fileName ) ) );
}
}
// Go through the new topologies and figure out what was updated vs added.
for( FileName fileName : newTopologies.keySet() ) {
if( oldTopologies.containsKey( fileName ) ) {
Topology oldTopology = oldTopologies.get( fileName );
Topology newTopology = newTopologies.get( fileName );
if( newTopology.getTimestamp() > oldTopology.getTimestamp() ) {
events.add( new TopologyEvent( TopologyEvent.Type.UPDATED, newTopologies.get( fileName ) ) );
}
} else {
events.add( new TopologyEvent( TopologyEvent.Type.CREATED, newTopologies.get( fileName ) ) );
}
}
return events ;
}