Overview
  • Namespace
  • Class

Namespaces

  • apemsel
    • AttributedString

Classes

  • AttributedString
  • Bitmap
  • BooleanArray
  • MutableAttributedString
  • TokenizedAttributedString

Interfaces

  • Attribute
  • MutableAttribute

Class BooleanArray

BooleanArray

A time efficient Attribute implementation using a standard PHP array of booleans

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

Methods summary

public
# __construct( integer $length )

Parameters

$length
of array
public string
# __toString( )

Returns the array as a visual string

Returns the array as a visual string

Returns

string
array as visual string of 0s and 1s
public string
# toString( string $true = "1", string $false = "0" )

Returns the array as a visual string with custom chars for 0s and 1s

Returns the array as a visual string with custom chars for 0s and 1s

Parameters

$true
representation of 1s
$false
$true representation of 0s

Returns

string
array 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
# insert( integer $offset, integer $length, boolean $state )

Insert a piece into the array at given offset with a given state and length

Insert a piece into the array at given offset with a given state and length

Parameters

$offset
offset
$length
length of inserted piece
$state
state of inserted piece

Implementation of

apemsel\AttributedString\MutableAttribute::insert()
public
# delete( integer $offset, integer $length )

Delete a piece of the array at given offset with a given length

Delete a piece of the array at given offset with a given length

Parameters

$offset
offset
$length
length of inserted piece

Implementation of

apemsel\AttributedString\MutableAttribute::delete()
public boolean
# offsetExists( integer $offset )

Check if the given offset exists in the array

Check if the given offset exists in the array

Parameters

$offset
offset

Returns

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

Get bool at given offset

Get bool at given offset

Parameters

$offset
offset

Returns

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

Set bool at given offset

Set bool at given offset

Parameters

$offset
offset
$value
bit at given offset
public
# offsetUnset( integer $offset )

Unset bit at given offset

Unset bit at given offset

Parameters

$offset
offset
public integer
# count( )

Return array length

Return array length

Returns

integer
array length

Properties summary

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