/// <summary> /// Initializes a new atomic trait. /// </summary> internal CKTrait(CKTraitContext ctx, string atomicTrait) { Debug.Assert(atomicTrait.Contains(ctx.Separator) == false); _context = ctx; _trait = atomicTrait; _traits = new CKTrait[] { this }; }
/// <summary> /// Initializes the new empty trait of a CKTraitContext. /// </summary> internal CKTrait(CKTraitContext ctx) { Debug.Assert(ctx.EmptyTrait == null, "There is only one empty trait per context."); _context = ctx; _trait = String.Empty; _traits = Util.Array.Empty <CKTrait>(); }
/// <summary> /// Initializes a new atomic tag. /// </summary> internal CKTrait(CKTraitContext ctx, string atomicTag) { Debug.Assert(atomicTag.Contains(ctx.Separator) == false); _context = ctx; _tag = atomicTag; _tags = new CKTrait[] { this }; }
/// <summary> /// Initializes a new combined trait. /// </summary> internal CKTrait(CKTraitContext ctx, string combinedTrait, IReadOnlyList <CKTrait> traits) { Debug.Assert(combinedTrait.IndexOf(ctx.Separator) > 0 && traits.Count > 1, "There is more than one trait in a Combined Trait."); Debug.Assert(traits.All(m => m.IsAtomic), "Provided traits are all atomic."); Debug.Assert(traits.GroupBy(m => m).Where(g => g.Count() != 1).Count() == 0, "No duplicate in atomic in traits."); _context = ctx; _trait = combinedTrait; _traits = traits; }
static Tags() { Context = new CKTraitContext("ActivityMonitor"); Empty = Context.EmptyTrait; UserConclusion = Context.FindOrCreate("c:User"); GetTextConclusion = Context.FindOrCreate("c:GetText"); MonitorTopicChanged = Context.FindOrCreate("MonitorTopicChanged"); CreateDependentActivity = Context.FindOrCreate("dep:CreateActivity"); StartDependentActivity = Context.FindOrCreate("dep:StartActivity"); }
ArtifactType(string name, bool installable, char savorSeparator) { Name = name; IsInstallable = installable; ContextSavors = savorSeparator == 0 ? null : CKTraitContext.Create("ArtifactType:" + name, savorSeparator); }