private void handleDeltas ( Deque < MutablePair < DeltaFIFO . DeltaType , Object > > deltas ) { if ( Collections . isEmptyCollection ( deltas ) ) { return ; } // from oldest to newest for ( MutablePair < DeltaFIFO . DeltaType , Object > delta : deltas ) { DeltaFIFO . DeltaType deltaType = delta . getLeft ( ) ; switch ( deltaType ) { case Sync : case Added : case Updated : boolean isSync = deltaType == DeltaFIFO . DeltaType . Sync ; Object oldObj = this . indexer . get ( ( ApiType ) delta . getRight ( ) ) ; if ( oldObj != null ) { this . indexer . update ( ( ApiType ) delta . getRight ( ) ) ; this . processor . distribute ( new ProcessorListener . UpdateNotification ( oldObj , delta . getRight ( ) ) , isSync ) ; } else { this . indexer . add ( ( ApiType ) delta . getRight ( ) ) ; this . processor . distribute ( new ProcessorListener . AddNotification ( delta . getRight ( ) ) , isSync ) ; } break ; case Deleted : this . indexer . delete ( ( ApiType ) delta . getRight ( ) ) ; this . processor . distribute ( new ProcessorListener . DeleteNotification ( delta . getRight ( ) ) , false ) ; break ; } } }
handleDeltas handles deltas and call processor distribute .