Class VectorBuilder<T extends ACell>

java.lang.Object
convex.core.data.VectorBuilder<T>
Type Parameters:
T - Type of Vector elements

public class VectorBuilder<T extends ACell> extends Object
Similar to Java StringBuilder designed for concatenating multiple small Vectors to produce a larger Vector.
  • Field Details

    • acc

      protected AVector<T extends ACell> acc
      Accumulator Vector, always a canonical Vector with filled chunks
    • tail

      protected final ACell[] tail
      Accumulator array for up to a single chunk worth of cells
    • count

      protected long count
      Total count of elements in this VectorBuilder
  • Constructor Details

    • VectorBuilder

      public VectorBuilder()
    • VectorBuilder

      public VectorBuilder(ASequence<T> seq)
  • Method Details

    • append

      public VectorBuilder<T> append(T a)
    • concat

      public VectorBuilder<T> concat(ASequence<T> b)
    • conj

      public VectorBuilder<T> conj(T b)
    • toVector

      public AVector<T> toVector()
    • count

      public long count()
    • check

      public boolean check(long limit)
      Checks if this VectorBuilder count is less than or equal to the specified limit
      Parameters:
      limit - Maximum allowable length of VectorBuilder
      Returns:
      true if within limit, false if exceeded
    • clear

      public void clear()
      Clears this VectorBuilder, preparing for new appends to an empty Blob