/// <inheritdoc /> public override CdmObject Copy(ResolveOptions resOpt = null, CdmObject host = null) { if (resOpt == null) { resOpt = new ResolveOptions(this, this.Ctx.Corpus.DefaultResolutionDirectives); } CdmTraitGroupDefinition copy; if (host == null) { copy = new CdmTraitGroupDefinition(this.Ctx, this.TraitGroupName); } else { copy = host as CdmTraitGroupDefinition; copy.TraitGroupName = this.TraitGroupName; } this.CopyDef(resOpt, copy); return(copy); }
/// <summary> /// Removes the <see cref="CdmTraitGroupReference"/> that has the same name as <see cref="CdmTraitGroupDefinition"/>. /// If there are multiple matches, removes the first found. /// </summary> /// <param name="traitGroupDefToRemove"><see cref="CdmTraitGroupDefinition"/> whose reference to remove from the collection.</param> /// <returns>Whether the operation completed successfuly.</returns> public bool Remove(CdmTraitGroupDefinition traitGroupDefToRemove) { return(this.Remove(traitGroupDefToRemove.TraitGroupName)); }
/// <summary> /// Creates a <see cref="CdmTraitGroupReference"/> based on a <see cref="CdmTraitGroupDefinition"/> and adds it to the collection. /// </summary> /// <param name="traitGroupDefinition">The trait group definition used to create the trait group reference.</param> /// <param name="simpleRef">Used to set trait.SimpleNamedReference in the constructor.</param> /// <returns>The created trait group reference that was added to the collection.</returns> public CdmTraitReferenceBase Add(CdmTraitGroupDefinition traitGroupDefinition, bool simpleRef = false) { this.ClearCache(); return(base.Add(new CdmTraitGroupReference(this.Ctx, traitGroupDefinition, simpleRef))); }
/// <summary> /// Retrieves the index of a trait group reference with the same name as the trait group definition provided. /// If there are multiple matches, returns the index of the last trait group that is not from a property. /// </summary> /// <param name="traitGroupDefinition">The trait group definition associated with the trait group reference we want to retrieve the index of.</param> /// <returns>The index of the trait group reference or -1 if no such trait group reference exists in the collection.</returns> public int IndexOf(CdmTraitGroupDefinition traitGroupDefinition) { return(IndexOf(traitGroupDefinition.TraitGroupName)); }