// Removes a terminal object associated with a given sequence of // transition keys from the graph. This will also remove any state // nodes that as a result wind up without any useful information // in them (either a transition to a new state, or a list of objects // associated with a terminal state). private StateNode _StateRemove(TransitionKey[] rgtkTerminal, int itk, Terminal obj, StateNode stateCur) { if (itk < rgtkTerminal.Length) { TransitionKey tk = rgtkTerminal[itk]; StateNode stateNext = stateCur.NextState(tk, false); if (stateNext == null) { throw new ArgumentException("String not found in graph", "rgtkTerminal"); } stateNext = _StateRemove(rgtkTerminal, itk + 1, obj, stateNext); if (stateNext == null) { stateCur.RemoveLink(tk); if (stateCur.Clink == 0) { stateCur = null; } } } else { if (stateCur.CobjTerminal == 0) { throw new ArgumentException("String not found in graph", "rgtkTerminal"); } stateCur.RemoveTerminalObj(obj); if (stateCur.CobjTerminal == 0) { stateCur = null; } } return(stateCur); }