Package | twaver |
Class | public class QuickFinder |
Inheritance | QuickFinder ![]() |
This quick finder can be defined in front of adding data into the data box. You can create quick finder by given property name and connect the quick finder with a data box. Later, every time when data of this data box is changed, this quick finder will catch up with this change, indexing all matched data and caches result inside. So quick finder always can execute the query and return the result very quickly.
See also
Property | Defined By | ||
---|---|---|---|
dataBox : DataBox [read-only]
Get the data box this quick finder connected. | QuickFinder | ||
filterFunction : Function [read-only]
Get search filter function. | QuickFinder | ||
propertyName : String [read-only]
The property name query condition of this finder. | QuickFinder | ||
propertyType : String [read-only]
Get the property type query condition. | QuickFinder | ||
valueFunction : Function [read-only]
Get the value generator function. | QuickFinder |
Method | Defined By | ||
---|---|---|---|
QuickFinder(dataBox:DataBox, propertyName:String, propertyType:String = accessor, valueFunction:Function = null, filterFunction:Function = null)
Constructor. | QuickFinder | ||
dispose():void
Call this method to dispose all resources this quick finder used. | QuickFinder | ||
find(value:Object):Array
Call this to execute the query by specified condition. | QuickFinder | ||
Find the first matched data. | QuickFinder |
Method | Defined By | ||
---|---|---|---|
isInterested(data:IData):Boolean
Whether specified data is a data that current finder
has interesting. | QuickFinder |
dataBox | property |
dataBox:DataBox
[read-only] Get the data box this quick finder connected.
public function get dataBox():DataBox
filterFunction | property |
filterFunction:Function
[read-only] Get search filter function.
public function get filterFunction():Function
propertyName | property |
propertyName:String
[read-only] The property name query condition of this finder. Finder will search according to this property value.
public function get propertyName():String
propertyType | property |
propertyType:String
[read-only]
Get the property type query condition. The property type
of this query condition can be:
Consts.PROPERTY_TYPE_ACCESSOR
,
Consts.PROPERTY_TYPE_CLIENT
,
Consts.PROPERTY_TYPE_STYLE
.
public function get propertyType():String
valueFunction | property |
valueFunction:Function
[read-only] Get the value generator function.
public function get valueFunction():Function
QuickFinder | () | Constructor |
public function QuickFinder(dataBox:DataBox, propertyName:String, propertyType:String = accessor, valueFunction:Function = null, filterFunction:Function = null)
Constructor. Create quick finder and connect to the specified data box. The quick finder will search data by conditions of specified property name, property type, value generator function and filter function.
ParametersdataBox:DataBox — the target data box this quick finder will search.
| |
propertyName:String — the property name search condition.
| |
propertyType:String (default = accessor ) — the property type search condition.
This can be:
Consts.PROPERTY_TYPE_ACCESSOR ,
Consts.PROPERTY_TYPE_CLIENT ,
Consts.PROPERTY_TYPE_STYLE
| |
valueFunction:Function (default = null ) — a generator function. This function determines
what value should be returned when try to find data in the data box.
| |
filterFunction:Function (default = null ) — a filter function. This will filter out the data
that you don't want include in the query result.
|
dispose | () | method |
public function dispose():void
Call this method to dispose all resources this quick finder used. When you distroy this quick finder, call this to release all resources.
find | () | method |
public function find(value:Object):Array
Call this to execute the query by specified condition.
Parameters
value:Object — the value condition of the query.
|
Array — all matched data of this query.
|
findFirst | () | method |
public function findFirst(value:Object):IData
Find the first matched data.
Parameters
value:Object — the value condition of this query.
|
IData — first matched data of this query.
|
isInterested | () | method |
protected function isInterested(data:IData):Boolean
Whether specified data is a data that current finder has interesting. Only the data this finder has interesting will be searched by this finder.
Parameters
data:IData — a data need to check
|
Boolean — true if has interesting in this data, false otherwise.
|