Editar

Compartir a través de


Trait Collection

A trait collection extends Collection and adds additional behaviors specific to trait collections.

public class CdmTraitCollection extends CdmCollection<CdmTraitReferenceBase>

Constructors

Name Description
CdmTraitCollection(CdmCorpusContext, CdmObject)
ctx: The corpus context.
owner: The object that contains this collection.
Initializes a new instance of the CdmTraitCollection class.

Methods

Name Description Return Type SDK
Add(CdmTraitReferenceBase)
trait: The trait to add to the collection.

append(...) in Python, push(...) in TypeScript.
Adds the specified trait to the collection. Returns the trait that was added to the collection. CdmTraitReferenceBase 1.0
Add(CdmTraitDefinition, bool)
traitDefinition: The trait definition to use to create the trait reference.
simpleRef [optional]: A boolean that denotes whether the trait reference is simple named or not. The default value is false.

append(...) in Python, push(...) in TypeScript.
Creates a trait reference based on the specified trait definition and adds it to the collection. Returns the trait reference that was added to the collection. CdmTraitReferenceBase 1.0
Add(CdmTraitGroupDefinition, bool)
traitGroupDefinition: The trait group definition to use to create the trait group reference.
simpleRef [optional]: A boolean that denotes whether the trait group reference is simple named or not. The default value is false.

append(...) in Python, push(...) in TypeScript.
Creates a trait group reference based on the specified trait group definition and adds it to the collection. Returns the trait group reference that was added to the collection. CdmTraitReferenceBase 1.2
Add(string, bool)
name: The name of the trait to add to the collection.
simpleRef [optional]: A boolean that denotes whether the trait reference is simple named or not. The default value is false.

append(...) in Python, push(...) in TypeScript.
Creates a trait with the specified name and adds it to the collection. Returns the trait that was added to the collection. CdmTraitReferenceBase 1.0
Add(string, List<Tuple<string, dynamic>> args)
name: The name of the non-simple-referenced trait to add to the collection.
args [optional]: The list of arguments for the CdmTraitReference object. This is optional, call Add(string, bool) instead if creating a simple name referenced CdmTraitReference object.

append(...) in Python, push(...) in TypeScript.
Creates a trait with the specified name, adds it to the collection, adds the supplied arguments to it . Returns the trait that was added to the collection. CdmTraitReferenceBase 1.6
AddRange(IEnumerable<CdmTraitDefinition>)
traitList: The list of trait definitions to use to create trait references that will be added to the collection.

addAll(...) in Java, extend(...) in Python, concat(...) in TypeScript.
Adds the elements of the specified list of trait definitions to the collection, after converting them to trait references first. void 1.0
AddRange(IEnumerable<CdmTraitGroupDefinition>)
traitGroupList: The list of trait group definitions to use to create trait group references that will be added to the collection.

addAll(...) in Java, extend(...) in Python, concat(...) in TypeScript.
Adds the elements of the specified list of trait group definitions to the collection, after converting them to trait group references first. void 1.0
AddRange(IEnumerable<CdmTraitReferenceBase>)
traitList: The list of trait reference base objects to add to the collection.

addAll(...) in Java, extend(...) in Python, concat(...) in TypeScript.
Adds the elements of the specified list of trait reference base objects to the collection. void 1.0
Insert(int, CdmTraitReferenceBase)
index: The index to insert the trait reference at.
trait: The trait reference to add to the collection.

add(...) in Java.
Inserts the trait reference into the collection at the specified index. void 1.0
Remove(CdmTraitDefinition, bool)
traitDefToRemove: The trait whose reference we want to remove from the collection.
onlyFromProperty [optional]: A boolean that denotes whether this method should only be applied for traits that originate from properties. The default value is false.
Removes the trait reference with the same name as the specified trait definition from the collection. If there are multiple matches, this method will remove the first trait that's from a property. If there aren't any traits from properties and onlyFromProperty is false, then this method will remove the last trait that isn't from a property. Returns true if the operation is successful, false otherwise. bool 1.0
Remove(CdmTraitGroupDefinition, bool)
traitGroupDefToRemove: The trait group whose reference we want to remove from the collection.
Removes the trait group reference with the same name as the specified trait group definition from the collection. Returns true if the operation is successful, false otherwise. bool 1.2
Remove(string, bool)
traitName: The name of the trait to remove from the collection.
onlyFromProperty [optional]: A boolean that denotes whether this method should only be applied for traits that originate from properties. The default value is false.
Removes the trait with the specified name from the collection. If there are multiple matches, this method will remove the first trait that's from a property. If there aren't any traits from properties and onlyFromProperty is false, then this method will remove the last trait that isn't from a property. Returns true if the operation is successful, false otherwise. bool 1.0
Remove(CdmTraitReferenceBase, bool)
traitToRemove: The trait to remove from the collection.
onlyFromProperty [optional]: A boolean that denotes whether this method should only be applied for traits that originate from properties. The default value is false.
Removes the trait with the same name as the specified trait from the collection. If there are multiple matches, this method will remove the first trait that's from a property. If there aren't any traits from properties and onlyFromProperty is false, then this method will remove the last trait that isn't from a property. Returns true if the operation is successful, false otherwise. bool 1.0
RemoveAt(int)
index: The index of the trait to remove.
Removes the trait at the specified index from the collection. void 1.0
IndexOf(CdmTraitDefinition, bool)
traitDefinition: The trait whose reference we want the index of.
onlyFromProperty [optional]: A boolean that denotes whether this method should only be applied for traits that originate from properties. The default value is false.

index(...) in Python.
Returns the index of the trait reference with the same name as the specified trait definition. If there are multiple matches, this method will return the index of the first trait that's from a property. If there aren't any traits from properties and onlyFromProperty is false, then this method will return the index of the last trait that isn't from a property. int 1.0
IndexOf(CdmTraitGroupDefinition, bool)
traitGroupDefinition: The trait group whose reference we want the index of.
index(...) in Python.
Returns the index of the trait group reference with the same name as the specified trait group definition. int 1.2
IndexOf(string, bool)
traitName: The trait name associated with the trait reference we want the index of.
onlyFromProperty [optional]: A boolean that denotes whether this method should only be applied for traits that originate from properties. The default value is false.

index(...) in Python.
Returns the index of the trait reference with the specified name. If there are multiple matches, this method will return the index of the first trait that's from a property. If there aren't any traits from properties and onlyFromProperty is false, then this method will return the index of the last trait that isn't from a property. int 1.0
IndexOf(CdmTraitReferenceBase, bool)
trait: The trait we want the index of.
onlyFromProperty: A boolean that denotes whether this method should only be applied for traits that originate from properties.

index(...) in Python.
Returns the index of the trait reference with the same name as the specified trait. If there are multiple matches, this method will return the index of the first trait that's from a property. If there aren't any traits from properties and onlyFromProperty is false, then this method will return the index of the last trait that isn't from a property. int 1.0
Clear() Empties the collection. void 1.0
ToTraitRefs()
Returns a new collection consisting of only the trait references found in this collection. IEnumerable<CdmTraitReference> 1.2
ToTraitGroupRefs()
Returns a new collection consisting of only the trait group references found in this collection. IEnumerable<CdmTraitGroupReference> 1.2