Package muntjac :: Package data :: Module container :: Class IFilter
[hide private]
[frames] | no frames]

Class IFilter

source code

object --+
         |
        IFilter
Known Subclasses:

IFilter interface for container filtering.

If a filter does not support in-memory filtering, passesFilter should throw NotImplementedError.

Lazy containers must be able to map filters to their internal representation.

An UnsupportedFilterException can be thrown by the container if a particular filter is not supported by the container.

An IFilter should implement __eq__ and __hash__ correctly to avoid duplicate filter registrations etc.


See Also: IFilterable

Instance Methods [hide private]
 
passesFilter(self, itemId, item)
Check if an item passes the filter (in-memory filtering).
source code
 
appliesToProperty(self, propertyId)
Check if a change in the value of a property can affect the filtering result.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

passesFilter(self, itemId, item)

source code 

Check if an item passes the filter (in-memory filtering).

Parameters:
  • itemId - identifier of the item being filtered; may be null when the item is being added to the container
  • item - the item being filtered
Returns:
true if the item is accepted by this filter
Raises:
  • NotImplementedError - if the filter cannot be used for in-memory filtering

appliesToProperty(self, propertyId)

source code 

Check if a change in the value of a property can affect the filtering result. May always return true, at the cost of performance.

If the filter cannot determine whether it may depend on the property or not, should return true.

Returns:
true if the filtering result may/does change based on changes to the property identified by propertyId