Esempio n. 1
0
        public void SetCurrentLine(SABlockPart blockPart)
        {
            PoemLine line = blockPart.GetFirstLine();

            if (CurrentLine != line)
            {
                SetOneLine(line);
            }
        }
Esempio n. 2
0
        internal PoemLineIdentifier GetID()
        {
            PoemLineIdentifier result = new PoemLineIdentifier();

            result.LineString = this.Line;

            PoemPart curPoemPart = this.ParentPoemPart;
            Poem     curPoem     = this.ParentPoem;

            result.PoemName      = curPoem.Name;
            result.PoemFirstLine = curPoem.GetFirstLine().Line;

            PoemLinesCollection collLines = null;

            if (curPoemPart != null)
            {
                collLines = curPoemPart.Lines;

                result.PoemPartName      = curPoemPart.Name;
                result.PoemPartFirstLine = curPoemPart.GetFirstLine().Line;
                result.PoemPartIndex     = curPoem.Parts.IndexOf(curPoemPart);
            }
            else
            {
                collLines = curPoem.Lines;
            }

            result.LineIndex = collLines.IndexOf(this);

            SABlockPart curBlockPart = curPoem.ParentBlockPart;
            SABlock     curBlock     = curPoem.ParentBlock;

            result.BlockName  = curBlock.Name;
            result.BlockIndex = curBlock.ParentSA.Blocks.IndexOf(curBlock);


            PoemCollection collPoems = null;

            if (curBlockPart != null)
            {
                collPoems = curBlockPart.Poems;

                result.BlockPartName      = curBlockPart.Name;
                result.BlockPartFirstLine = curBlockPart.GetFirstLine().Line;
                result.BlockPartIndex     = curBlock.Parts.IndexOf(curBlockPart);
            }
            else
            {
                collPoems = curBlock.Poems;
            }

            result.PoemIndex = collPoems.IndexOf(curPoem);

            return(result);
        }
Esempio n. 3
0
        private PoemLine GenerateNextBlockPart(PoemLine currentLine, bool forward)
        {
            if (currentLine.ParentPoem.ParentBlockPart != null)
            {
                SABlockPart nextPart = this.mySAIterator.GetNextBlockPart(currentLine.ParentPoem.ParentBlockPart, forward);
                if (nextPart != null)
                {
                    return(nextPart.GetFirstLine());
                }
            }

            return(GenerateNextBlock(currentLine, forward));
        }
Esempio n. 4
0
        public void GetRandomBlockPart(SABlock block)
        {
            PoemLine result = null;

            if (block != null && block.Parts.Count > 0)
            {
                int partsCount = block.Parts.Count;

                int randomIndex = CommonOperations.rnd.Next(partsCount);

                SABlockPart blockPart = block.Parts[randomIndex];

                result = blockPart.GetFirstLine();
            }

            SetOneLine(result);
        }
Esempio n. 5
0
        public void GoBlockPartBegining()
        {
            PoemLine curLine = this.CurrentLine;

            if (systemAccumulation != null)
            {
                if (curLine == null)
                {
                    curLine = systemAccumulation.GetFirstLine();

                    SetOneLine(curLine);
                }
                else
                {
                    SABlockPart curBlockPart = curLine.ParentPoem.ParentBlockPart;
                    SABlock     curBlock     = curLine.ParentPoem.ParentBlock;

                    if (curBlockPart != null)
                    {
                        bool isFirstLine = curBlockPart.IsFirstLine(curLine);

                        if (!isFirstLine)
                        {
                            SetOneLine(curBlockPart.GetFirstLine());
                        }
                    }
                    else
                    {
                        bool isFirstLine = curBlock.IsFirstLine(curLine);

                        if (!isFirstLine)
                        {
                            SetOneLine(curBlock.GetFirstLine());
                        }
                    }
                }
            }
        }