Package | com.yworks.util |
Class | public class FilteredCollectionModel |
Inheritance | FilteredCollectionModel com.yworks.support.EventDispatchingProxy |
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 | ||
onItemAddedByFilter(evt:CollectionEvent):void
Callback that indicates that the item has been added by the filter. | FilteredCollectionModel | ||
onItemAddedInBackingStore(evt:CollectionEvent):void
Callback that indicates that the item has been add in the backing store. | FilteredCollectionModel | ||
onItemChanged(evt:CollectionEvent):void
Called whenever an item has changed. | FilteredCollectionModel | ||
onItemRemoved(evt:CollectionEvent):void
Called whenever an item has been removed. | FilteredCollectionModel | ||
onItemRemovedByFilter(evt:CollectionEvent):void
Callback that indicates that the item has been removed by the filter. | FilteredCollectionModel | ||
onItemRemovedInBackingStore(evt:CollectionEvent):void
Callback that indicates that the item has been removed in the backing store. | 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):Boolean
Determines whether the given item is accepted by this instance.
Parameters
item:Object |
Boolean |
addAll | () | method |
public function addAll(iter:Iterable):void
Adds 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):Boolean
Adds 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():void
Removes all of the elements from this collection. The collection will be empty after this method returns.
contains | () | method |
public function contains(item:Object):Boolean
Returns 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():void
Disposes this instance, removing any listeners that have been registered with the wrapped collection model.
getItemAt | () | method |
public function getItemAt(index:int):Object
Returns 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():Boolean
Returns true if this collection contains no elements.
ReturnsBoolean — true if this collection contains no elements
|
iterator | () | method |
public function iterator():Iterator
Returns an iterator over a set of elements.
ReturnsIterator — an Iterator.
|
length | () | method |
public function length():uint
Returns 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 |
onItemAddedByFilter | () | method |
protected function onItemAddedByFilter(evt:CollectionEvent):void
Callback that indicates that the item has been added by the filter.
This method simply delegates to onItemAdded
.
Parameters
evt:CollectionEvent — The event which was dispatched upon the collection change.
|
See also
onItemAddedInBackingStore | () | method |
protected function onItemAddedInBackingStore(evt:CollectionEvent):void
Callback that indicates that the item has been add in the backing store.
This method simply delegates to onItemAdded
.
Parameters
evt:CollectionEvent — The event which was dispatched when the item was added.
|
See also
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 |
onItemRemovedByFilter | () | method |
protected function onItemRemovedByFilter(evt:CollectionEvent):void
Callback that indicates that the item has been removed by the filter.
This method simply delegates to onItemRemoved
.
Parameters
evt:CollectionEvent — The event which was dispatched upon the collection change.
|
See also
onItemRemovedInBackingStore | () | method |
protected function onItemRemovedInBackingStore(evt:CollectionEvent):void
Callback that indicates that the item has been removed in the backing store.
This method simply delegates to onItemRemoved
.
Parameters
evt:CollectionEvent — The event which was dispatched upon removal of the item.
|
See also
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():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.
predicateChangedForItem | () | method |
public function 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.
Parameters
forItem:Object |
removeItem | () | method |
public function removeItem(item:Object):Boolean
Removes 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():Array
Returns an array containing all of the elements in this collection.
ReturnsArray — an array containing all of the elements in this collection
|