src/main/java/com/antbrains/wordseg/luceneanalyzer/AttributeSource.java
public final void restoreState(State state) {
    if (state == null)
      return;

    do {
      AttributeImpl targetImpl = attributeImpls.get(state.attribute.getClass());
      if (targetImpl == null) {
        throw new IllegalArgumentException("State contains AttributeImpl of type "
            + state.attribute.getClass().getName() + " that is not in in this AttributeSource");
      }
      state.attribute.copyTo(targetImpl);
      state = state.next;
    } while (state != null);
  }
/**
   * Restores this state by copying the values of all attribute implementations that this state
   * contains into the attributes implementations of the targetStream. The targetStream must contain
   * a corresponding instance for each argument contained in this state (e.g. it is not possible to
   * restore the state of an AttributeSource containing a TermAttribute into a AttributeSource using
   * a Token instance as implementation).
   * <p>
   * Note that this method does not affect attributes of the targetStream that are not contained in
   * this state. In other words, if for example the targetStream contains an OffsetAttribute, but
   * this state doesn't, then the value of the OffsetAttribute remains unchanged. It might be
   * desirable to reset its value to the default, in which case the caller should first call
   * {@link TokenStream#clearAttributes()} on the targetStream.
   */
Restores this state by copying the values of all attribute implementations that this state
contains into the attributes implementations of the targetStream. The targetStream must contain
a corresponding instance for each argument contained in this state .

Note that this method does not affect attributes of the targetStream that are not contained in
this state. In other words, if for example the targetStream contains an OffsetAttribute, but
this state doesn't, then the value of the OffsetAttribute remains unchanged. It might be
desirable to reset its value to the default, in which case the caller should first call
TokenStream#clearAttributes() on the targetStream.
Restores this state by copying the values of all attribute implementations that this state contains into the attributes implementations of the targetStream . The targetStream must contain a corresponding instance for each argument contained in this state . Note that this method does not affect attributes of the targetStream that are not contained in this state . In other words if for example the targetStream contains an OffsetAttribute but this state doesn ' t then the value of the OffsetAttribute remains unchanged . It might be desirable to reset its value to the default in which case the caller should first call TokenStream#clearAttributes () on the targetStream .
public final void restoreState(State state) {
    if (state == null)
      return;
    do {
      AttributeImpl targetImpl = attributeImpls.get(state.attribute.getClass());
      if (targetImpl == null) {
        throw new IllegalArgumentException("State contains AttributeImpl of type "
            + state.attribute.getClass().getName() + " that is not in in this AttributeSource");
      }
      state.attribute.copyTo(targetImpl);
      state = state.next;
    } while (state != null);
  }
public final void restoreState ( State state ) { if ( state == null ) return ; do { AttributeImpl targetImpl = attributeImpls . get ( state . attribute . getClass ( ) ) ; if ( targetImpl == null ) { throw new IllegalArgumentException ( "State contains AttributeImpl of type " + state . attribute . getClass ( ) . getName ( ) + " that is not in in this AttributeSource" ) ; } state . attribute . copyTo ( targetImpl ) ; state = state . next ; } while ( state != null ) ; }
Restores this state by copying the values of all attribute implementations that this state
 contains into the attributes implementations of the targetStream.
Restores this state by copying the values of all attribute implementations that this state contains into the attributes implementations of the targetStream .