private void setAttributesFromQueue(boolean isFirst) { final KoreanToken iw = morphQueue.removeFirst(); if (isFirst && !morphQueue.isEmpty()) { // our queue has more elements remaining (e.g. we decompounded) // capture state for those. We set the term attribute to be empty // so we save lots of array copying later. termAtt.setEmpty(); currentState = captureState(); } termAtt.setEmpty().append(iw.getTerm()); offsetAtt.setOffset(iw.getOffset(), iw.getOffset() + iw.getLength()); morphAtt.setToken(iw); // on the first Token we preserve incoming increment: if (!isFirst) { posIncrAtt.setPositionIncrement(iw.getPosInc()); } // TODO: How to handle PositionLengthAttribute correctly? }