Esempio n. 1
0
 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);
   }
 }
Esempio n. 2
0
 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;
 }