/**
   * Recursively process ESIS children, restore children as behaviors. Not called by default from
   * restore() because behaviors may selectively process children.
   */
  public void restoreChildren(
      ESISNode n, Layer layer) { // NB: overridden by Layer, so propagate changes.
    // System.out.println("restoring "+n.getGI());
    // with inner classes pass function to tree traversal method?
    assert layer != null;

    // traverse bottom up, so complex nodes higher up have components built first
    if (n != null)
      for (int i = 0;
          i < n.size() /* count can change while enumerating--still?  that would be bad */;
          i++) {
        Object child = n.childAt(i);
        // if (child instanceof ESISNode) System.out.println("child = "+((ESISNode)child).getGI());
        if (child instanceof ESISNode) {
          ESISNode m = (ESISNode) child;
          String bname = m.getAttr(Behavior.ATTR_BEHAVIOR);
          if (bname != null) {
            Behavior be = getInstance(m.getGI() /*bname*/, bname, m, m.attrs, layer);
            be.removeAttr(Behavior.ATTR_BEHAVIOR); // kept in classname_
          } // else assume subclass has some use for it.  DO NOT take GI as behavior name (with
          // remapping)!

          // most behaviors with internal structure call restoreChildren first and then (rest of)
          // self
        }
      }
  }