Class Bitmap
Bitmap
A memory efficient Attribute implementation using a bitmask stored in a string.
-
apemsel\AttributedString\Bitmap
implements
apemsel\AttributedString\Attribute
Methods summary
public
|
|
public
string
|
#
__toString( )
Returns the bitmask as a visual string
Returns the bitmask as a visual string
Returns
string bitmask as visual string of 0s and 1s
|
public
string
|
#
toString( string $true = "1", string $false = "0" )
Returns the bitmask as a visual string with custom chars for 0s and 1s
Returns the bitmask as a visual string with custom chars for 0s and 1s
Parameters
- $true
- representation of 1s
- $false
- $true representation of 0s
Returns
string bitmask as visual string of the given representations
Implementation of
|
public
|
#
setRange( integer $from, integer $to, boolean $state = true )
Set given range to a state
Set given range to a state
Parameters
- $from
- start offset
- $to
- end offset
- $state
- set state to true (default) or false
Implementation of
|
public
integer|int[]
|
#
search( integer $offset = 0, boolean $returnLength = false, boolean $state = true, boolean $strict = true )
Search inside bitmap for ranges with the given state
Search inside bitmap for ranges with the given state
Parameters
- $offset
- start offset
- $returnLength
- if true (default is false), return an array with position and length of the found range
- $state
- the state to look for (default is true)
- $strict
- perform strict comparison during search
Returns
integer|int[] either position or position and lenght in an array
Implementation of
|
public
boolean
|
#
offsetExists( integer $offset )
Check if the given offset exists in the bitmap
Check if the given offset exists in the bitmap
Parameters
Returns
boolean does the offset exist
|
public
boolean
|
#
offsetGet( integer $offset )
Get bit at given offset
Parameters
Returns
boolean bit at given offset
|
public
|
#
offsetSet( integer $offset, boolean $value )
Set bit at given offset
Parameters
- $offset
- offset
- $value
- bit at given offset
|
public
|
#
offsetUnset( $offset )
Unset bit at given offset - not implemented
Unset bit at given offset - not implemented
Throws
RuntimeException always
|
public
integer
|
#
count( )
Return bitmap length
Returns
integer bitmap length
|