Method to check that segments to seal are present in current epoch.

@param segmentsToSeal segments to seal
@param currentEpoch current epoch record
@return true if a scale operation can be performed, false otherwise
512779
public static boolean canScaleFor(final List<Long> segmentsToSeal, final EpochRecord currentEpoch) {
        return segmentsToSeal.stream().allMatch(x -> currentEpoch.getSegment(x) != null);
    }
347954
public synchronized Segment segment(long index) {
    assertOpen();
    // Check if the current segment contains the given index first in order to prevent an unnecessary map lookup.
    if (currentSegment != null && currentSegment.validIndex(index))
      return currentSegment;

    // If the index is in another segment, get the entry with the next lowest first index.
    Map.Entry<Long, Segment> segment = segments.floorEntry(index);
    return segment != null ? segment.getValue() : null;
  }
1086707
@Override
  public boolean isHistoryEnabled() {
    if (log.isDebugEnabled()) {
      log.debug("Current history level: {}", historyLevel);
    }
    return !historyLevel.equals(HistoryLevel.NONE);
  }
1342140
public boolean isPolicyExceeded() {
    boolean withinMaxRetries = maxAttempts == -1 || attemptCount < maxAttempts;
    boolean withinMaxDuration = maxDuration == -1 || System.nanoTime() - startTime < maxDuration;
    return !withinMaxRetries || !withinMaxDuration;
  }
1362928
private boolean isOK(TimeSpan timeSpan) {
	return res.exists() && (res.lastModified() + timeSpan.getMillis() >= System.currentTimeMillis());
    }
48136
public boolean shouldAggregateSoils(HashMap<String, String> currentSoil, HashMap<String, String> previousSoil) {
		float ruCurrent;
		float ruPrevious;
		float resultFirstRule;
		float resultSecRule;
		boolean firstRule;
		boolean secRule;

		// ru in mm/m
		ruCurrent = (parseFloat(currentSoil.get(SLDUL)) - parseFloat(currentSoil.get(SLLL))) * 1000.0f;
		ruPrevious = (parseFloat(previousSoil.get(SLDUL)) - parseFloat(previousSoil.get(SLLL))) * 1000f;
		resultFirstRule = round(Math.abs(ruCurrent - ruPrevious));
		firstRule = resultFirstRule <= FIRST_THRESHOLD_DEFAULT;

		/**
		 * First rule : (currentRu - previousRu) <= 5 mm/m Second rule :
		 * (currentBdm - previousBdm) <= 0.05 g/cm3 Soil layers are aggregated
		 * if the rules below are both true
		 * */
		resultSecRule = round(Math.abs(parseFloat(currentSoil.get(SLBDM)) - parseFloat(previousSoil.get(SLBDM))));
		secRule = (round(resultSecRule) <= SECOND_THRESHOLD_DEFAULT);

		log.debug("*********************");
		log.debug("Ru current : "+ruCurrent);
		log.debug("Ru previous : "+ruPrevious);
		log.debug("First rule : " + resultFirstRule + " <= " + FIRST_THRESHOLD_DEFAULT + " ? " + firstRule);
		log.debug("Sec rule : " + resultSecRule + " <= " + SECOND_THRESHOLD_DEFAULT + " ? " + secRule);
		log.debug("*********************");

		return firstRule && secRule;
	}
911961
boolean segmentExists(long txid) throws IOException {
    List<RemoteEditLog> segments = getManifest();
    for (RemoteEditLog segment : segments) {
      if (segment.getStartTxId() == txid) {
        return true;
      }
    }
    return false;
  }
19376
public static boolean hasOverlappingOffsets(TermOccurrence theOcc, Collection<TermOccurrence> theOccCollection) {
		for(TermOccurrence o:theOccCollection)
			if(areOffsetsOverlapping(theOcc, o))
				return true;
		return false;
	}
908305
private synchronized boolean poll(long currentTimeMillis) {
		long timeDiffMillis = currentTimeMillis - _lastPolled;
		if (timeDiffMillis > POLL_THRESHOLD_MILLIS) {
			final long lastModifiedBefore = _lastModified;
			_lastModified = _file.lastModified();
			_lastPolled = System.currentTimeMillis();

			return _lastModified != lastModifiedBefore;
		}
		return false;
	}
