function q = dfsa_delta(DFSA,q,s) % perform the transition from (q,s) to q' % see str2dfsa.m for basic dfsa definitions % note: we will not check alphabet compatibility here % any out-of-range letter will result in an error ns = find(DFSA.ALF==s); %ns = s-DFSA.ALF(1)+1; if isempty(ns) error(['unknown letter s = ' s ' ALF = ' DFSA.ALF]) end q = DFSA.delta(q,ns); %q = DFSA.delta(q,s); return function q = dfsa_delta_old(DFSA,q,s) % perform the transition from (q,s) to q' % see str2dfsa.m for basic dfsa definitions % note: we will not check alphabet compatibility here % any out-of-range type phenomenon will be treated as a rejection if (q==DFSA.qd) % this is the abosorbing "default" state % don't do anything -- stay here else [b,q] = ind_in_range([q,s],DFSA.delta); % is the transition allowed? %q = DFSA.delta(q,s)+0; q = q + 0; % unsparse if ~q q = DFSA.qd; end % OLD WAY: %[b,x] = ind_in_range([q,s],DFSA.delta); % is the transition allowed? %if b, b = ~isempty(x{1}); end; %if b % q = x{1}; %else % q = DFSA.qd; % default state <--> rejection %end end return