Adds multiple SegmentChunks.

@param segmentChunks The SegmentChunks to add. These SegmentChunks must be in continuity of any existing SegmentChunks.
322882
synchronized void addChunks(List<SegmentChunk> segmentChunks) {
        Preconditions.checkState(!this.sealed, "Cannot add SegmentChunks for a Sealed Handle.");
        long expectedOffset = 0;
        if (this.segmentChunks.size() > 0) {
            expectedOffset = this.segmentChunks.get(this.segmentChunks.size() - 1).getLastOffset();
        } else if (segmentChunks.size() > 0) {
            expectedOffset = segmentChunks.get(0).getStartOffset();
        }

        for (SegmentChunk s : segmentChunks) {
            Preconditions.checkArgument(s.getStartOffset() == expectedOffset,
                    "Invalid SegmentChunk StartOffset. Expected %s, given %s.", expectedOffset, s.getStartOffset());
            expectedOffset += s.getLength();
        }

        this.segmentChunks.addAll(segmentChunks);
        this.activeChunkHandle = null;
    }
599365
public void cancelSegments(IntSet cancelledSegments) {
      if (segments.removeAll(cancelledSegments)) {
         if (trace) {
            log.tracef("Cancelling outbound transfer to node %s, segments %s (remaining segments %s)",
                       destination, cancelledSegments, segments);
         }
         entriesBySegment.keySet().removeAll(cancelledSegments);  // here we do not update accumulatedEntries but this inaccuracy does not cause any harm
         if (segments.isEmpty()) {
            cancel();
         }
      }
   }
829355
public void add(InputSplit s) throws IOException {
    if (null == splits) {
      throw new IOException("Uninitialized InputSplit");
    }
    if (fill == splits.length) {
      throw new IOException("Too many splits");
    }
    splits[fill++] = s;
    totsize += s.getLength();
  }
206461
synchronized List<SegmentChunk> chunks() {
        if (this.sealed) {
            return this.segmentChunks; // This is already an unmodifiable list.
        } else {
            return Collections.unmodifiableList(this.segmentChunks.subList(0, this.segmentChunks.size()));
        }
    }
1362547
protected function addSegment(Segment $segment)
    {
        if (!$segment->getSegment() && $this->segmentName) {
            $segment->setSegment($this->segmentName);
        }

        if (!$segment->getType()) {
            $metricTypes = array(self::TYPE_NUMBER, self::TYPE_FLOAT, self::TYPE_MONEY, self::TYPE_DURATION_S, self::TYPE_DURATION_MS);
            if (in_array($this->getType(), $metricTypes, $strict = true)) {
                $segment->setType(Segment::TYPE_METRIC);
            } else {
                $segment->setType(Segment::TYPE_DIMENSION);
            }
        }

        if (!$segment->getCategoryId() && $this->category) {
            $segment->setCategory($this->category);
        }

        if (!$segment->getName() && $this->nameSingular) {
            $segment->setName($this->nameSingular);
        }

        $sqlSegment = $segment->getSqlSegment();

        if (empty($sqlSegment) && !$segment->getUnionOfSegments()) {
            if (!empty($this->sqlSegment)) {
                $segment->setSqlSegment($this->sqlSegment);
            } elseif ($this->dbTableName && $this->columnName) {
                $segment->setSqlSegment($this->dbTableName . '.' . $this->columnName);
            } else {
                throw new Exception('Segment cannot be added because no sql segment is set');
            }
        }

        if (!$this->suggestedValuesCallback) {
            // we can generate effecient value callback for enums automatically
            $enum = $this->getEnumColumnValues();
            if (!empty($enum)) {
                $this->suggestedValuesCallback = function ($idSite, $maxValuesToReturn) use ($enum) {
                    $values = array_values($enum);
                    return array_slice($values, 0, $maxValuesToReturn);
                };
            }
        }

        if (!$this->acceptValues) {
            // we can generate accept values for enums automatically
            $enum = $this->getEnumColumnValues();
            if (!empty($enum)) {
                $enumValues = array_values($enum);
                $enumValues = array_slice($enumValues, 0, 20);
                $this->acceptValues = 'Eg. ' . implode(', ', $enumValues);
            };
        }

        if ($this->acceptValues && !$segment->getAcceptValues()) {
            $segment->setAcceptedValues($this->acceptValues);
        }

        if (!$this->sqlFilterValue && !$segment->getSqlFilter() && !$segment->getSqlFilterValue()) {
            // no sql filter configured, we try to configure automatically for enums
            $enum = $this->getEnumColumnValues();
            if (!empty($enum)) {
                $this->sqlFilterValue = function ($value, $sqlSegmentName) use ($enum) {
                    if (isset($enum[$value])) {
                        return $value;
                    }

                    $id = array_search($value, $enum);

                    if ($id === false) {
                        $id = array_search(strtolower(trim(urldecode($value))), $enum);

                        if ($id === false) {
                            throw new \Exception("Invalid '$sqlSegmentName' segment value $value");
                        }
                    }

                    return $id;
                };
            };
        }

        if ($this->suggestedValuesCallback && !$segment->getSuggestedValuesCallback()) {
            $segment->setSuggestedValuesCallback($this->suggestedValuesCallback);
        }

        if ($this->sqlFilterValue && !$segment->getSqlFilterValue()) {
            $segment->setSqlFilterValue($this->sqlFilterValue);
        }

        if ($this->sqlFilter && !$segment->getSqlFilter()) {
            $segment->setSqlFilter($this->sqlFilter);
        }

        if (!$this->allowAnonymous) {
            $segment->setRequiresAtLeastViewAccess(true);
        }

        $this->segments[] = $segment;
    }
