Package convex.core.data
Class Vectors
java.lang.Object
convex.core.data.Vectors
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static int
protected static int
protected static int
static int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a vector from an array of elements.Creates a canonical AVector with the given elementscreate(Collection<?> elements)
Coerces a collection to a vector.empty()
Creates a vector with the given values.read(ByteBuffer bb)
Reads a Vector for the specified bytebuffer.repeat(T m, int count)
-
Field Details
-
BITS_PER_LEVEL
protected static final int BITS_PER_LEVEL- See Also:
- Constant Field Values
-
CHUNK_SIZE
protected static final int CHUNK_SIZE- See Also:
- Constant Field Values
-
BITMASK
protected static final int BITMASK- See Also:
- Constant Field Values
-
MAX_ENCODING_LENGTH
public static final int MAX_ENCODING_LENGTH
-
-
Constructor Details
-
Vectors
public Vectors()
-
-
Method Details
-
create
Creates a canonical AVector with the given elements- Parameters:
elements
- Elements to includeoffset
- Offset into element arraylength
- Number of elements to take- Returns:
- New vector with the specified elements
-
create
Create a vector from an array of elements.- Type Parameters:
T
- Type of elements- Parameters:
elements
- Elements to include- Returns:
- New vector with the specified elements
-
create
Coerces a collection to a vector. Not necessarily the most efficient. Performs an unchecked cast.- Type Parameters:
R
- Type of Vector elements to produceT
- Type of source collection elements- Parameters:
elements
- Elements to include- Returns:
- New vector with the specified collection of elements
-
create
-
empty
-
of
Creates a vector with the given values. Performs conversion to CVM types.- Type Parameters:
T
- Type of elements (after CVM conversion)- Parameters:
elements
- Elements to include- Returns:
- New Vector
-
repeat
-
read
Reads a Vector for the specified bytebuffer. Assumes Tag byte already consumed. Distinguishes between child types according to count.- Type Parameters:
T
- Type of elements- Parameters:
bb
- ByteBuffer to read from- Returns:
- Vector read from ByteBuffer
- Throws:
BadFormatException
- If encoding is invalid
-