Exemplo n.º 1
0
 /**
  * Returns the distance of the specified node.
  *
  * @param pre pre value
  * @param kind node kind
  * @return distance
  */
 public int dist(final int pre, final int kind) {
   switch (kind) {
     case ELEM:
       return table.read4(pre, 4);
     case TEXT:
     case COMM:
     case PI:
       return table.read4(pre, 8);
     case ATTR:
       int d = table.read1(pre, 0) >> 3 & IO.MAXATTS;
       // skip additional attributes, if value is larger than maximum range
       if (d >= IO.MAXATTS) while (d < pre && kind(pre - d) == ATTR) d++;
       return d;
     default:
       return pre + 1;
   }
 }
Exemplo n.º 2
0
 /**
  * Returns a size value (number of descendant table entries).
  *
  * @param pre pre value
  * @param kind node kind
  * @return size value
  */
 public final int size(final int pre, final int kind) {
   return kind == ELEM || kind == DOC ? table.read4(pre, 8) : 1;
 }
Exemplo n.º 3
0
 /**
  * Returns a unique node id.
  *
  * @param pre pre value
  * @return node id
  */
 public final int id(final int pre) {
   return table.read4(pre, 12);
 }