byte dirTypeForward(){
  lastChar=text.charAt(charIndex);
  if (Character.isHighSurrogate(lastChar)) {
    int codePoint=Character.codePointAt(text,charIndex);
    charIndex+=Character.charCount(codePoint);
    return Character.getDirectionality(codePoint);
  }
  charIndex++;
  byte dirType=getCachedDirectionality(lastChar);
  if (isHtml) {
    if (lastChar == '<') {
      dirType=skipTagForward();
    }
 else     if (lastChar == '&') {
      dirType=skipEntityForward();
    }
  }
  return dirType;
}

byte dirTypeForward ( ) { lastChar = text . charAt ( charIndex ) ; if ( Character . isHighSurrogate ( lastChar ) ) { int codePoint = Character . codePointAt ( text , charIndex ) ; charIndex += Character . charCount ( codePoint ) ; return Character . getDirectionality ( codePoint ) ; } charIndex ++ ; byte dirType = getCachedDirectionality ( lastChar ) ; if ( isHtml ) { if ( lastChar == '<' ) { dirType = skipTagForward ( ) ; } else if ( lastChar == '&' ) { dirType = skipEntityForward ( ) ; } } return dirType ; }
returns the character . directionality_ . . . value of the next codepoint and advances charindex . if ishtml , and the codepoint is ' < ' or ' & ' , advances through the tag / entity , and returns character . directionality_whitespace . for an entity , it would be best to figure out the actual character , and return its dirtype , but treating it as whitespace is good enough for our purposes .
