KWeb  6.4
Collection_Filtered Class Reference

Data filtered by custom callbacks. More...

Inheritance diagram for Collection_Filtered:
Collection_Outer Collection KWebSearch_Result

Public Member Functions

 __construct (Collection $collection, array $filters, array $options=array())
 getDataPositions ()
 Returns data positions.
 count ()
 getFailedCount ()
 filterData ($limit, $start=false)
 Filters the data.
 current ()
 next ()
 Moves to the next position.
 currentPosition ()
 Returns current position in the set.
 currentSeekablePosition ()
 Returns position that can be seeked to on re-query, to get to the same result.
 valid ()
 Returns item at current position, staying at the current position.
 seek ($pos)
 prefetch ($limit=false, $start=false)
 Items will be prefetched (if needed) in a batch for later retrieval.
 isBidirectional ()
 Returns true if data can be traversed in both directions.
 sync ()
 Synchronizes inner and outer collections.

Data Fields

 $filteredCount = false
 Enables filtering when counting results.
 $filteredSeek = false
 Enables filtering when seeking to new positions.
 $maxFailedMatches = false
 Maximum number of failed matches, after which to stop searching.
 $prefetchOverhead = 1.1
 How much more items should be prefetched?
 $filters
 List of filters to match.

Protected Member Functions

 checkAutoPrefetch ()

Protected Attributes

 $position = 0
 $positions = array()
 $cache = array()
 $lastPosition = null
 Last position if the last item was retrieved from data.
 $count = null
 $failedCount = 0
 $seekedDataPosition = null

Detailed Description

Data filtered by custom callbacks.

supports OPT_PREFETCH_AUTO and OPT_RELEASE_AUTO


Constructor & Destructor Documentation

Collection_Filtered::__construct ( Collection collection,
array $  filters,
array $  options = array() 
)

Member Function Documentation

Collection_Filtered::checkAutoPrefetch ( ) [protected]
Collection_Filtered::count ( )

Reimplemented from Collection_Outer.

Collection_Filtered::current ( )

Reimplemented from Collection_Outer.

Collection_Filtered::currentPosition ( )

Returns current position in the set.

Reimplemented from Collection_Outer.

Collection_Filtered::currentSeekablePosition ( )

Returns position that can be seeked to on re-query, to get to the same result.

If collection doesn't use filteredSeek, this position will allow to restart collection from the same point without filtering data again.

Returns:
int
Collection_Filtered::filterData ( limit,
start = false 
)

Filters the data.

This function ensures, that at least $limit items are filtered (counting only matched items) and stored in the cache.

Parameters:
$startPosition to start from (filtered position)
Returns:
int Number of matched items
Collection_Filtered::getDataPositions ( )

Returns data positions.

Returns:
array
Collection_Filtered::getFailedCount ( )
Collection_Filtered::isBidirectional ( )

Returns true if data can be traversed in both directions.

Returns:
boolean

Reimplemented from Collection_Outer.

Collection_Filtered::next ( )

Moves to the next position.

Reimplemented from Collection_Outer.

Collection_Filtered::prefetch ( limit = false,
start = false 
)

Items will be prefetched (if needed) in a batch for later retrieval.

Parameters:
Numberof items to prefetch or false
Startof the prefetch or false for current position
Returns:
boolean TRUE if prefetch was successfull, FALSE if prefetch can't be supported

Reimplemented from Collection_Outer.

Collection_Filtered::seek ( pos)

Reimplemented from Collection_Outer.

Collection_Filtered::sync ( )

Synchronizes inner and outer collections.

Reimplemented from Collection_Outer.

Collection_Filtered::valid ( )

Returns item at current position, staying at the current position.

Returns true if there is data at current possition

Returns:
boolean

Reimplemented from Collection_Outer.


Field Documentation

Collection_Filtered::$cache = array() [protected]
Collection_Filtered::$count = null [protected]
Collection_Filtered::$failedCount = 0 [protected]
Collection_Filtered::$filteredCount = false

Enables filtering when counting results.

May be very resource intensive!

Collection_Filtered::$filteredSeek = false

Enables filtering when seeking to new positions.

May be very resource intensive!

Collection_Filtered::$filters

List of filters to match.

All filters must be valid, to accept the item

Collection_Filtered::$lastPosition = null [protected]

Last position if the last item was retrieved from data.

It doesn't mean that everything was filtered!

Collection_Filtered::$maxFailedMatches = false

Maximum number of failed matches, after which to stop searching.

Collection_Filtered::$position = 0 [protected]
Collection_Filtered::$positions = array() [protected]
Collection_Filtered::$prefetchOverhead = 1.1

How much more items should be prefetched?

Collection_Filtered::$seekedDataPosition = null [protected]

The documentation for this class was generated from the following file: