code: @Override
    public IScan getPrevScanAtMsLevel(int scanNum, int msLevel) {
      TreeMap<Integer, IScan> msLevelMap = getMapMsLevel2index().get(msLevel).getNum2scan();
      if (msLevelMap == null) {
        return null;
      }
      Map.Entry<Integer, IScan> entry = msLevelMap.floorEntry(scanNum - 1);
      if (entry != null) {
        return entry.getValue();
      }
      return null;
    }
docs: Finds the next scan at the same MS level, as the scan with scanNum. If the scan number provided
  is not in the map, this method will find the next existing one.
  
  @param scanNum Scan number
  @param msLevel MS Level at which to search for that scan number
  @return either next Scan, or null, if there are no further scans at this level. If MS level is
  incorrect, also returns null.