Overview
  • Namespace
  • Class

Namespaces

  • apemsel
    • AttributedString

Classes

  • AttributedString
  • Bitmap
  • BooleanArray
  • MutableAttributedString
  • TokenizedAttributedString

Interfaces

  • Attribute
  • MutableAttribute

Class Bitmap

Bitmap

A memory efficient Attribute implementation using a bitmask stored in a string.

apemsel\AttributedString\Bitmap implements apemsel\AttributedString\Attribute
Namespace: apemsel\AttributedString
Author: Adrian Pemsel apemsel@gmail.com
Located at Bitmap.php

Methods summary

public
# __construct( integer $length )

Parameters

$length
of bitmask
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

apemsel\AttributedString\Attribute::toString()
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

apemsel\AttributedString\Attribute::setRange()
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

apemsel\AttributedString\Attribute::search()
public boolean
# offsetExists( integer $offset )

Check if the given offset exists in the bitmap

Check if the given offset exists in the bitmap

Parameters

$offset
offset

Returns

boolean
does the offset exist
public boolean
# offsetGet( integer $offset )

Get bit at given offset

Get bit at given offset

Parameters

$offset
offset

Returns

boolean
bit at given offset
public
# offsetSet( integer $offset, boolean $value )

Set bit at given offset

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

Return bitmap length

Returns

integer
bitmap length

Properties summary

protected $bitmap
#
protected $length
#
API documentation generated by ApiGen