Class TBooleanArray (unit EzdslBAr)

Inherits from

TPersistent

Constructors


constructor Create(aCapacity : longint);

====================================================================} {===TBooleanArray====================================================


Functions

procedure AndArray(aArray : TBooleanArray);

-make the boolean array use another memory block for its values, of aCapacity bits

--------


destructor Destroy;

-create a new boolean array, aCapacity is the number of boolean values in the array

--------


function FirstFalse : longint;

-iterate through the true booleans (aValue = true) or false ones, forwards or not (aBackwards), calling aAction for each, passing aExtraDatato the action function.

function FirstTrue : longint;

-return the index of the first false boolean

--------


function Iterate(aAction : TBooleanArrayIterator; aValue : boolean; aBackwards : boolean; aExtraData : pointer) : longint;

-XOR a boolean array with this one

--------


function LastFalse : longint;

-return the index of the first true boolean

--------


function LastTrue : longint;

-return the index of the last false boolean

--------


function NextFalse(aFromInx : longint) : longint;

-return the index of the last true boolean

--------


function NextTrue(aFromInx : longint) : longint;

-return the index of the next false boolean from the given boolean

--------


procedure OrArray(aArray : TBooleanArray);

-OR a boolean array with this one

--------


function PrevFalse(aFromInx : longint) : longint;

-return the index of the next true boolean from the given boolean

--------


function PrevTrue(aFromInx : longint) : longint;

-return the index of the previous false boolean from the given boolean

--------


procedure SetAllFalse;

-return the index of the previous true boolean from the given boolean

--------


procedure SetAllTrue;

-set all booleans in array to false

--------


procedure SwitchArrays(aNewArray : PByteArray; aCapacity : longint);

-destroy the boolean array

--------


function Toggle(aInx : longint) : boolean;

-set all booleans in array to true

--------


procedure ToggleAll;

-toggle the given boolean from false to true or vice versa

--------


procedure XorArray(aArray : TBooleanArray);

-AND a boolean array with this one

--------


function baGetFlag(aInx : longint) : boolean;

--------

function baIterateBkwd(aFromInx : longint; aValue : boolean; aAction : TBooleanArrayIterator; aExtraData : pointer) : longint;

--------

function baIterateFwd(aFromInx : longint; aValue : boolean; aAction : TBooleanArrayIterator; aExtraData : pointer) : longint;

--------

procedure baRecount;

--------

procedure baSetCapacity(aCapacity : longint);

--------

procedure baSetFlag(aInx : longint; aValue : boolean);

--------

Properties

property Capacity : longint

-the number of true booleans

property Count : longint

-the array of booleans

property Flag : boolean

-toggle all booleans from false to true or vice versa

Events

Variables

baArray : PByteArray;


baArrayOwner : boolean;


baArraySize : longint;


baCapacity : longint;


baCount : longint;



Constructors


constructor Create(aCapacity : longint);

====================================================================} {===TBooleanArray====================================================


Functions


procedure AndArray(aArray : TBooleanArray);

-make the boolean array use another memory block for its values, of aCapacity bits

--------


destructor Destroy;

-create a new boolean array, aCapacity is the number of boolean values in the array

--------


function FirstFalse : longint;

-iterate through the true booleans (aValue = true) or false ones, forwards or not (aBackwards), calling aAction for each, passing aExtraDatato the action function. Returns either the first boolean index for which the action function returned false, or -1 if none did

--------


function FirstTrue : longint;

-return the index of the first false boolean

--------


function Iterate(aAction : TBooleanArrayIterator; aValue : boolean; aBackwards : boolean; aExtraData : pointer) : longint;

-XOR a boolean array with this one

--------


function LastFalse : longint;

-return the index of the first true boolean

--------


function LastTrue : longint;

-return the index of the last false boolean

--------


function NextFalse(aFromInx : longint) : longint;

-return the index of the last true boolean

--------


function NextTrue(aFromInx : longint) : longint;

-return the index of the next false boolean from the given boolean

--------


procedure OrArray(aArray : TBooleanArray);

-OR a boolean array with this one

--------


function PrevFalse(aFromInx : longint) : longint;

-return the index of the next true boolean from the given boolean

--------


function PrevTrue(aFromInx : longint) : longint;

-return the index of the previous false boolean from the given boolean

--------


procedure SetAllFalse;

-return the index of the previous true boolean from the given boolean

--------


procedure SetAllTrue;

-set all booleans in array to false

--------


procedure SwitchArrays(aNewArray : PByteArray; aCapacity : longint);

-destroy the boolean array

--------


function Toggle(aInx : longint) : boolean;

-set all booleans in array to true

--------


procedure ToggleAll;

-toggle the given boolean from false to true or vice versa

--------


procedure XorArray(aArray : TBooleanArray);

-AND a boolean array with this one

--------


function baGetFlag(aInx : longint) : boolean;

--------


function baIterateBkwd(aFromInx : longint; aValue : boolean; aAction : TBooleanArrayIterator; aExtraData : pointer) : longint;

--------


function baIterateFwd(aFromInx : longint; aValue : boolean; aAction : TBooleanArrayIterator; aExtraData : pointer) : longint;

--------


procedure baRecount;

--------


procedure baSetCapacity(aCapacity : longint);

--------


procedure baSetFlag(aInx : longint; aValue : boolean);

--------


Properties


property Capacity : longint

-the number of true booleans


property Count : longint

-the array of booleans


property Flag : boolean

-toggle all booleans from false to true or vice versa


Events


Variables


baArray : PByteArray;


baArrayOwner : boolean;


baArraySize : longint;


baCapacity : longint;


baCount : longint;