Checks points and types buffer size to add pointCount points. If necessary realloc buffers
to enlarge size.

@param pointCount the point count to be added in buffer
351346
protected void checkBuf (int pointCount, boolean checkMove) {
        if (checkMove && typeSize == 0) {
            throw new IllegalPathStateException("First segment must be a SEG_MOVETO");
        }
        if (typeSize == types.length) {
            byte[] tmp = new byte[typeSize + BUFFER_CAPACITY];
            System.arraycopy(types, 0, tmp, 0, typeSize);
            types = tmp;
        }
        if (pointSize + pointCount > points.length) {
            float[] tmp = new float[pointSize + Math.max(BUFFER_CAPACITY * 2, pointCount)];
            System.arraycopy(points, 0, tmp, 0, pointSize);
            points = tmp;
        }
    }
1250014
public void add(Counter<? extends G> c) {
        for (Map.Entry<? extends G,Integer> e : c) {
            count(e.getKey(), e.getValue());
        }
    }
1009317
void _resizeImpl(int pointCount) {
		if (pointCount < 0)
			throw new IllegalArgumentException();

		if (pointCount == m_pointCount)
			return;

		m_pointCount = pointCount;
		notifyModified(DirtyFlags.DirtyAllInternal);
	}
386675
public static int byteCount(Slice slice, int offset, int length, int codePointCount)
    {
        requireNonNull(slice, "slice is null");
        if (length < 0) {
            throw new IllegalArgumentException("length must be greater than or equal to zero");
        }
        if (offset < 0 || offset + length > slice.length()) {
            throw new IllegalArgumentException("invalid offset/length");
        }
        if (codePointCount < 0) {
            throw new IllegalArgumentException("codePointsCount must be greater than or equal to zero");
        }
        if (codePointCount == 0) {
            return 0;
        }

        // min codepoint size is 1 byte.
        // if size in bytes is less than the max length
        // we don't need to decode codepoints
        if (codePointCount > length) {
            return length;
        }

        // get the end index with respect to code point count
        int endIndex = offsetOfCodePoint(slice, offset, codePointCount);
        if (endIndex < 0) {
            // end index runs over the slice's length
            return length;
        }
        if (offset > endIndex) {
            throw new AssertionError("offset cannot be smaller than or equal to endIndex");
        }

        // end index could run over length because of large code points (e.g., 4-byte code points)
        // or within length because of small code points (e.g., 1-byte code points)
        return min(endIndex - offset, length);
    }
38774
public static int countCodePoint(StringBuffer source) {
        if (source == null || source.length() == 0) {
            return 0;
        }
        return findCodePointOffset(source, source.length());
    }
312423
public void add(final ExpressionDataPoint dps) {
    metric_uids.addAll(dps.metric_uids);
    
    // TODO - tags intersection
    
    aggregated_tags.addAll(dps.aggregated_tags);
    
    tsuids.addAll(dps.tsuids);
    // TODO - this ain't right. We need to number of dps emitted from HERE. For
    // now we'll just take the first dps size. If it's downsampled then this
    // will be accurate.
    //size += dps.size();
    raw_size += dps.raw_size;
  }
247103
static void checkBounds(
      final int offset,
      final int otherLength,
      final int otherOffset,
      final int count,
      final int memorySize) {
    Preconditions.checkArgument(count >= 0);
    Preconditions.checkArgument(offset >= 0);
    Preconditions.checkArgument(otherOffset >= 0);
    Preconditions.checkArgument(offset + count <= memorySize);
    Preconditions.checkArgument(otherOffset + count <= otherLength);
  }
790957
public void add(Counter<? extends T> counter) {
        for (Map.Entry<? extends T,Integer> e : counter) {
            T t = e.getKey();
            Integer cur = counts.get(t);
            counts.put(t, (cur == null) ? e.getValue() : cur + e.getValue());
        }
    }
1245670
public void setLine(int... points) {
        double[] pd = new double[points.length];
        for (int i = 0; i < points.length; i++) {
            pd[i] = points[i];
        }
        setLine(pd);
    }
180413
@JsonIgnore
    public void setPoints(int[] points) {
        this.points = new ArrayList<>();
        for (int i = 0; i < points.length; i++) {
            this.points.add(points[i]);
        }
    }
313744
public void addPoint(PolygonPoint p )    
    {
        p.setPrevious( _last );
        p.setNext( _last.getNext() );
        _last.setNext( p );
        _points.add( p );
    }
771196
private Point makePointValid(Point point) {
        CoordinateSequence sequence = point.getCoordinateSequence();
        GeometryFactory factory = point.getFactory();
        CoordinateSequenceFactory csFactory = factory.getCoordinateSequenceFactory();
        if (sequence.size() == 0) {
            return point;
        } else if (Double.isNaN(sequence.getOrdinate(0, 0)) || Double.isNaN(sequence.getOrdinate(0, 1))) {
            return factory.createPoint(csFactory.create(0, sequence.getDimension()));
        } else if (sequence.size() == 1) {
            return point;
        } else {
            throw new RuntimeException("JTS cannot create a point from a CoordinateSequence containing several points");
        }
    }
813451
public static int countCodePoints(Slice utf8, int offset, int length)
    {
        checkPositionIndexes(offset, offset + length, utf8.length());

        // Quick exit if empty string
        if (length == 0) {
            return 0;
        }

        int continuationBytesCount = 0;
        // Length rounded to 8 bytes
        int length8 = length & 0x7FFF_FFF8;
        for (; offset < length8; offset += 8) {
            // Count bytes which are NOT the start of a code point
            continuationBytesCount += countContinuationBytes(utf8.getLongUnchecked(offset));
        }
        // Enough bytes left for 32 bits?
        if (offset + 4 < length) {
            // Count bytes which are NOT the start of a code point
            continuationBytesCount += countContinuationBytes(utf8.getIntUnchecked(offset));

            offset += 4;
        }
        // Do the rest one by one
        for (; offset < length; offset++) {
            // Count bytes which are NOT the start of a code point
            continuationBytesCount += countContinuationBytes(utf8.getByteUnchecked(offset));
        }

        verify(continuationBytesCount <= length);
        return length - continuationBytesCount;
    }
988553
function () {
    var len = this.points.length
    
    // Check the length of the point buffer
    if (len >= options.batchSize) {  
      // Write the points and log error if any
      client.writePoints(this.points).catch(function (error) {
        console.log(error.message)
      })
      
      // Reset point buffer
      this.points = []
    }
  }
1115953
public Series<D> addPoint(final D point) {
		if (this.data == null) {
			this.data = new ArrayList<D>();
		}
		this.data.add(point);
		return this;
	}
1080238
public void prunePoints(int count ) {
		// Remove all observations of the Points which are going to be removed
		for (int viewIndex = observations.views.length-1; viewIndex >= 0; viewIndex--) {
			SceneObservations.View v = observations.views[viewIndex];

			for(int pointIndex = v.point.size-1; pointIndex >= 0; pointIndex-- ) {
				SceneStructureMetric.Point p = structure.points[v.getPointId(pointIndex)];

				if( p.views.size < count ) {
					v.remove(pointIndex);
				}
			}
		}

		// Create a look up table containing from old to new indexes for each point
		int oldToNew[] = new int[ structure.points.length ];
		Arrays.fill(oldToNew,-1); // crash is bug

		GrowQueue_I32 prune = new GrowQueue_I32(); // List of point ID's which are to be removed.
		for (int i = 0; i < structure.points.length; i++) {
			if( structure.points[i].views.size < count ) {
				prune.add(i);
			} else {
				oldToNew[i] = i-prune.size;
			}

		}
		pruneUpdatePointID(oldToNew, prune);
	}
253961
public void addAll(IntCounter<E> counter) {
    for (E key : counter.keySet()) {
      int count = counter.getIntCount(key);
      incrementCount(key, count);
    }
  }