Ejemplo n.º 1
0
        public CharacterStream(string streamData)
        {
            StartOfStream = true;

            StreamData = streamData;
            ArrayData = streamData.ToCharArray();

            End = new CharacterCursor(this, ArrayData.Last(), ArrayData.Length-1);
            Start = new CharacterCursor(this, ArrayData.First(), 0);
            Current = new CharacterCursor(this, ArrayData.First(), 0);
        }
Ejemplo n.º 2
0
        public bool Matches(CharacterCursor cursor)
        {
            if (IsWildCard)
                return true;

            if (IsExpired)
                return false;

            IsExpired = cursor.Value == Value;

            return IsExpired;
        }
Ejemplo n.º 3
0
        public CharacterCursor Continue()
        {
            if (StartOfStream)
            {
                StartOfStream = false;
                return Start;
            }

            var nextIndex = Current.Index + 1;
            var nextValue = ArrayData[nextIndex];
            Current = new CharacterCursor(this, nextValue, nextIndex);

            return Current;
        }