private void addTvShowEpisode(TvShowEpisode episode,TvShowSeason season){
synchronized (root) {
    TvShowSeasonTreeNode parent=(TvShowSeasonTreeNode)nodeMap.get(season);
    if (parent == null) {
      addTvShowSeason(season,episode.getTvShow());
      parent=(TvShowSeasonTreeNode)nodeMap.get(season);
    }
    TvShowEpisodeTreeNode child=new TvShowEpisodeTreeNode(episode);
    if (parent != null) {
      parent.add(child);
      nodeMap.put(episode,child);
      int index=getIndexOfChild(parent,child);
      if (index > -1) {
        TreeModelEvent event=new TreeModelEvent(this,parent.getPath(),new int[]{index},new Object[]{child});
        for (        TreeModelListener listener : listeners) {
          try {
            listener.treeNodesInserted(event);
          }
 catch (          NullPointerException|ArrayIndexOutOfBoundsException ignored) {
          }
        }
      }
      TreeModelEvent event=new TreeModelEvent(this,root.getPath(),null,null);
      for (      TreeModelListener listener : listeners) {
        try {
          listener.treeNodesChanged(event);
        }
 catch (        NullPointerException|ArrayIndexOutOfBoundsException ignored) {
        }
      }
    }
  }
  episode.addPropertyChangeListener(propertyChangeListener);
}

private void addTvShowEpisode ( TvShowEpisode episode , TvShowSeason season ) { synchronized ( root ) { TvShowSeasonTreeNode parent = ( TvShowSeasonTreeNode ) nodeMap . get ( season ) ; if ( parent == null ) { addTvShowSeason ( season , episode . getTvShow ( ) ) ; parent = ( TvShowSeasonTreeNode ) nodeMap . get ( season ) ; } TvShowEpisodeTreeNode child = new TvShowEpisodeTreeNode ( episode ) ; if ( parent != null ) { parent . add ( child ) ; nodeMap . put ( episode , child ) ; int index = getIndexOfChild ( parent , child ) ; if ( index > - 1 ) { TreeModelEvent event = new TreeModelEvent ( this , parent . getPath ( ) , new int [ ] { index } , new Object [ ] { child } ) ; for ( TreeModelListener listener : listeners ) { try { listener . treeNodesInserted ( event ) ; } catch ( NullPointerException | ArrayIndexOutOfBoundsException ignored ) { } } } TreeModelEvent event = new TreeModelEvent ( this , root . getPath ( ) , null , null ) ; for ( TreeModelListener listener : listeners ) { try { listener . treeNodesChanged ( event ) ; } catch ( NullPointerException | ArrayIndexOutOfBoundsException ignored ) { } } } } episode . addPropertyChangeListener ( propertyChangeListener ) ; }
adds the tv show episode .
