code: void preProcessAsSourceSegment(MergeSegmentOperation operation) throws StreamSegmentNotSealedException,
              StreamSegmentMergedException, StreamSegmentTruncatedException {
          Exceptions.checkArgument(this.id == operation.getSourceSegmentId(),
                  "operation", "Invalid Operation Source Segment Id.");
  
          if (this.merged) {
              throw new StreamSegmentMergedException(this.name);
          }
  
          if (!this.sealed) {
              throw new StreamSegmentNotSealedException(this.name);
          }
  
          if (this.startOffset > 0) {
              throw new StreamSegmentTruncatedException(this.name, "Segment cannot be merged because it is truncated.", null);
          }
  
          if (!this.recoveryMode) {
              operation.setLength(this.length);
          }
      }
docs: Pre-processes the given operation as a Source Segment.
  
  @param operation The operation.
  @throws IllegalArgumentException        If the operation is for a different Segment.
  @throws StreamSegmentNotSealedException If the Segment is not sealed.
  @throws StreamSegmentMergedException    If the Segment is already merged.
  @throws StreamSegmentTruncatedException If the Segment is truncated.