BitVector Overview

An Bit Vector (BitVector) is a Heap object containing zero or more one bit data items (i.e. 0 1). BitVectors allow access to stored bit values using an integer key. Assuming there are n elements in a vector, the elements of the vector are accessed as elements 0 thru n-1. An BitVector also has a tail in the same sense that a Pair has a tail.

This sets a BitVector of all 1's.

(setq X (new Vector: bit: 5 1))

The BitVector is a dynamic data type: it can grow to containing new elements or contract as elements are deleted. An element is accessed by an index from 0 to n-1 where n is the number of elements in the BitVector. When an element is added, it is appended to the end. The elements of the BitVector may also be sorted or deleted by specifying the index of the element.

When to Use

The BitVector is a subtype of the Vector Data Type. The BitVector object is useful for storing bits. The BitVector object is very fast and has minimum memory overhead due to the indexed access of its values. If you require a random access strategy or a keyed access strategy see the Dictionary or Structure data types.

Visual Basic Comparison

An Analytic Information Server NumVector is similar to the single dimensioned dynamic array in Visual Basic. The Visual Basic array is created at compile time (the Visual Basic Array still requires a "ReDim" to specify a dimension), whereas the Analytic Information Server structure is created, expanded, or contracted dynamically at run time.

Dim DayArray(50)

DayArray is an array of Variants with 51 elements indexed, from 0 thru 50.

Constant Form

The BitVector native data type has a constant form. A BitVector constant is enclosed in brackets and preceded by the sharp symbol #(bit| ).

For Example:

#(bit| 1 1 1 1 1 )

Object Data Types

The BitVector is a Heap Object or an Object Data Type. The Analytic Information Server Object Types are stored in the Heap and are managed by the Heap manager. The Analytic Information Server Heap manager supports object resizing, garbage collection, and anti-fragmentation algorithms so that the user may concentrate on the analysis and modeling of data rather than on memory management. Without exception, all of the Object types are identified by an object id. The object id identifies a block of memory, managed by the Lambda Information Server memory manager, in which the Object's data is stored.

The Analytic Information Server Heap Object and Native Data types can be saved and loaded to and from persistent (disk file) storage at any time. Containers with immediate data are saved on disk in fixed length records equal to the size of the container. Containers with Heap object references are saved in fixed length records, which are automatically expanded to include the contents of the Heap object, and any objects referenced by the Heap object, etc. This feature is called Object Closure Management and is automatic with every Analytic Information Server container database save.

Analytic Information Server containers may be loaded from any database repository record at any time. If the data in the record is immediate, the database load fills the container with the immediate data. If the data in the record is an object closure, the database load fills the container with a Heap object reference, and all of the objects in the record are loaded back into the Heap with the same referential relationships they had when they were saved in the repository.


Data Type Functions

The BitVector object can be demonstrated by the following functions.

addMethod append apply bitToIntegerVector
bitToNumberVector cdr compareEQ compareGE
compareGT compareLE compareLT compareNE
compare comparison copy defmethod
findBlock freeBlock inside isAtom
isBitVector isEqual isIdentical isInside
isMember isObject isType length
member methodsOf new ref
remove resize reverse send
setBlock setCdr setLastCdr setq
sizeof sort type vectorFill


Data Type Examples

The BitVector object can be demonstrated by the following examples.

Example_BitVector_addMethod_023 Example_BitVector_append_010 Example_BitVector_apply_008 Example_BitVector_bitToIntegerVector_001
Example_BitVector_bitToIntegerVector_002 Example_BitVector_bitToNumberVector_001 Example_BitVector_cdr_010 Example_BitVector_compareEQ_014
Example_BitVector_compareGE_014 Example_BitVector_compareGT_014 Example_BitVector_compareLE_014 Example_BitVector_compareLT_014
Example_BitVector_compareNE_014 Example_BitVector_compare_018 Example_BitVector_comparison_014 Example_BitVector_copy_011
Example_BitVector_defmethod_020 Example_BitVector_findBlock_001 Example_BitVector_freeBlock_001 Example_BitVector_inside_007
Example_BitVector_isAtom_010 Example_BitVector_isBitVector_001 Example_BitVector_isEqual_017 Example_BitVector_isIdentical_017
Example_BitVector_isInside_008 Example_BitVector_isMember_008 Example_BitVector_isObject_012 Example_BitVector_isType_020
Example_BitVector_length_013 Example_BitVector_member_008 Example_BitVector_methodsOf_021 Example_BitVector_new_013
Example_BitVector_ref_027 Example_BitVector_remove_008 Example_BitVector_resize_010 Example_BitVector_reverse_007
Example_BitVector_send_018 Example_BitVector_setBlock_001 Example_BitVector_setCdr_010 Example_BitVector_setLastCdr_010
Example_BitVector_setq_024 Example_BitVector_sizeof_019 Example_BitVector_sort_017 Example_BitVector_type_021