public void appendChild ( final Node child ) { if ( child instanceof Level ) { // Append the level levels . add ( ( Level ) child ) ; nodes . add ( child ) ; if ( child . getParent ( ) != null ) { child . removeParent ( ) ; } child . setParent ( this ) ; } else if ( child instanceof SpecTopic ) { appendSpecTopic ( ( SpecTopic ) child ) ; } else if ( child instanceof CommonContent ) { // Append the common content commonContents . add ( ( CommonContent ) child ) ; nodes . add ( child ) ; if ( child . getParent ( ) != null ) { child . removeParent ( ) ; } child . setParent ( this ) ; } else { nodes . add ( child ) ; if ( child . getParent ( ) != null ) { child . removeParent ( ) ; } child . setParent ( this ) ; } }
Adds a Child Element to the Level . If the Child Element already has a parent then it is removed from that parent and added to this level .