1211454
protected boolean validateWithSegmentBoundary(T1 value) throws IOException {
    if (!closed && segmentRegistration != null) {
      T1 tmpSegmentValueBoundary = segmentValuesBoundary.get(segmentName);
      if (tmpSegmentValueBoundary == null
          || compareWithBoundary(value, tmpSegmentValueBoundary)) {
        return true;
      }
    }
    return false;
  }
1101913
public boolean isInZeroBlock(int ch) 
    {
        // valid, uncompacted trie and valid c?
        if (m_isCompacted_ || ch > UCharacter.MAX_VALUE 
            || ch < UCharacter.MIN_VALUE) {
            return true;
        }
    
        return m_index_[ch >> SHIFT_] == 0;
    }
891418
private boolean validSecondStep(LegStep secondStep, RouteProgress routeProgress) {
    return routeProgress.currentLegProgress().upComingStep() != null
      && routeProgress.currentLegProgress().upComingStep().equals(secondStep);
  }
426646
private CompletableFuture<WriterFlushResult> sealIfNecessary(WriterFlushResult flushResult, TimeoutTimer timer) {
        if (!this.hasSealPending.get() || !(this.operations.getFirst() instanceof StreamSegmentSealOperation)) {
            // Either no Seal is pending or the next operation is not a seal - we cannot execute a seal.
            return CompletableFuture.completedFuture(flushResult);
        }

        long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "sealIfNecessary");
        CompletableFuture<Void> sealTask;
        if (this.handle.get() == null) {
            // Segment is empty. It might not have been created yet, so don't do anything.
            assert this.metadata.getStorageLength() == 0 : "handle is null but Metadata.StorageLength is non-zero";
            sealTask = CompletableFuture.completedFuture(null);
        } else {
            // Segment is non-empty; it should exist.
            sealTask = this.storage.seal(this.handle.get(), timer.getRemaining());
        }

        return sealTask
                .thenComposeAsync(v -> sealAttributes(timer.getRemaining()), this.executor)
                .handleAsync((v, ex) -> {
                    ex = Exceptions.unwrap(ex);
                    if (ex != null && !(ex instanceof StreamSegmentSealedException)) {
                        // The operation failed, and it was not because the Segment was already Sealed. Throw it again.
                        // We consider the Seal to succeed if the Segment in Storage is already sealed - it's an idempotent operation.
                        if (ex instanceof StreamSegmentNotExistsException) {
                            // The segment does not exist (anymore). This is possible if it got merged into another one.
                            // Begin a reconciliation to determine the actual state.
                            setState(AggregatorState.ReconciliationNeeded);
                        }
                        throw new CompletionException(ex);
                    }

                    updateStatePostSeal();
                    LoggerHelpers.traceLeave(log, this.traceObjectId, "sealIfNecessary", traceId, flushResult);
                    return flushResult;
                }, this.executor);
    }
149484
private boolean isCurrentLine(int rowStartOffset) {
    int caretPosition = component.getCaretPosition();
    Element root = component.getDocument().getDefaultRootElement();

    return root.getElementIndex(rowStartOffset) == root.getElementIndex(caretPosition);
  }
595013
synchronized JournalSegment<E> getSegment(long index) {
    assertOpen();
    // Check if the current segment contains the given index first in order to prevent an unnecessary map lookup.
    if (currentSegment != null && index > currentSegment.index()) {
      return currentSegment;
    }

    // If the index is in another segment, get the entry with the next lowest first index.
    Map.Entry<Long, JournalSegment<E>> segment = segments.floorEntry(index);
    if (segment != null) {
      return segment.getValue();
    }
    return getFirstSegment();
  }
660877
private boolean isNewStep(RouteProgress routeProgress) {
    boolean isNewStep = currentStep == null || !currentStep.equals(routeProgress.currentLegProgress().currentStep());
    currentStep = routeProgress.currentLegProgress().currentStep();
    resetAlertLevels(isNewStep);
    return isNewStep;
  }
1343061
private void checkEntry(long index, Segment segment, Segment compactSegment) {
    try (Entry entry = segment.get(index)) {
      // If an entry was found, only remove the entry from the segment if it's not a tombstone that has been released.
      if (entry != null) {
        checkEntry(index, entry, segment, compactSegment);
      } else {
        compactSegment.skip(1);
      }
    }
  }