private final SnippetVector checkValue(
     SnippetVector currentVector,
     Iterator<SnippetVector> vectorIterator,
     int startOffset,
     Fragment fragment) {
   if (currentVector == null) return null;
   StringBuilder result = new StringBuilder();
   String originalText = fragment.getOriginalText();
   int originalTextLength = originalText.length();
   int endOffset = startOffset + originalTextLength;
   int pos = 0;
   while (currentVector != null) {
     int end = currentVector.end - fragment.vectorOffset;
     if (end > endOffset) break;
     int start = currentVector.start - fragment.vectorOffset;
     if (start >= startOffset) {
       appendSubString(originalText, pos, start - startOffset, result);
       if (tags != null) result.append(tags[0]);
       appendSubString(originalText, start - startOffset, end - startOffset, result);
       if (tags != null) result.append(tags[1]);
       pos = end - startOffset;
     }
     currentVector = vectorIterator.hasNext() ? vectorIterator.next() : null;
   }
   if (result.length() == 0) return currentVector;
   if (pos < originalTextLength) appendSubString(originalText, pos, originalTextLength, result);
   fragment.setHighlightedText(result.toString());
   return currentVector;
 }
 private final void appendSubString(String text, int start, int end, StringBuilder sb) {
   if (text == null) return;
   int l = text.length();
   if (end > l) end = l;
   if (end < start) return;
   sb.append(text.substring(start, end));
 }