Skip to content

Class: MockFlags32 ​

Mock of the X-Ray engine flags32 bit-flags object.

Implements ​

  • flags32

Constructors ​

Constructor ​

ts
new MockFlags32(): MockFlags32;

Returns ​

MockFlags32

Methods ​

and() ​

Call Signature ​

ts
and(source: flags32, mask: number): MockFlags32;

Replace this mask with source & mask.

Parameters ​
ParameterTypeDescription
sourceflags32Source mask.
masknumberBits to keep.
Returns ​

MockFlags32

This mask.

Implementation of ​
ts
flags32.and

Call Signature ​

ts
and(mask: number): MockFlags32;

Apply bitwise AND to this mask.

Parameters ​
ParameterTypeDescription
masknumberBits to keep.
Returns ​

MockFlags32

This mask.

Implementation of ​
ts
flags32.and

assign() ​

ts
assign(value: number | flags32): MockFlags32;

Copy another flag mask.

Parameters ​

ParameterTypeDescription
valuenumber | flags32Source mask.

Returns ​

MockFlags32

This mask.

Implementation of ​

ts
flags32.assign

equal() ​

ts
equal(value: Readonly<flags32>, mask?: number): boolean;

Compare this mask with another mask.

Parameters ​

ParameterTypeDescription
valueReadonly<flags32>Mask to compare.
mask?number-

Returns ​

boolean

Whether masks are equal.

Implementation of ​

ts
flags32.equal

get() ​

ts
get(): number;

Get raw mask value.

Returns ​

number

Raw mask value.

Implementation of ​

ts
flags32.get

invert() ​

ts
invert(value?: number | flags32): MockFlags32;

Invert all bits in this mask.

Parameters ​

ParameterType
value?number | flags32

Returns ​

MockFlags32

This mask.

Implementation of ​

ts
flags32.invert

is() ​

Call Signature ​

ts
is(value: flags32, mask: number): boolean;

Check whether all selected bits are set in a source mask.

Parameters ​
ParameterTypeDescription
valueflags32Source mask.
masknumberBits to test.
Returns ​

boolean

Whether all bits are set.

Remarks ​

This is stricter than is_any() and test(): every bit from mask must be present.

Implementation of ​
ts
flags32.is

Call Signature ​

ts
is(mask: number): boolean;

Check whether all selected bits are set in this mask.

Parameters ​
ParameterTypeDescription
masknumberBits to test.
Returns ​

boolean

Whether all bits are set.

Remarks ​

This is stricter than is_any() and test(): every bit from mask must be present.

Implementation of ​
ts
flags32.is

is_any() ​

Call Signature ​

ts
is_any(value: flags32, mask: number): boolean;

Check whether any selected bit is set in a source mask.

Parameters ​
ParameterTypeDescription
valueflags32Source mask.
masknumberBits to test.
Returns ​

boolean

Whether any bit is set.

Remarks ​

Use this for overlap checks. For an all-bits check, use is().

Implementation of ​
ts
flags32.is_any

Call Signature ​

ts
is_any(mask: number): boolean;

Check whether any selected bit is set in this mask.

Parameters ​
ParameterTypeDescription
masknumberBits to test.
Returns ​

boolean

Whether any bit is set.

Remarks ​

Use this for overlap checks. For an all-bits check, use is().

Implementation of ​
ts
flags32.is_any

one() ​

ts
one(): MockFlags32;

Set all bits.

Returns ​

MockFlags32

This mask.

Remarks ​

Sets all 32 bits to 1.

Implementation of ​

ts
flags32.one

or() ​

Call Signature ​

ts
or(source: flags32, mask: number): MockFlags32;

Replace this mask with source | mask.

Parameters ​
ParameterTypeDescription
sourceflags32Source mask.
masknumberBits to set.
Returns ​

MockFlags32

This mask.

Implementation of ​
ts
flags32.or

Call Signature ​

ts
or(mask: number): MockFlags32;

Apply bitwise OR to this mask.

Parameters ​
ParameterTypeDescription
masknumberBits to set.
Returns ​

MockFlags32

This mask.

Implementation of ​
ts
flags32.or

set() ​

ts
set(mask: number, enabled: boolean): MockFlags32;

Set or clear selected bits.

Parameters ​

ParameterTypeDescription
masknumberBits to update.
enabledbooleanWhether bits should be set.

Returns ​

MockFlags32

This mask.

Implementation of ​

ts
flags32.set

test() ​

ts
test(mask: number): boolean;

Test whether any selected bit is set.

Parameters ​

ParameterTypeDescription
masknumberBits to test.

Returns ​

boolean

Whether any selected bit is set.

Remarks ​

Equivalent to is_any(mask).

Implementation of ​

ts
flags32.test

zero() ​

ts
zero(): MockFlags32;

Clear all bits.

Returns ​

MockFlags32

This mask.

Implementation of ​

ts
flags32.zero

create() ​

ts
static create(value?: number): MockFlags32;

Parameters ​

ParameterTypeDefault value
valuenumber0

Returns ​

MockFlags32


mock() ​

ts
static mock(value?: number): flags32;

Parameters ​

ParameterTypeDefault value
valuenumber0

Returns ​

flags32