Exemplo n.º 1
0
        private bool ZGetSequenceSetItem(out cSequenceSetItem rItem)
        {
            uint lNumber;
            cSequenceSetRangePart lItem;

            if (SkipByte(cASCII.ASTERISK))
            {
                lItem = cSequenceSetItem.Asterisk;
            }
            else
            {
                if (!GetNZNumber(out _, out lNumber))
                {
                    rItem = null; return(false);
                }
                lItem = new cSequenceSetNumber(lNumber);
            }

            var lBookmark = Position;

            if (!SkipByte(cASCII.COLON))
            {
                rItem = lItem;
                return(true);
            }

            if (SkipByte(cASCII.ASTERISK))
            {
                rItem = new cSequenceSetRange(lItem, cSequenceSetItem.Asterisk);
                return(true);
            }

            if (GetNZNumber(out _, out lNumber))
            {
                rItem = new cSequenceSetRange(lItem, new cSequenceSetNumber(lNumber));
            }
            else
            {
                Position = lBookmark;
                rItem    = lItem;
            }

            return(true);
        }
Exemplo n.º 2
0
        private static cSequenceSetItem[] ZFromRange(uint pFrom, uint pTo)
        {
            if (pFrom == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(pFrom));
            }
            if (pFrom > pTo)
            {
                throw new ArgumentOutOfRangeException(nameof(pTo));
            }

            cSequenceSetItem[] lItems = new cSequenceSetItem[1];

            // 2)
            //if (pTo == uint.MaxValue) lItems[0] = new cSequenceSetRange(new cSequenceSetNumber(pFrom), cSequenceSetItem.Asterisk);
            //else

            lItems[0] = new cSequenceSetRange(new cSequenceSetNumber(pFrom), new cSequenceSetNumber(pTo));

            return(lItems);
        }