view Implab/Formats/CharAlphabet.cs @ 173:ecfece82ca11 ref20160224

Working on text scanner
author cin
date Tue, 15 Mar 2016 02:11:06 +0300
parents 92d5278d1b10
children 0c3c69fe225b
line wrap: on
line source

using System.Collections.Generic;
using System.Linq;
using Implab.Automaton;

namespace Implab.Formats {
    public class CharAlphabet: IndexedAlphabetBase<char> {

        public CharAlphabet()
            : base(char.MaxValue + 1) {
        }

        public override int GetSymbolIndex(char symbol) {
            return symbol;
        }

        public override char GetSymbolByIndex(int index) {
            return (char)index;
        }

        public override IEnumerable<char> InputSymbols {
            get { return Enumerable.Range(char.MinValue, char.MaxValue).Cast<char>(); }
        }
    }
}