Package muntjac :: Package data :: Package util :: Package filter :: Module simple_string_filter :: Class SimpleStringFilter
[hide private]
[frames] | no frames]

Class SimpleStringFilter

source code

       object --+    
                |    
container.IFilter --+
                    |
                   SimpleStringFilter

Simple string filter for matching items that start with or contain a specified string. The matching can be case-sensitive or case-insensitive.

This filter also directly supports in-memory filtering. When performing in-memory filtering, values of other types are converted using __str__, but other (lazy container) implementations do not need to perform such conversions and might not support values of different types.

Note that this filter might not be very efficient e.g. for database filtering.

Instance Methods [hide private]
 
__init__(self, propertyId, filterString, ignoreCase, onlyMatchPrefix)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
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
 
__eq__(self, obj) source code
 
__hash__(self)
hash(x)
source code
 
getPropertyId(self)
Returns the property identifier to which this filter applies.
source code
 
getFilterString(self)
Returns the filter string.
source code
 
isIgnoreCase(self)
Returns whether the filter is case-insensitive or case-sensitive.
source code
 
isOnlyMatchPrefix(self)
Returns true if the filter only applies to the beginning of the value string, false for any location in the value.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, propertyId, filterString, ignoreCase, onlyMatchPrefix)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

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
Overrides: container.IFilter.passesFilter
(inherited documentation)

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
Overrides: container.IFilter.appliesToProperty
(inherited documentation)

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: object.__hash__
(inherited documentation)

getPropertyId(self)

source code 

Returns the property identifier to which this filter applies.

Returns:
property id

getFilterString(self)

source code 

Returns the filter string.

Note: this method is intended only for implementations of lazy string filters and may change in the future.

Returns:
filter string given to the constructor

isIgnoreCase(self)

source code 

Returns whether the filter is case-insensitive or case-sensitive.

Note: this method is intended only for implementations of lazy string filters and may change in the future.

Returns:
true if performing case-insensitive filtering, false for case-sensitive

isOnlyMatchPrefix(self)

source code 

Returns true if the filter only applies to the beginning of the value string, false for any location in the value.

Note: this method is intended only for implementations of lazy string filters and may change in the future.

Returns:
true if checking for matches at the beginning of the value only, false if matching any part of value