253694
public Segment push(Segment segment) {
    segment.prev = this;
    segment.next = next;
    next.prev = segment;
    next = segment;
    return segment;
  }
543487
public void addSegment(Segment segment, boolean bStartNewPath) {
		mergeVertexDescription(segment.getDescription());
		if (segment.getType() == Type.Line) {
			Point point = new Point();
			if (bStartNewPath || isEmpty()) {
				segment.queryStart(point);
				startPath(point);
			}

			segment.queryEnd(point);
			lineTo(point);
		} else {
			throw GeometryException.GeometryInternalError();
		}
	}
479556
public synchronized void wrap(List<Segment> segments) throws IOException {
        int newWorkingGeneration = (_workingGeneration + 1) % Integer.MAX_VALUE;
        int newWorkingSectionOffset = (_workingSectionOffset + _bytesPerSection) % _bytesPerSegment;
        int cnt = segments.size();
        int pos = _segmentDataStart + newWorkingSectionOffset;

        // Ensure buffer capacity
        ensureCapacity(cnt);

        int newLiveSegmentCount = 0;
        for (int index = 0; index < cnt; index++) {
            if (segments.get(index) != null)
                newLiveSegmentCount++;
        }
        
        // Update compact-section
        for (int index = 0; index < cnt; index++) {
            Segment seg = segments.get(index);
            if (seg != null) {
                if (seg.getLoadSize() > 0) {
                    // Segment populated with data
                    writeInt(pos, LIVE_SEGMENT);
                    writeInt(pos + 4, seg.getLoadSize());
                } else {
                    // Segment initialized without any data
                    writeInt(pos, FREE_SEGMENT);
                    writeInt(pos + 4, 0);

                    // Treat it as a non-live segment
                    newLiveSegmentCount--;
                }
            } else {
                // Segment not alive
                writeInt(pos, FREE_SEGMENT);
                writeInt(pos + 4, 0);
            }
            pos += _bytesPerSegment;
        }
        _mmapBuffer.force();

        writeInt(newWorkingSectionOffset, newWorkingGeneration);
        writeInt(newWorkingSectionOffset + 4, newLiveSegmentCount);
        _mmapBuffer.force();

        // Switch working section to the new one
        _liveSegmentCount = newLiveSegmentCount;
        _workingGeneration = newWorkingGeneration;
        _workingSectionOffset = newWorkingSectionOffset;

        _log.info(_metaFile.getCanonicalPath() + " updated");
        _log.info("workingGeneration=" + _workingGeneration + " liveSegmentCount=" + _liveSegmentCount);
    }
325313
private LinkedHashMapSegment<K, V> segmentFor(int hash) {
        int h = hash(hash);
        return segments[(h >>> segmentShift) & segmentMask];
    }
327700
public void addBin(List<Chunk> chunksToAdd, long lastLocus) {
    assert chunks != null;
    contig = new Contig(contig.referenceName, contig.start, lastLocus);
    chunks.addAll(chunksToAdd);
    updateSpan();
  }
503728
public void add(final byte[] buf, final int offset, final int len) {
    segments.add(new BufferSegment(buf, offset, len));
    total_length += len;
  }
780716
void addGeometry(Geometry geometry) {
		if (geometry.isEmpty())
			return;
		
		int type = geometry.getType().value();

		if (MultiVertexGeometry.isMultiVertex(type))
			addMultiVertexGeometry_((MultiVertexGeometry) geometry);
		else if (MultiPath.isSegment(type))
			addSegment_((Segment) geometry);
		else if (type == Geometry.GeometryType.Envelope)
			addEnvelope_((Envelope) geometry);
		else if (type == Geometry.GeometryType.Point)
			addPoint_((Point) geometry);
		else
			throw new IllegalArgumentException("invalid shape type");
	}
301896
private void createPartitions() {

        for (Map.Entry<String, String> partitionEntry : this.partitions.entrySet()) {
            try {
                this.addPartitionInternal(partitionEntry.getKey(), partitionEntry.getValue());
            } catch (Exception e) { //NOSONAR
                throw new AssertionError("Could not create partitions " + this.partitions, e);
            }
        }
    }
1222575
def add_subsegment(self, subsegment):
        
        super(Subsegment, self).add_subsegment(subsegment)
        self.parent_segment.increment()
573597
public void moveSegmentOut(final String sequenceName, final List<SegmentIdWithShardSpec> identifiers)
  {
    synchronized (segments) {
      final SegmentsForSequence activeSegmentsForSequence = segments.get(sequenceName);
      if (activeSegmentsForSequence == null) {
        throw new ISE("WTF?! Asked to remove segments for sequenceName[%s] which doesn't exist...", sequenceName);
      }

      for (final SegmentIdWithShardSpec identifier : identifiers) {
        log.info("Moving segment[%s] out of active list.", identifier);
        final long key = identifier.getInterval().getStartMillis();
        final SegmentsOfInterval segmentsOfInterval = activeSegmentsForSequence.get(key);
        if (segmentsOfInterval == null ||
            segmentsOfInterval.getAppendingSegment() == null ||
            !segmentsOfInterval.getAppendingSegment().getSegmentIdentifier().equals(identifier)) {
          throw new ISE("WTF?! Asked to remove segment[%s] that didn't exist...", identifier);
        }
        segmentsOfInterval.finishAppendingToCurrentActiveSegment(SegmentWithState::finishAppending);
      }
    }
  }
474144
function(segment, previousSegment, nextSegment) {

            // insert after previous segment and before previous segment's next segment
            segment.previousSegment = previousSegment;
            segment.nextSegment = nextSegment;
            if (previousSegment) previousSegment.nextSegment = segment;
            if (nextSegment) nextSegment.previousSegment = segment;

            var updateSubpathStart = segment;
            if (segment.isSubpathStart) {
                segment.subpathStartSegment = segment; // assign self as subpath start segment
                updateSubpathStart = nextSegment; // start updating from next segment
            }

            // assign previous segment's subpath start (or self if it is a subpath start) to subsequent segments
            if (updateSubpathStart) this.updateSubpathStartSegment(updateSubpathStart);

            return segment;
        }
1291020
private void eventuallyExpand(int _segmentIndex) {
    long[] _stamps = lockAll();
    try {
      long _size = segmentSize[_segmentIndex].get();
      if (_size <= segmentMaxFill) {
        return;
      }
      rehash();
    } finally {
      unlockAll(_stamps);
    }
  }