public Track add(Track track) { synchronized (this) { Track copy; if ((copy = getTrack(track)) == null) { copy = new Track((Element) doc.importNode(track.getElement(), false)); docElt.appendChild(copy.getElement()); tracks.add(copy); hash.put(copy.getKey(), copy); } return copy; } }
public void remove(Track track) { synchronized (this) { docElt.removeChild(track.getElement()); tracks.remove(track); hash.remove(track.getKey()); } }