BitArrays

Quick Links

Overview

The Lisp bit array type is a specialized array that holds only elements of type Bit. Bit arrays support all functions of the LispArray type. The backing store for bit arrays is a Java BigInteger(see BitArrayBackingStore).

References

HyperSpec CLtL
Type BIT bit-arrays

Implementation

The BitArray type will be implemented as an interface that extends the LispArray interface in lisp.common.type. The main implementation difference between the LispArray and BitArray is that the backing stores are different. It will be determined that an array is of type BitArray if the array's element type is of type Bit or the element type is a list that looks like: (INTEGER 0 1), the actual definition of a Bit. This will be handled in the LispArray factory class.

Core Java Classes Javadoc Links
BitArray -
BitArrayImpl -
BitAnd -
BitAndC1 -
BitAndC2 -
BitEqv -
BitIor -
BitNand -
BitNor -
BitNot -
BitOrC1 -
BitOrC2 -
BitXor -

How Bit Arrays Are Created

The bit array type will have an inner Factory class that creates instances of bit arrays via a newInstance method. The different types of constructors used to make a bit array are based on the values of the following optional arguments that can be passed to an array during creation:

int [] dimensions - A list of valid array dimensions.

boolean adjustable - Tells you where the array size will be fixed or will have the ability to change size.

Bit initial element - An initial value that all array positions should be set to.

T [] initialContents - The explicit values that should be in the array.

Notes: if adjustable is false the array must be of type simpleBitArray.

if dimensions.length == 1 the array must be of type Vector.

if dimensions == null a zero-dimensional bit array is created.

The following newInstance methods are used to create bit arrays:

public static BitArray newInstance()

This default constructor is used to create zero-dimensional bit arrays(arrays which have only one element) where the element value is not specified.

public static BitArray newInstance(int [] dimensions, Bit initialElement)

Creates a bit array with the given dimensions and initializes every element of the bit array to initialElement.

public static BitArray newInstance(Bit initialElement)

Creates a zero-dimensional bit array with the element set to the value of initalElement.

public static BitArray newInstance(T [] initialContents)

Creates a zero-dimensional bit array and sets the element to the value of initialContents[0].

public static BitArray newInstance(int [] dimensions, T [] initialContents)

Creates a bit array of the given dimensions and sets the elements of the bit array to the values of the elements of initialContents.

Functions

In addition to the LispArray functions, the Lisp bit array supports the following functions:

Name Operation Java Implementation Status
bit-and and BitAnd (BitArray array1, BitArray array2) Not Complete
bit-andc1 and complement of bit-array1 with bit-array2 BitAndC1 (BitArray array1, BitArray array2) Not Complete
bit-andc2 and bit-array1 with complement of bit-array2 BitAndC2 (BitArray array1, BitArray array2) Not Complete
bit-eqv equivalence (exclusive nor) BitEqv (BitArray array1, BitArray array2) Not Complete
bit-ior inclusive or BitIor (BitArray array1, BitArray array2) Not Complete
bit-nand complement of bit-array1 or bit-array2 BitNand (BitArray array1, BitArray array2) Not Complete
bit-nor complement of bit-array1 or bit-array2 BitNor (BitArray array1, BitArray array2) Not Complete
bit-not complement BitNot (BitArray array1, BitArray array2) Not Complete
bit-orc1 or complement of bit-array1 with bit-array2 BitOrC1 (BitArray array1, BitArray array2) Not Complete
bit-orc2 or bit-array1 with complement of bit-array2 BitOrC2 (BitArray array1, BitArray array2) Not Complete
bit-xor exclusive or BitXor (BitArray array1, BitArray array2) Not Complete

Current Status of BitArrays

Status: Developing

Release Level:

Open bug count:

Test Suites

Links to JUnit results

-- Main.JerryBoetje - 12 Jul 2003

Topic revision: r10 - 2009-02-11 - 16:15:47 - MeganLusher
 
Home
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback