private void assignBlockLevel(Direction paragraphEmbeddingLevel) { int defaultLevel = (paragraphEmbeddingLevel == Direction.RL) ? 1 : 0; for (Iterator it = intervals.iterator(); it.hasNext(); ) { TextInterval ti = (TextInterval) it.next(); assignBlockLevel(ti.getNode(), defaultLevel); } }
@Override public String toString() { StringBuffer sb = new StringBuffer( "DR: " + fn.getLocalName() + " { <" + CharUtilities.toNCRefs(buffer.toString()) + ">"); sb.append(", intervals <"); boolean first = true; for (Iterator it = intervals.iterator(); it.hasNext(); ) { TextInterval ti = (TextInterval) it.next(); if (first) { first = false; } else { sb.append(','); } sb.append(ti.toString()); } sb.append("> }"); return sb.toString(); }
private List assignLevels(TextInterval ti, int[] levels) { Vector tiv = new Vector(); FONode fn = ti.getNode(); int fnStart = ti.getStart(); // start of node's text in delimited text range for (int i = fnStart, n = ti.getEnd(); i < n; ) { int s = i; // inclusive start index of interval in delimited text range int e = s; // exclusive end index of interval in delimited text range int l = levels[s]; // current run level while (e < n) { // skip to end of run level or end of interval if (levels[e] != l) { break; } else { e++; } } if ((ti.getStart() == s) && (ti.getEnd() == e)) { ti.setLevel(l); // reuse interval, assigning it single level } else { ti = new TextInterval(fn, fnStart, s, e, l); // subdivide interval } if (log.isDebugEnabled()) { log.debug("AL(" + l + "): " + ti); } tiv.add(ti); i = e; } return tiv; }
/** Assign resolved levels for each interval to source #PCDATA in the associated FOText. */ private void assignTextLevels() { for (Iterator it = intervals.iterator(); it.hasNext(); ) { TextInterval ti = (TextInterval) it.next(); ti.assignTextLevels(); } }