view Implab/Automaton/DFAStateDescriptor.cs @ 175:96a89dcb4060 ref20160224

sync
author cin
date Mon, 21 Mar 2016 18:41:45 +0300
parents 92d5278d1b10
children
line wrap: on
line source

namespace Implab.Automaton {
    public struct DFAStateDescriptor {
        public readonly bool final;
        public readonly int[] transitions;


        public DFAStateDescriptor(int[] transitions, bool final) {
            this.transitions = transitions;
            this.final = final;
        }

        public DFAStateDescriptor(int[] transitions) : this(transitions, false) {
        }

        public DFAStateDescriptor(int size, bool final) {
            Safe.ArgumentInRange(size, 0, int.MaxValue, "size");

            this.final = final;

            transitions = new int[size];

            for (int i = 0; i < size; i++)
                transitions[i] = DFAConst.UNREACHABLE_STATE;
        }
    }
}