public void subtract ( LCMSRangeSet other ) { anyLvlSet . removeAll ( other . anyLvlSet ) ; for ( Map . Entry < Integer , MsLevelRangeSet > lvlMapEntry : lvlMap . entrySet ( ) ) { Integer msLevel = lvlMapEntry . getKey ( ) ; MsLevelRangeSet msLevelRangeSet = lvlMapEntry . getValue ( ) ; // remove any top level scan ranges from the "any precursor" map at // this ms level msLevelRangeSet . anyPrecursorSet . removeAll ( other . anyLvlSet ) ; // if the other range set had this level, remove entries contained in it MsLevelRangeSet otherMsLevelRangeSet = other . lvlMap . get ( msLevel ) ; msLevelRangeSet . anyPrecursorSet . removeAll ( otherMsLevelRangeSet . anyPrecursorSet ) ; for ( Map . Entry < DoubleRange , RangeSet < Integer > > rngMapEntry : msLevelRangeSet . rngMap . entrySet ( ) ) { if ( rngMapEntry . getValue ( ) . isEmpty ( ) ) { continue ; } DoubleRange mzRange = rngMapEntry . getKey ( ) ; RangeSet < Integer > rangeSet = rngMapEntry . getValue ( ) ; rangeSet . removeAll ( other . anyLvlSet ) ; if ( ! rangeSet . isEmpty ( ) ) { rangeSet . removeAll ( otherMsLevelRangeSet . anyPrecursorSet ) ; } if ( ! rangeSet . isEmpty ( ) ) { RangeSet < Integer > otherRangeSetAtMsLevelForPrecursorRange = otherMsLevelRangeSet . rngMap . get ( mzRange ) ; if ( otherRangeSetAtMsLevelForPrecursorRange != null ) { rangeSet . removeAll ( otherRangeSetAtMsLevelForPrecursorRange ) ; } } } } }
Will modify the set . Intended usage - when unloading data in LCMSData create one range set for data loaded by other users then create a separate range set for the LCMSRange that you want to unload . Subtract the loaded by others from the range set you want to unload . Use this range set for unloading .