view Implab/Formats/ByteAlphabet.cs @ 174:983df35b3ca1 ref20160224

sync
author cin
date Fri, 18 Mar 2016 18:10:30 +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 ByteAlphabet : IndexedAlphabetBase<byte> {
        public ByteAlphabet() : base(byte.MaxValue + 1){
        }

        #region implemented abstract members of IndexedAlphabetBase

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

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

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

        #endregion
    }
}