* </ul>
* @param ranges stack of delimited text ranges
* @return new range (if constructed and pushed onto stack) or current range (if any) or null
*/
private DelimitedTextRange maybeNewRange ( Stack ranges ) {
DelimitedTextRange rCur = null; // current range (top of range stack)
DelimitedTextRange rNew = null; // new range to be pushed onto range stack
if ( ranges.empty() ) {
if ( isBidiRangeBlockItem() ) {
rNew = new DelimitedTextRange(this);
}
} else {
rCur = (DelimitedTextRange) ranges.peek();
if ( rCur != null ) {
if ( !rCur.isEmpty() || !isSelfOrDescendent ( rCur.getNode(), this ) ) {
rNew = new DelimitedTextRange(this);
}
}
}
if ( rNew != null ) {
ranges.push ( rNew );