Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of <see cref="GreenPgnGameSyntax"/>.
        /// </summary>
        /// <param name="tagSection">
        /// The tag section of the game.
        /// </param>
        /// <param name="plyList">
        /// The ply list of the game.
        /// </param>
        /// <param name="gameResult">
        /// The result of the game. This is an optional parameter.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="tagSection"/> and/or <paramref name="plyList"/> is null.
        /// </exception>
        public GreenPgnGameSyntax(
            GreenPgnTagSectionSyntax tagSection,
            GreenPgnPlyListSyntax plyList,
            GreenWithTriviaSyntax gameResult)
        {
            TagSection = tagSection ?? throw new ArgumentNullException(nameof(tagSection));
            PlyList    = plyList ?? throw new ArgumentNullException(nameof(plyList));
            GameResult = gameResult;

            Length = tagSection.Length + plyList.Length + GameResultLength;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of <see cref="GreenPgnVariationSyntax"/>.
        /// </summary>
        /// <param name="parenthesisOpen">
        /// The opening parenthesis.
        /// </param>
        /// <param name="pliesWithFloatItems">
        /// The list of plies and trailing floating items that are not captured by a ply.
        /// </param>
        /// <param name="parenthesisClose">
        /// The closing parenthesis. This is an optional parameter.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="parenthesisOpen"/> and/or <paramref name="pliesWithFloatItems"/> is null.
        /// </exception>
        public GreenPgnVariationSyntax(
            GreenWithTriviaSyntax parenthesisOpen,
            GreenPgnPlyListSyntax pliesWithFloatItems,
            GreenWithTriviaSyntax parenthesisClose)
        {
            ParenthesisOpen     = parenthesisOpen ?? throw new ArgumentNullException(nameof(parenthesisOpen));
            PliesWithFloatItems = pliesWithFloatItems ?? throw new ArgumentNullException(nameof(pliesWithFloatItems));
            ParenthesisClose    = parenthesisClose;

            Length = parenthesisOpen.Length + pliesWithFloatItems.Length + ParenthesisCloseLength;
        }
Ejemplo n.º 3
0
        internal PgnPlyListSyntax(Union <PgnGameSyntax, PgnVariationSyntax> parent, GreenPgnPlyListSyntax green)
        {
            Parent = parent;
            Green  = green;

            Plies = new SafeLazyObjectCollection <PgnPlySyntax>(
                green.Plies.Count,
                index => new PgnPlySyntax(this, index, Green.Plies[index]));

            trailingFloatItems = new SafeLazyObject <PgnPlyFloatItemListSyntax>(() => new PgnPlyFloatItemListSyntax(this, Green.TrailingFloatItems));
        }