private void addTvShow(TvShow tvShow){
synchronized (root) {
    DefaultMutableTreeNode tvShowNode=new TvShowTreeNode(tvShow);
    root.add(tvShowNode);
    nodeMap.put(tvShow,tvShowNode);
    for (    TvShowSeason season : new ArrayList<>(tvShow.getSeasons())) {
      TvShowSeasonTreeNode seasonNode=(TvShowSeasonTreeNode)nodeMap.get(season);
      if (seasonNode == null) {
        addTvShowSeason(season,tvShow);
      }
      for (      TvShowEpisode episode : new ArrayList<>(season.getEpisodes())) {
        addTvShowEpisode(episode,season);
      }
    }
    int index=getIndexOfChild(root,tvShowNode);
    if (index > -1) {
      TreeModelEvent event=new TreeModelEvent(this,root.getPath(),new int[]{index},new Object[]{tvShow});
      for (      TreeModelListener listener : listeners) {
        try {
          listener.treeNodesInserted(event);
        }
 catch (        NullPointerException|ArrayIndexOutOfBoundsException ignored) {
        }
      }
    }
  }
  tvShow.addPropertyChangeListener(propertyChangeListener);
}

private void addTvShow ( TvShow tvShow ) { synchronized ( root ) { DefaultMutableTreeNode tvShowNode = new TvShowTreeNode ( tvShow ) ; root . add ( tvShowNode ) ; nodeMap . put ( tvShow , tvShowNode ) ; for ( TvShowSeason season : new ArrayList < > ( tvShow . getSeasons ( ) ) ) { TvShowSeasonTreeNode seasonNode = ( TvShowSeasonTreeNode ) nodeMap . get ( season ) ; if ( seasonNode == null ) { addTvShowSeason ( season , tvShow ) ; } for ( TvShowEpisode episode : new ArrayList < > ( season . getEpisodes ( ) ) ) { addTvShowEpisode ( episode , season ) ; } } int index = getIndexOfChild ( root , tvShowNode ) ; if ( index > - 1 ) { TreeModelEvent event = new TreeModelEvent ( this , root . getPath ( ) , new int [ ] { index } , new Object [ ] { tvShow } ) ; for ( TreeModelListener listener : listeners ) { try { listener . treeNodesInserted ( event ) ; } catch ( NullPointerException | ArrayIndexOutOfBoundsException ignored ) { } } } } tvShow . addPropertyChangeListener ( propertyChangeListener ) ; }
adds the tv show .
