以非破坏性方式将多个
EntityCollection
实例合成为单个集合。
如果具有相同 ID 的实体存在于多个集合中,则它是非破坏性的
合并到单个新实体实例中。 如果实体在多个
collections,列表 it 的最后一个集合中 Entity 的属性
属于 被使用。 CompositeEntityCollection 几乎可以在任何
使用 EntityCollection。
Name | Type | Description |
---|---|---|
collections |
Array.<EntityCollection> | optional 要合并的 EntityCollection 实例的初始列表。 |
owner |
DataSource | CompositeEntityCollection | optional 创建此集合的数据源(或复合实体集合)。 |
Members
readonly collectionChanged : Event
获取在集合中添加或删除实体时触发的事件。
生成的事件是
EntityCollection.collectionChangedEventCallback
。
获取此集合的全局唯一标识符。
readonly owner : DataSource|CompositeEntityCollection
获取此复合实体集合的所有者,即。创建它的数据源或复合实体集合。
readonly values : Array.<Entity>
获取集合中的 Entity 实例的数组。
此数组不应直接修改。
Methods
将集合添加到复合中。
Name | Type | Description |
---|---|---|
collection |
EntityCollection | 要添加的集合。 |
index |
number | optional 要添加集合的索引。 如果省略,则集合将 添加到所有现有集合之上。 |
Throws:
-
DeveloperError : index, if supplied, must be greater than or equal to zero and less than or equal to the number of collections.
computeAvailability() → TimeInterval
计算集合中实体的最大可用性。
如果集合包含无限可用数据和非无限数据的混合,
它将仅返回与非无限数据相关的间隔。 如果所有
data 是无限的,则返回无限间隔。
Returns:
集合中实体的可用性。
如果提供的实体在此集合中,则返回 true,否则返回 false。
Name | Type | Description |
---|---|---|
entity |
Entity | 实体。 |
Returns:
true(如果提供的实体在此集合中)或 false。
检查组合是否包含给定的集合。
Name | Type | Description |
---|---|---|
collection |
EntityCollection | 中要检查的集合。 |
Returns:
true(如果复合包含集合),否则 false。
getById(id) → Entity|undefined
获取具有指定 ID 的实体。
Name | Type | Description |
---|---|---|
id |
string | 要检索的实体的 ID。 |
Returns:
具有提供的 id 的实体,如果集合中不存在 id,则为 undefined。
按索引从 composite 中获取集合。
Name | Type | Description |
---|---|---|
index |
number | 要检索的索引。 |
获取此组合中的集合数。
确定组合中给定集合的索引。
Name | Type | Description |
---|---|---|
collection |
EntityCollection | 要查找其索引的集合。 |
Returns:
组合中集合的索引,如果组合中不存在该集合,则为 -1。
将集合在合成中降低一个位置。
Name | Type | Description |
---|---|---|
collection |
EntityCollection | 要移动的集合。 |
Throws:
-
DeveloperError : collection is not in this composite.
将集合降低到复合的底部。
Name | Type | Description |
---|---|---|
collection |
EntityCollection | 要移动的集合。 |
Throws:
-
DeveloperError : collection is not in this composite.
将集合在合成中提升一个位置。
Name | Type | Description |
---|---|---|
collection |
EntityCollection | 要移动的集合。 |
Throws:
-
DeveloperError : collection is not in this composite.
将集合提升到复合的顶部。
Name | Type | Description |
---|---|---|
collection |
EntityCollection | 要移动的集合。 |
Throws:
-
DeveloperError : collection is not in this composite.
从此组合中删除所有集合。
从此组合中删除集合(如果存在)。
Name | Type | Description |
---|---|---|
collection |
EntityCollection | 要删除的集合。 |
Returns:
true,如果集合位于复合集合中并被删除,
如果集合不在复合组中,则为 false。
立即恢复引发
EntityCollection#collectionChanged
事件
添加或删除项时。 在活动暂停期间所做的任何修改
将作为单个事件触发。 此功能还确保
如果事件也恢复,则集合将重新合成。
此函数是引用计数的,只要存在
是对 EntityCollection#resumeEvents
的相应调用。
Throws:
-
DeveloperError : resumeEvents can not be called before suspendEvents.
防止引发
EntityCollection#collectionChanged
事件
直到对 EntityCollection#resumeEvents
进行相应的调用,此时
点将引发涵盖所有暂停操作的单个事件。
这允许有效地添加和删除许多项目。
当事件暂停时,集合的重新合成将
也被暂停,因为这可能是一个昂贵的操作。
只要有
是对 EntityCollection#resumeEvents
的相应调用。