view Implab/Automaton/DFAStateDescriptor.cs @ 170:181119ef3b39 ref20160224

DFA refactoring, rx based dfa.
author cin
date Fri, 04 Mar 2016 01:56:31 +0300
parents 54270c2f29f2
children 92d5278d1b10
line wrap: on
line source

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


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

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

        public DFAStateDescriptior(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;
        }
    }
}