Ejemplo n.º 1
0
 protected void defAdded(Backbone prev, Wom3DefinitionListDef added) {
   int i = 0;
   Backbone p = prev;
   while (true) {
     if (p == null) {
       defs.add(i, added);
       return;
     } else if (p instanceof Wom3DefinitionListTerm) {
       if (p != this) throw new InternalError();
       defs.add(i, added);
       return;
     } else if (p instanceof Wom3DefinitionListDef) {
       ++i;
     }
     p = p.getPreviousSibling();
   }
 }
Ejemplo n.º 2
0
  protected void transfer(Backbone sFirst, Backbone sLast, DefinitionListTermImpl other) {
    Backbone d = sLast;
    int i = defs.size();
    while (true) {
      if (d instanceof Wom3DefinitionListDef) {
        // Sanity check
        if (defs.get(--i) != d) throw new InternalError();
      }
      if (d == sFirst) break;
      // Step over non defs
      d = d.getPreviousSibling();
    }
    // Sanity check
    if (d != sFirst) throw new InternalError();

    // Do it!
    other.appendAll(defs.subList(i, defs.size()));
    while (defs.size() > i) defs.remove(defs.size() - 1);
  }