| Package | com.yworks.util |
| Class | public class FilteredCollectionModel |
| Inheritance | FilteredCollectionModel flash.events.EventDispatcher |
| Implements | ICollectionModel |
The predicate function accepts an object as its single parameter and returns a boolean:
var predicate:Function = function( item:Object ):Boolean {
..
}
| Method | Defined By | ||
|---|---|---|---|
FilteredCollectionModel(inner:ICollectionModel, predicate:Function)
Creates a new instance using the provided collection model and predicate. | FilteredCollectionModel | ||
Adds all of the elements in the specified collection to this collection (optional operation). | FilteredCollectionModel | ||
addItem(item:Object):Boolean
Adds the specified item to this collection. | FilteredCollectionModel | ||
clear():void
Removes all of the elements from this collection. | FilteredCollectionModel | ||
contains(item:Object):Boolean
Returns true if this collection contains the specified element. | FilteredCollectionModel | ||
dispose():void
Disposes this instance, removing any listeners that have
been registered with the wrapped collection model. | FilteredCollectionModel | ||
getItemAt(index:int):Object
Returns the element at the specified position in this collection. | FilteredCollectionModel | ||
isEmpty():Boolean
Returns true if this collection contains no elements. | FilteredCollectionModel | ||
Returns an iterator over a set of elements. | FilteredCollectionModel | ||
length():uint
Returns the number of elements in this collection. | FilteredCollectionModel | ||
predicateChanged():void
Called by clients to indicate that the predicate function
has changed in such a way that items that have previously been
accepted might not be accepted anymore and vice versa. | FilteredCollectionModel | ||
predicateChangedForItem(forItem:Object):void
Called by clients to indicate that the predicate function
has changed in such a way that for the provided item that has previously been
accepted the predicate might not have changed. | FilteredCollectionModel | ||
removeItem(item:Object):Boolean
Removes a single instance of the specified element from this collection, if it is present (optional operation). | FilteredCollectionModel | ||
toArray():Array
Returns an array containing all of the elements in this collection. | FilteredCollectionModel | ||
| Method | Defined By | ||
|---|---|---|---|
accepts(item:Object):Boolean
Determines whether the given item is accepted by this instance. | FilteredCollectionModel | ||
onItemAdded(evt:CollectionEvent):void
Called whenever an item has been added. | FilteredCollectionModel | ||
onItemChanged(evt:CollectionEvent):void
Called whenever an item has changed. | FilteredCollectionModel | ||
onItemRemoved(evt:CollectionEvent):void
Called whenever an item has been removed. | FilteredCollectionModel | ||
onItemReset(evt:CollectionEvent):void
Called whenever the collection has been reset. | FilteredCollectionModel | ||
| FilteredCollectionModel | () | Constructor |
public function FilteredCollectionModel(inner:ICollectionModel, predicate:Function)Creates a new instance using the provided collection model and predicate.
The predicate function accepts an object as its single parameter and returns a boolean:
var predicate:Function = function( item:Object ):Boolean {
..
}
Parameters inner:ICollectionModel | |
predicate:Function |
| accepts | () | method |
protected function accepts(item:Object):BooleanDetermines whether the given item is accepted by this instance.
Parameters
item:Object |
Boolean |
| addAll | () | method |
public function addAll(iter:Iterable):voidAdds all of the elements in the specified collection to this collection (optional operation).
Parameters
iter:Iterable — the collection containing elements to be added to this collection
|
| addItem | () | method |
public function addItem(item:Object):BooleanAdds the specified item to this collection. Returns true if this collection changed as a result of the call. (Returns false if this collection does not permit duplicates and already contains the specified element.)
Parameters
item:Object — element whose presence in this collection is to be ensured
|
Boolean — true if this collection changed as a result of the call
|
| clear | () | method |
public function clear():voidRemoves all of the elements from this collection. The collection will be empty after this method returns.
| contains | () | method |
public function contains(item:Object):BooleanReturns true if this collection contains the specified element.
Parameters
item:Object — element whose presence in this collection is to be tested
|
Boolean — true if this collection contains the specified element
|
| dispose | () | method |
public function dispose():voidDisposes this instance, removing any listeners that have been registered with the wrapped collection model.
| getItemAt | () | method |
public function getItemAt(index:int):ObjectReturns the element at the specified position in this collection.
Parameters
index:int — the index of the element to return
|
Object — the element at the specified position in this list
|
| isEmpty | () | method |
public function isEmpty():BooleanReturns true if this collection contains no elements.
ReturnsBoolean — true if this collection contains no elements
|
| iterator | () | method |
public function iterator():IteratorReturns an iterator over a set of elements.
ReturnsIterator — an Iterator.
|
| length | () | method |
public function length():uintReturns the number of elements in this collection.
Returnsuint — the number of elements in this collection
|
| onItemAdded | () | method |
protected function onItemAdded(evt:CollectionEvent):void
Called whenever an item has been added.
Dispatches the passed CollectionEvent.COLLECTION_CHANGE event.
Parameters
evt:CollectionEvent |
| onItemChanged | () | method |
protected function onItemChanged(evt:CollectionEvent):void
Called whenever an item has changed.
Dispatches the passed CollectionEvent.COLLECTION_CHANGE event.
Parameters
evt:CollectionEvent |
| onItemRemoved | () | method |
protected function onItemRemoved(evt:CollectionEvent):void
Called whenever an item has been removed.
Dispatches the passed CollectionEvent.COLLECTION_CHANGE event.
Parameters
evt:CollectionEvent |
| onItemReset | () | method |
protected function onItemReset(evt:CollectionEvent):void
Called whenever the collection has been reset.
Dispatches the passed CollectionEvent.COLLECTION_CHANGE event.
Parameters
evt:CollectionEvent |
| predicateChanged | () | method |
public function predicateChanged():voidCalled by clients to indicate that the predicate function has changed in such a way that items that have previously been accepted might not be accepted anymore and vice versa.
| predicateChangedForItem | () | method |
public function predicateChangedForItem(forItem:Object):voidCalled by clients to indicate that the predicate function has changed in such a way that for the provided item that has previously been accepted the predicate might not have changed.
Parameters
forItem:Object |
| removeItem | () | method |
public function removeItem(item:Object):BooleanRemoves a single instance of the specified element from this collection, if it is present (optional operation).
Parameters
item:Object — element to be removed from this collection, if present
|
Boolean — true if an element was removed as a result of this call
|
| toArray | () | method |
public function toArray():ArrayReturns an array containing all of the elements in this collection.
ReturnsArray — an array containing all of the elements in this collection
|