Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParameterDef"/> class.
        /// </summary>
        /// <param name="name">Name of this element.</param>
        /// <param name="elements">Properties of this element.</param>
        public ParameterDef(ParameterName name, params Property[] elements)
        {
            Name = name;

            var properties = ImmutableNamedElementCollection.CreatePropertyCollectionBuilder();

            foreach (var e in elements)
            {
                properties.Add(e);
            }

            _properties = properties.ToImmutable();
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Property"/> class.
        /// </summary>
        /// <param name="name">Name of this element.</param>
        /// <param name="value">Value element contained by this element</param>
        /// <param name="elements">Nested Properties</param>
        public Property(PropertyName name, Value value, params Property[] elements)
        {
            Name  = name;
            Value = value;

            var properties = ImmutableNamedElementCollection.CreatePropertyCollectionBuilder();

            foreach (var e in elements)
            {
                properties.Add(e);
            }

            _properties = properties.ToImmutable();
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScoredProperty"/> class.
        /// </summary>
        /// <param name="name">Name of ScoredProperty element.</param>
        /// <param name="elements">Child Property and/or ScoredProperty.</param>
        public ScoredProperty(ScoredPropertyName name, params ScoredPropertyChild[] elements)
        {
            Name = name;

            var scoredProperties = ImmutableNamedElementCollection.CreateScoredPropertyCollectionBuilder();
            var properties       = ImmutableNamedElementCollection.CreatePropertyCollectionBuilder();

            foreach (var e in elements)
            {
                e.Apply(
                    onScoredProperty: x => scoredProperties.Add(x),
                    onProperty: x => properties.Add(x));
            }

            _scoredProperties = scoredProperties.ToImmutable();
            _properties       = properties.ToImmutable();
        }
Exemple #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Option"/> class.
        /// </summary>
        /// <param name="name">Name of the Option.</param>
        /// <param name="constrained">Constraint value.</param>
        /// <param name="elements">Children of the Option.</param>
        public Option(XName name, XName constrained, params OptionChild[] elements)
        {
            Name        = name;
            Constrained = constrained;

            var properties       = ImmutableNamedElementCollection.CreatePropertyCollectionBuilder();
            var scoredProperties = ImmutableNamedElementCollection.CreateScoredPropertyCollectionBuilder();

            foreach (var e in elements)
            {
                e.Apply(
                    onProperty: x => properties.Add(x),
                    onScoredProperty: x => scoredProperties.Add(x));
            }

            _properties       = properties.ToImmutable();
            _scoredProperties = scoredProperties.ToImmutable();
        }
Exemple #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Ticket"/> class.
        /// </summary>
        /// <param name="elements">The child elements.</param>
        public Ticket(params TicketChild[] elements)
        {
            var features   = ImmutableNamedElementCollection.CreateFeatureCollectionBuilder();
            var parameters = ImmutableNamedElementCollection.CreateParameterInitCollectionBuilder();
            var properties = ImmutableNamedElementCollection.CreatePropertyCollectionBuilder();

            foreach (var e in elements)
            {
                e.Apply(
                    onFeature: x => features.Add(x),
                    onParameterInit: x => parameters.Add(x),
                    onProperty: x => properties.Add(x));
            }

            _features           = features.ToImmutable();
            _parameters         = parameters.ToImmutable();
            _properties         = properties.ToImmutable();
            _declaredNamespaces = NamespaceDeclarationCollection.Default;
        }
Exemple #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Feature"/> class.
        /// </summary>
        /// <param name="name">The name of the element.</param>
        /// <param name="elements">The options of the element.</param>
        public Feature(FeatureName name, params FeatureChild[] elements)
        {
            Name = name;
            var o          = new Option();
            var properties = ImmutableNamedElementCollection.CreatePropertyCollectionBuilder();
            var options    = ImmutableList.CreateBuilder <Option>();
            var features   = ImmutableNamedElementCollection.CreateFeatureCollectionBuilder();

            foreach (var e in elements)
            {
                e.Apply(
                    onProperty: x => properties.Add(x),
                    onOption: x => options.Add(x),
                    onFeature: x => features.Add(x));
            }

            _properties = properties.ToImmutable();
            _options    = options.ToImmutable();
            _features   = features.ToImmutable();
        }