// ICU4N specific - de-nested State and renamed CharsTrieState /// <summary> /// Saves the state of this trie. /// </summary> /// <param name="state">The <see cref="CharsTrieState"/> object to hold the trie's state.</param> /// <returns>This.</returns> /// <see cref="ResetToState(CharsTrieState)"/> /// <stable>ICU 4.8</stable> public CharsTrie SaveState(CharsTrieState state) /*const*/ { state.Chars = chars_; state.Root = root_; state.Pos = pos_; state.RemainingMatchLength = remainingMatchLength_; return(this); }
/// <summary> /// Resets this trie to the saved state. /// </summary> /// <param name="state">The State object which holds a saved trie state.</param> /// <returns>This.</returns> /// <exception cref="ArgumentException">If the state object contains no state, /// or the state of a different trie.</exception> /// <seealso cref="SaveState(CharsTrieState)"/> /// <seealso cref="Reset()"/> /// <stable>ICU 4.8</stable> public CharsTrie ResetToState(CharsTrieState state) { if (chars_ == state.Chars && chars_ != null && root_ == state.Root) { pos_ = state.Pos; remainingMatchLength_ = state.RemainingMatchLength; } else { throw new ArgumentException("incompatible trie state"); } return(this); }